mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-10 00:27:11 +08:00
fix(region): cloudpods misc fix
This commit is contained in:
@@ -165,7 +165,7 @@ func (self *SDisk) Resize(ctx context.Context, sizeMb int64) error {
|
||||
func (self *SDisk) Reset(ctx context.Context, snapId string) (string, error) {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(snapId), "snapshot")
|
||||
_, err := self.region.perform(&modules.Disks, self.Id, "reset", params)
|
||||
_, err := self.region.perform(&modules.Disks, self.Id, "disk-reset", params)
|
||||
return self.Id, err
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,6 @@ func (self *SRegion) GetImage(id string) (*SImage, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Errorf("resp: %s", resp.PrettyString())
|
||||
return image, resp.Unmarshal(image)
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,20 @@ func (self *SRegion) SaveImage(id, imageName, notes string) (*SImage, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return self.GetImage(imageId)
|
||||
caches, err := self.GetStoragecaches()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetStoragecaches")
|
||||
}
|
||||
if len(caches) == 0 {
|
||||
return nil, fmt.Errorf("no storage cache found")
|
||||
}
|
||||
caches[0].region = self
|
||||
image, err := self.GetImage(imageId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
image.cache = &caches[0]
|
||||
return image, nil
|
||||
}
|
||||
|
||||
func (self *SInstance) AllocatePublicIpAddress() (string, error) {
|
||||
|
||||
@@ -120,7 +120,7 @@ func (self *SRegion) GetIStoragecacheById(id string) (cloudprovider.ICloudStorag
|
||||
|
||||
func (self *SRegion) GetStoragecaches() ([]SStoragecache, error) {
|
||||
caches := []SStoragecache{}
|
||||
return caches, self.list(&modules.Storagecaches, nil, caches)
|
||||
return caches, self.list(&modules.Storagecaches, nil, &caches)
|
||||
}
|
||||
|
||||
func (self *SRegion) GetStoragecache(id string) (*SStoragecache, error) {
|
||||
|
||||
Reference in New Issue
Block a user