fix(esxi-agent): vendor update (#22203)

This commit is contained in:
屈轩
2025-02-27 14:49:24 +08:00
committed by GitHub
parent b081dc43de
commit 77efa95856
8 changed files with 24 additions and 9 deletions
+1 -1
View File
@@ -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.20250225101418-162e21a39499
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250227042131-f593167ee17c
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
+2 -2
View File
@@ -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.20250225101418-162e21a39499 h1:+Hzzk52JkHCyLlPWASkn+t7TWve2zRbnLj5VEEjF4JM=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250225101418-162e21a39499/go.mod h1:KQ/jWx7bZlmjCE711KEWuvHW/dzpdr/UTlBjjutkj0Y=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250227042131-f593167ee17c h1:hzn/h8hXzDdecs6fJ6ZU/qq1HRg8M2ovEle0n80q7Tg=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250227042131-f593167ee17c/go.mod h1:KQ/jWx7bZlmjCE711KEWuvHW/dzpdr/UTlBjjutkj0Y=
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256 h1:kLKQ6zbgPDQflRwoHFAjxNChcbhXIFgsUVLkJwiXu/8=
yunion.io/x/executor v0.0.0-20241205080005-48f5b1212256/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+3 -1
View File
@@ -125,12 +125,14 @@ func (as *SAgentStorage) agentRebuildRoot(ctx context.Context, data jsonutils.JS
return errors.Wrap(hostutils.ParamsError, "agentRebuildRoot data.desc.disks is empty")
}
imagePath := rp.Desc.Disks[0].ImagePath
uefi := false
var newPath string
if len(imagePath) == 0 {
vm, err := host.SearchTemplateVM(rp.Desc.Disks[0].ImageInfo.ImageExternalId)
if err != nil {
return errors.Wrapf(err, "SearchTemplateVM(%s)", rp.Desc.Disks[0].ImageInfo.ImageExternalId)
}
uefi = vm.GetBios() == cloudprovider.UEFI
newPath, err = vm.GetRootImagePath()
if err != nil {
return errors.Wrapf(err, "GetRootImagePath")
@@ -143,7 +145,7 @@ func (as *SAgentStorage) agentRebuildRoot(ctx context.Context, data jsonutils.JS
}
diskId := rp.Desc.Disks[0].DiskId
vm := ivm.(*esxi.SVirtualMachine)
return vm.DoRebuildRoot(ctx, newPath, diskId)
return vm.DoRebuildRoot(ctx, newPath, diskId, uefi)
}
func (as *SAgentStorage) agentCreateGuest(ctx context.Context, data *jsonutils.JSONDict) (bool, error) {
+1 -1
View File
@@ -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.20250225101418-162e21a39499
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250227042131-f593167ee17c
## explicit; go 1.21
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+1
View File
@@ -26,6 +26,7 @@ import (
)
type SDiskConfig struct {
Uefi bool
SizeMb int64
Uuid string
ControllerKey int32
+5
View File
@@ -1335,6 +1335,11 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
MemoryHotAddEnabled: &True,
ExtraConfig: []types.BaseOptionValue{},
Firmware: "bios",
}
if from.GetBios() == cloudprovider.UEFI {
spec.Firmware = "efi"
}
if !params.EnableEsxiSwap {
spec.ExtraConfig = append(spec.ExtraConfig, &types.OptionValue{
+1 -1
View File
@@ -569,7 +569,7 @@ func (disk *SVirtualDisk) GetExpiredAt() time.Time {
}
func (disk *SVirtualDisk) Rebuild(ctx context.Context) error {
return disk.vm.rebuildDisk(ctx, disk, "")
return disk.vm.rebuildDisk(ctx, disk, "", false)
}
func (disk *SVirtualDisk) GetProjectId() string {
+10 -3
View File
@@ -289,14 +289,14 @@ func (svm *SVirtualMachine) RebuildRoot(ctx context.Context, desc *cloudprovider
return "", cloudprovider.ErrNotImplemented
}
func (svm *SVirtualMachine) DoRebuildRoot(ctx context.Context, imagePath string, uuid string) error {
func (svm *SVirtualMachine) DoRebuildRoot(ctx context.Context, imagePath string, uuid string, uefi bool) error {
if len(svm.vdisks) == 0 {
return errors.Wrapf(errors.ErrNotFound, "empty vdisks")
}
return svm.rebuildDisk(ctx, &svm.vdisks[0], imagePath)
return svm.rebuildDisk(ctx, &svm.vdisks[0], imagePath, uefi)
}
func (svm *SVirtualMachine) rebuildDisk(ctx context.Context, disk *SVirtualDisk, imagePath string) error {
func (svm *SVirtualMachine) rebuildDisk(ctx context.Context, disk *SVirtualDisk, imagePath string, uefi bool) error {
uuid := disk.GetId()
sizeMb := disk.GetDiskSizeMB()
diskKey := disk.getKey()
@@ -308,6 +308,7 @@ func (svm *SVirtualMachine) rebuildDisk(ctx context.Context, disk *SVirtualDisk,
return err
}
return svm.createDiskInternal(ctx, SDiskConfig{
Uefi: uefi,
SizeMb: int64(sizeMb),
Uuid: uuid,
ControllerKey: ctlKey,
@@ -1240,6 +1241,12 @@ func (svm *SVirtualMachine) createDiskWithDeviceChange(ctx context.Context, devi
}
configSpec := types.VirtualMachineConfigSpec{}
configSpec.DeviceChange = append(deviceChange, spec)
if config.IsRoot {
configSpec.Firmware = "bios"
if config.Uefi {
configSpec.Firmware = "efi"
}
}
vmObj := svm.getVmObj()