fix create sys disk snapshot

This commit is contained in:
tangbin
2020-02-13 11:44:20 +08:00
parent 77d6e24ae7
commit 18239e30cc
3 changed files with 20 additions and 4 deletions
+10 -3
View File
@@ -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" {
+9
View File
@@ -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
})
}
+1 -1
View File
@@ -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
}