mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix create sys disk snapshot
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
@@ -277,8 +278,10 @@ func (self *SDisk) CreateISnapshot(ctx context.Context, name string, desc string
|
||||
snapshotId := ""
|
||||
err = cloudprovider.Wait(10*time.Second, 1800*time.Second, func() (b bool, err error) {
|
||||
statusJson, err := self.storage.zone.region.GetVbsJob(jobId)
|
||||
// ctyun 偶尔会报客户端错误,其实job已经到后台执行了
|
||||
if err != nil {
|
||||
return false, err
|
||||
log.Debugf("Ctyun.SDisk.CreateISnapshot.GetVbsJob %s", err)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if status, _ := statusJson.GetString("status"); status == "SUCCESS" {
|
||||
@@ -330,8 +333,10 @@ func (self *SDisk) Resize(ctx context.Context, newSizeMB int64) error {
|
||||
|
||||
err = cloudprovider.Wait(10*time.Second, 1800*time.Second, func() (b bool, err error) {
|
||||
statusJson, err := self.storage.zone.region.GetVbsJob(jobId)
|
||||
// ctyun 偶尔会报客户端错误,其实job已经到后台执行了
|
||||
if err != nil {
|
||||
return false, err
|
||||
log.Debugf("Ctyun.SDisk.Resize.GetVbsJob %s", err)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if status, _ := statusJson.GetString("status"); status == "SUCCESS" {
|
||||
@@ -357,8 +362,10 @@ func (self *SDisk) Reset(ctx context.Context, snapshotId string) (string, error)
|
||||
|
||||
err = cloudprovider.Wait(10*time.Second, 1800*time.Second, func() (b bool, err error) {
|
||||
statusJson, err := self.storage.zone.region.GetVbsJob(jobId)
|
||||
// ctyun 偶尔会报客户端错误,其实job已经到后台执行了
|
||||
if err != nil {
|
||||
return false, err
|
||||
log.Debugf("Ctyun.SDisk.Reset.GetVbsJob %s", err)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if status, _ := statusJson.GetString("status"); status == "SUCCESS" {
|
||||
|
||||
@@ -31,4 +31,13 @@ func init() {
|
||||
printObject(job)
|
||||
return nil
|
||||
})
|
||||
|
||||
shellutils.R(&VJobShowOptions{}, "vbs-job-show", "Show job", func(cli *ctyun.SRegion, args *VJobShowOptions) error {
|
||||
job, e := cli.GetVbsJob(args.JOBID)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printObject(job)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ func (self *SRegion) GetSnapshot(diskId string, snapshotId string) (*SSnapshot,
|
||||
|
||||
for i := range snapshots {
|
||||
snapshot := snapshots[i]
|
||||
if snapshot.ID == snapshotId {
|
||||
if snapshot.ID == snapshotId || snapshot.Container == snapshotId {
|
||||
snapshot.region = self
|
||||
return &snapshot, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user