fix(region): vendor update for gcp rebuild-root sys disk size and password login

This commit is contained in:
ioito
2023-12-12 17:21:30 +08:00
parent 9052d5e03d
commit e2a4ebb03e
5 changed files with 15 additions and 7 deletions

2
go.mod
View File

@@ -88,7 +88,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.20231208091211-a5955c546fda
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231212091944-312ceead0436
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

4
go.sum
View File

@@ -1201,8 +1201,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.20231208091211-a5955c546fda h1:asWKF7lBoCCnpHjui/lD/Gd2pNHy5//Q2SF146z1Rcg=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231208091211-a5955c546fda/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231212091944-312ceead0436 h1:bi0r5AK+dxLPtNFLeSi8ljS6H55NI7Dno5w5y9y43Lo=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231212091944-312ceead0436/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
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=

2
vendor/modules.txt vendored
View File

@@ -1465,7 +1465,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.20231208091211-a5955c546fda
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231212091944-312ceead0436
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing

View File

@@ -239,10 +239,9 @@ func (region *SRegion) CreateDisk(name string, sizeGb int, zone string, storageT
// projects/my-project-15390453537169/zones/us-west2-c/diskTypes/pd-standard
"type": storageType,
}
body["sizeGb"] = sizeGb
if len(image) > 0 {
body["sourceImage"] = image
} else {
body["sizeGb"] = sizeGb
}
disk := &SDisk{}
resource := fmt.Sprintf("zones/%s/disks", zone)

View File

@@ -417,7 +417,9 @@ func (instance *SInstance) RebuildRoot(ctx context.Context, desc *cloudprovider.
}
func (instance *SInstance) DeployVM(ctx context.Context, name string, username string, password string, publicKey string, deleteKeypair bool, description string) error {
conf := cloudinit.SCloudConfig{}
conf := cloudinit.SCloudConfig{
SshPwauth: cloudinit.SSH_PASSWORD_AUTH_ON,
}
user := cloudinit.NewUser(username)
if len(password) > 0 {
user.Password(password)
@@ -792,6 +794,13 @@ func (region *SRegion) RebuildRoot(instanceId string, imageId string, sysDiskSiz
sysDiskSizeGb = disk.SizeGB
}
}
image, err := region.GetImage(imageId)
if err != nil {
return "", errors.Wrapf(err, "GetImage")
}
if image.DiskSizeGb > sysDiskSizeGb {
sysDiskSizeGb = image.DiskSizeGb
}
zone, err := region.GetZone(instance.Zone)
if err != nil {