mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
- 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:
@@ -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:"-"`
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user