- feature: refact snapshot related code

- feature: rbd snapshot
- bugfix: ceph cache iso image
- delete disk create snapshot and guest create snapshot
- fix auto snapshot
- fix disk reset
This commit is contained in:
wanyaoqi
2019-08-13 13:07:56 +08:00
parent 345d2dd38f
commit e32c7bdb4e
41 changed files with 1039 additions and 632 deletions
-14
View File
@@ -222,20 +222,6 @@ func init() {
printObject(disk)
return nil
})
type DiskCreateSnapshotOptions struct {
DISK string `help:"ID or name of disk"`
SNAPSHOT_NAME string `help:"Snapshot name"`
}
R(&DiskCreateSnapshotOptions{}, "disk-create-snapshot", "Disk create snapshot", func(s *mcclient.ClientSession, args *DiskCreateSnapshotOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.SNAPSHOT_NAME), "name")
disk, err := modules.Disks.PerformAction(s, args.DISK, "create-snapshot", params)
if err != nil {
return err
}
printObject(disk)
return nil
})
type DiskSaveOptions struct {
ID string `help:"ID or name of the disk" json:"-"`
+3 -6
View File
@@ -46,14 +46,11 @@ func init() {
})
type SnapshotDeleteOptions struct {
ID string `help:"Delete snapshot id"`
ID []string `help:"Delete snapshot id"`
}
R(&SnapshotDeleteOptions{}, "snapshot-delete", "Delete snapshots", func(s *mcclient.ClientSession, args *SnapshotDeleteOptions) error {
result, err := modules.Snapshots.Delete(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
ret := modules.Snapshots.BatchDelete(s, args.ID, nil)
printBatchResults(ret, modules.Snapshots.GetColumns(s))
return nil
})
type DiskDeleteSnapshotsOptions struct {