mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #18522 from ioito/hotfix/qx-volc-misc-fix
fix(region): volcengine vm save image
This commit is contained in:
@@ -83,12 +83,12 @@ 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.20231031085042-9d9987f1d7cb
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231031123620-984b5328cbbe
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad
|
||||
yunion.io/x/pkg v1.0.1-0.20231031115900-08d23f61bcc3
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
|
||||
|
||||
@@ -1179,8 +1179,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.20231031085042-9d9987f1d7cb h1:GwCufb3E9bd6VwBfE4Pv3QjACvQGpVxZA20YY013c38=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231031085042-9d9987f1d7cb/go.mod h1:McRjoG2gaOUisB+Qa41kLCNZhr0lsCu4apEjTiphXVY=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231031123620-984b5328cbbe h1:LIqXNh7Ke72iY1DTFXfG8mY1uzlSyIy2fsPjhlcnC5U=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231031123620-984b5328cbbe/go.mod h1:McRjoG2gaOUisB+Qa41kLCNZhr0lsCu4apEjTiphXVY=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
@@ -1194,8 +1194,8 @@ yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVB
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad h1:AoulsTEDSJbQgWeJdYW6qILEvnFJwWbsDb3YeSmZXm0=
|
||||
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/pkg v1.0.1-0.20231031115900-08d23f61bcc3 h1:VFVZECQEaxe30nt89YgUpaYvJKtL2yAILGW+gdDdn7c=
|
||||
yunion.io/x/pkg v1.0.1-0.20231031115900-08d23f61bcc3/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926 h1:FJ+2J0MwmxUcuN/8ukWHdK2XIoV3GGCotTCgi0w4L+w=
|
||||
|
||||
Vendored
+2
-2
@@ -1438,7 +1438,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.20231031085042-9d9987f1d7cb
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231031123620-984b5328cbbe
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1539,7 +1539,7 @@ yunion.io/x/log/hooks
|
||||
yunion.io/x/ovsdb/cli_util
|
||||
yunion.io/x/ovsdb/schema/ovn_nb
|
||||
yunion.io/x/ovsdb/types
|
||||
# yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad
|
||||
# yunion.io/x/pkg v1.0.1-0.20231031115900-08d23f61bcc3
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/pkg/appctx
|
||||
yunion.io/x/pkg/errors
|
||||
|
||||
+5
-5
@@ -91,7 +91,7 @@ func (disk *SDisk) GetStatus() string {
|
||||
}
|
||||
|
||||
func (disk *SDisk) Refresh() error {
|
||||
_disk, err := disk.storage.zone.region.getDisk(disk.VolumeId)
|
||||
_disk, err := disk.storage.zone.region.GetDisk(disk.VolumeId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -158,10 +158,10 @@ func (disk *SDisk) Reset(ctx context.Context, snapshotId string) (string, error)
|
||||
}
|
||||
|
||||
func (disk *SDisk) GetBillingType() string {
|
||||
if disk.BillingType == "post" {
|
||||
return billing_api.BILLING_TYPE_POSTPAID
|
||||
if disk.PayType != "post" {
|
||||
return billing_api.BILLING_TYPE_PREPAID
|
||||
}
|
||||
return billing_api.BILLING_TYPE_PREPAID
|
||||
return billing_api.BILLING_TYPE_POSTPAID
|
||||
}
|
||||
|
||||
func (disk *SDisk) GetCreatedAt() time.Time {
|
||||
@@ -253,7 +253,7 @@ func (region *SRegion) CreateDisk(zoneId string, category string, name string, s
|
||||
return body.GetString("VolumeId")
|
||||
}
|
||||
|
||||
func (region *SRegion) getDisk(diskId string) (*SDisk, error) {
|
||||
func (region *SRegion) GetDisk(diskId string) (*SDisk, error) {
|
||||
disks, _, err := region.GetDisks("", "", "", []string{diskId}, 1, 50)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, fmt.Sprintf("%s not found", diskId))
|
||||
|
||||
+13
-7
@@ -729,13 +729,19 @@ func (region *SRegion) SaveImage(instanceId string, opts *cloudprovider.SaveImag
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "CreateImage")
|
||||
}
|
||||
imageId, err := body.GetString("IamgeId")
|
||||
imageId, err := body.GetString("ImageId")
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Unmarshal")
|
||||
return nil, errors.Wrapf(err, "get imageId")
|
||||
}
|
||||
image, err := region.GetImage(imageId)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "GetImage %s", imageId)
|
||||
}
|
||||
return image, nil
|
||||
cloudprovider.Wait(time.Second*3, time.Minute, func() (bool, error) {
|
||||
_, err := region.GetImage(imageId)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == cloudprovider.ErrNotFound {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
return region.GetImage(imageId)
|
||||
}
|
||||
|
||||
+1
-1
@@ -612,7 +612,7 @@ func (regioin *SRegion) GetIHosts() ([]cloudprovider.ICloudHost, error) {
|
||||
}
|
||||
|
||||
func (region *SRegion) GetIDiskById(id string) (cloudprovider.ICloudDisk, error) {
|
||||
return region.getDisk(id)
|
||||
return region.GetDisk(id)
|
||||
}
|
||||
|
||||
func (region *SRegion) GetIStorageById(id string) (cloudprovider.ICloudStorage, error) {
|
||||
|
||||
+3
-3
@@ -119,7 +119,7 @@ func (storage *SStorage) CreateIDisk(conf *cloudprovider.DiskCreateConfig) (clou
|
||||
return nil, err
|
||||
}
|
||||
err = cloudprovider.Wait(5*time.Second, time.Minute, func() (bool, error) {
|
||||
_, err := storage.zone.region.getDisk(diskId)
|
||||
_, err := storage.zone.region.GetDisk(diskId)
|
||||
if errors.Cause(err) == cloudprovider.ErrNotFound {
|
||||
return false, nil
|
||||
}
|
||||
@@ -128,7 +128,7 @@ func (storage *SStorage) CreateIDisk(conf *cloudprovider.DiskCreateConfig) (clou
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "cannot find disk after create")
|
||||
}
|
||||
disk, err := storage.zone.region.getDisk(diskId)
|
||||
disk, err := storage.zone.region.GetDisk(diskId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func (storage *SStorage) CreateIDisk(conf *cloudprovider.DiskCreateConfig) (clou
|
||||
}
|
||||
|
||||
func (storage *SStorage) GetIDiskById(idStr string) (cloudprovider.ICloudDisk, error) {
|
||||
disk, err := storage.zone.region.getDisk(idStr)
|
||||
disk, err := storage.zone.region.GetDisk(idStr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+4
@@ -434,9 +434,13 @@ func init() {
|
||||
|
||||
func updatePrivateIPRanges(prefs []string) {
|
||||
if len(prefs) == 0 {
|
||||
// https://zh.wikipedia.org/wiki/%E4%BF%9D%E7%95%99IP%E5%9C%B0%E5%9D%80
|
||||
prefs = []string{
|
||||
"10.0.0.0/8",
|
||||
"100.64.0.0/10",
|
||||
"172.16.0.0/12",
|
||||
"192.0.0.0/24",
|
||||
"198.18.0.0/15",
|
||||
"192.168.0.0/16",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user