mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): vendor update (#22625)
This commit is contained in:
@@ -87,7 +87,7 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250527041633-ac0cc1a852e0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250528153755-7574dd2e7d19
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
|
||||
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
|
||||
@@ -1274,8 +1274,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250527041633-ac0cc1a852e0 h1:motU+IBwgCTKJZOykEQpPU4pRmU+gKHAC3Zowlas8vk=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250527041633-ac0cc1a852e0/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250528153755-7574dd2e7d19 h1:dzndpUx6UR8HsKKz49yGpv4C8MeJrFtuG0sLazdtxGE=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250528153755-7574dd2e7d19/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
|
||||
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
|
||||
Vendored
+1
-1
@@ -1576,7 +1576,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
|
||||
# sigs.k8s.io/yaml v1.2.0
|
||||
## explicit; go 1.12
|
||||
sigs.k8s.io/yaml
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250527041633-ac0cc1a852e0
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250528153755-7574dd2e7d19
|
||||
## explicit; go 1.21
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
|
||||
-8
@@ -17,7 +17,6 @@ package aws
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -294,13 +293,6 @@ func (self *SRegion) GetDisks(instanceId string, zoneId string, storageType stri
|
||||
params["NextToken"] = part.NextToken
|
||||
}
|
||||
|
||||
if len(instanceId) > 0 {
|
||||
// 系统盘必须放在第零个位置
|
||||
sort.Slice(disks, func(i, j int) bool {
|
||||
return disks[i].getDevice() < disks[j].getDevice()
|
||||
})
|
||||
}
|
||||
|
||||
return disks, nil
|
||||
}
|
||||
|
||||
|
||||
+34
-14
@@ -298,16 +298,21 @@ func (self *SInstance) GetIDisks() ([]cloudprovider.ICloudDisk, error) {
|
||||
return nil, errors.Wrap(err, "GetDisks")
|
||||
}
|
||||
|
||||
idisks := make([]cloudprovider.ICloudDisk, len(disks))
|
||||
ret := []cloudprovider.ICloudDisk{}
|
||||
for i := 0; i < len(disks); i += 1 {
|
||||
store, err := self.host.zone.getStorageByCategory(disks[i].VolumeType)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "getStorageByCategory")
|
||||
}
|
||||
disks[i].storage = store
|
||||
idisks[i] = &disks[i]
|
||||
if disks[i].getDevice() == self.RootDeviceName {
|
||||
ret = append([]cloudprovider.ICloudDisk{&disks[i]}, ret...)
|
||||
} else {
|
||||
ret = append(ret, &disks[i])
|
||||
}
|
||||
}
|
||||
return idisks, nil
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (self *SInstance) GetINics() ([]cloudprovider.ICloudNic, error) {
|
||||
@@ -568,7 +573,7 @@ func (self *SInstance) RebuildRoot(ctx context.Context, desc *cloudprovider.SMan
|
||||
|
||||
cloudconfig := &cloudinit.SCloudConfig{}
|
||||
if srcOsType != winOS && len(udata) > 0 {
|
||||
_cloudconfig, err := cloudinit.ParseUserDataBase64(udata)
|
||||
_cloudconfig, err := cloudinit.ParseUserData(udata)
|
||||
if err != nil {
|
||||
// 忽略无效的用户数据
|
||||
log.Debugf("RebuildRoot invalid instance user data %s", udata)
|
||||
@@ -913,7 +918,7 @@ func (self *SRegion) ReplaceSystemDisk(ctx context.Context, instanceId string, i
|
||||
|
||||
var rootDisk *SDisk
|
||||
for _, disk := range disks {
|
||||
if disk.GetDiskType() == api.DISK_TYPE_SYS {
|
||||
if disk.getDevice() == instance.RootDeviceName {
|
||||
rootDisk = &disk
|
||||
break
|
||||
}
|
||||
@@ -948,32 +953,40 @@ func (self *SRegion) ReplaceSystemDisk(ctx context.Context, instanceId string, i
|
||||
return "", fmt.Errorf("ReplaceSystemDisk create temp server failed.")
|
||||
}
|
||||
|
||||
cloudprovider.Wait(time.Second*2, time.Minute*3, func() (bool, error) {
|
||||
err = cloudprovider.Wait(time.Second*2, time.Minute*10, func() (bool, error) {
|
||||
instance, err := self.GetInstance(vm.InstanceId)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "GetInstance")
|
||||
}
|
||||
log.Debugf("wait temp vm %s running, current status: %s", vm.InstanceId, instance.GetStatus())
|
||||
if instance.GetStatus() == api.VM_RUNNING {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("wait temp vm %s running error: %v", vm.InstanceId, err)
|
||||
}
|
||||
|
||||
err = self.StopVM(vm.InstanceId, true)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "StopVM")
|
||||
}
|
||||
|
||||
cloudprovider.Wait(time.Second*2, time.Minute*3, func() (bool, error) {
|
||||
err = cloudprovider.Wait(time.Second*2, time.Minute*10, func() (bool, error) {
|
||||
instance, err := self.GetInstance(vm.InstanceId)
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, "GetInstance")
|
||||
}
|
||||
log.Debugf("wait temp vm %s stop, current status: %s", vm.InstanceId, instance.GetStatus())
|
||||
if instance.GetStatus() == api.VM_READY {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("wait temp vm %s stop error: %v", vm.InstanceId, err)
|
||||
}
|
||||
|
||||
// detach disks
|
||||
tempInstance, err := self.GetInstance(vm.InstanceId)
|
||||
@@ -981,23 +994,30 @@ func (self *SRegion) ReplaceSystemDisk(ctx context.Context, instanceId string, i
|
||||
return "", errors.Wrapf(err, "GetInstance")
|
||||
}
|
||||
|
||||
tempRootDiskId := tempInstance.BlockDeviceMappings[0].Ebs.VolumeId
|
||||
|
||||
err = self.DetachDisk(tempInstance.GetId(), tempRootDiskId)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "DetachDisk temp vm")
|
||||
}
|
||||
|
||||
err = self.DetachDisk(instance.GetId(), rootDisk.VolumeId)
|
||||
if err != nil {
|
||||
self.DeleteDisk(tempRootDiskId)
|
||||
return "", errors.Wrapf(err, "DetachDisk")
|
||||
}
|
||||
|
||||
err = self.DetachDisk(tempInstance.GetId(), tempInstance.BlockDeviceMappings[0].Ebs.VolumeId)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "DetachDisk")
|
||||
}
|
||||
|
||||
err = self.AttachDisk(instance.GetId(), tempInstance.BlockDeviceMappings[0].Ebs.VolumeId, rootDisk.getDevice())
|
||||
err = self.AttachDisk(instance.GetId(), tempRootDiskId, rootDisk.getDevice())
|
||||
if err != nil {
|
||||
self.DeleteDisk(tempRootDiskId)
|
||||
self.AttachDisk(instance.GetId(), rootDisk.VolumeId, rootDisk.getDevice())
|
||||
return "", errors.Wrapf(err, "ttachDisk")
|
||||
}
|
||||
|
||||
err = self.ModifyInstanceAttribute(instance.InstanceId, &SInstanceAttr{UserData: userdata})
|
||||
if err != nil {
|
||||
self.DeleteDisk(tempRootDiskId)
|
||||
self.AttachDisk(instance.GetId(), rootDisk.VolumeId, rootDisk.getDevice())
|
||||
return "", errors.Wrapf(err, "ModifyInstanceAttribute")
|
||||
}
|
||||
|
||||
@@ -1005,7 +1025,7 @@ func (self *SRegion) ReplaceSystemDisk(ctx context.Context, instanceId string, i
|
||||
if err != nil {
|
||||
log.Errorf("DeleteDisk %s", rootDisk.VolumeId)
|
||||
}
|
||||
return tempInstance.BlockDeviceMappings[0].Ebs.VolumeId, nil
|
||||
return tempRootDiskId, nil
|
||||
}
|
||||
|
||||
func (self *SRegion) ChangeVMConfig2(instanceId string, instanceType string) error {
|
||||
|
||||
Reference in New Issue
Block a user