mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
修正:1. storagecache.CacheImage接口需要指定format 2.
PerformAction默认返回ActionNotFound Error
This commit is contained in:
@@ -419,9 +419,10 @@ func init() {
|
||||
})
|
||||
|
||||
type HostCacheImageActionOptions struct {
|
||||
ID string `help:"ID or name of host"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
ID string `help:"ID or name of host"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
Format string `help:"image format" choices:"iso|vmdk|qcow2|vhd"`
|
||||
}
|
||||
R(&HostCacheImageActionOptions{}, "host-cache-image", "Ask a host to cache a image", func(s *mcclient.ClientSession, args *HostCacheImageActionOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
|
||||
@@ -46,9 +46,10 @@ func init() {
|
||||
})
|
||||
|
||||
type StorageCacheImageActionOptions struct {
|
||||
ID string `help:"ID or name of storage"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
ID string `help:"ID or name of storage"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
Format string `help:"image format" choices:"iso|qcow2|vmdk|vhd"`
|
||||
}
|
||||
R(&StorageCacheImageActionOptions{}, "storagecache-cache-image", "Ask a storage cache to cache a image", func(s *mcclient.ClientSession, args *StorageCacheImageActionOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -56,6 +57,9 @@ func init() {
|
||||
if args.Force {
|
||||
params.Add(jsonutils.JSONTrue, "is_force")
|
||||
}
|
||||
if len(args.Format) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Format), "format")
|
||||
}
|
||||
storage, err := modules.Storagecaches.PerformAction(s, args.ID, "cache-image", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -172,9 +172,10 @@ func init() {
|
||||
})
|
||||
|
||||
type StorageCacheImageActionOptions struct {
|
||||
ID string `help:"ID or name of storage"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
ID string `help:"ID or name of storage"`
|
||||
IMAGE string `help:"ID or name of image"`
|
||||
Force bool `help:"Force refresh cache, even if the image exists in cache"`
|
||||
Format string `help:"Image force" choices:"iso|vmdk|qcow2|vhd"`
|
||||
}
|
||||
R(&StorageCacheImageActionOptions{}, "storage-cache-image", "Ask a storage to cache a image", func(s *mcclient.ClientSession, args *StorageCacheImageActionOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -182,6 +183,9 @@ func init() {
|
||||
if args.Force {
|
||||
params.Add(jsonutils.JSONTrue, "is_force")
|
||||
}
|
||||
if len(args.Format) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Format), "format")
|
||||
}
|
||||
storage, err := modules.Storages.PerformAction(s, args.ID, "cache-image", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user