fix(region): vendor update for disable esxi swap (#21514)

This commit is contained in:
屈轩
2024-11-04 15:08:57 +08:00
committed by GitHub
parent 1194d677e4
commit c0c84269c1
7 changed files with 27 additions and 4 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ require (
k8s.io/cri-api v0.22.17
k8s.io/klog/v2 v2.20.0
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090653-c92ac41f857f
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241104064840-863ef87ab9e4
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
+2 -2
View File
@@ -1376,8 +1376,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.20241029090653-c92ac41f857f h1:dNG3NaLAVF51ZGpiD6lVCK+jmhCd4DHp+T6D+mezVUc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241029090653-c92ac41f857f/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241104064840-863ef87ab9e4 h1:PXmPXFm2taTvYq977YAjtQRbzQ4zwJe+d3ZLOLTLm18=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241104064840-863ef87ab9e4/go.mod h1:rj/pb3DitJlQaQD8UW1oxx/KD+PzDZqoywzqRJaFE9A=
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=
+1
View File
@@ -932,6 +932,7 @@ type GuestJsonDesc struct {
InstanceSnapshotId string `json:"instance_snapshot_id"`
InstanceId string `json:"instance_id"`
} `json:"instance_snapshot_info"`
EnableEsxiSwap bool `json:"enable_esxi_swap"`
EncryptKeyId string `json:"encrypt_key_id,omitempty"`
+2
View File
@@ -5200,6 +5200,8 @@ func (self *SGuest) GetJsonDescAtHypervisor(ctx context.Context, host *SHost) *a
LightMode: self.RescueMode,
Hypervisor: self.GetHypervisor(),
EnableEsxiSwap: options.Options.EnableEsxiSwap,
}
if len(self.BackupHostId) > 0 {
+1 -1
View File
@@ -1785,7 +1785,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.20241029090653-c92ac41f857f
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241104064840-863ef87ab9e4
## explicit; go 1.21
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+19
View File
@@ -778,6 +778,7 @@ type SCreateVMParam struct {
Nics []jsonutils.JSONObject
ResourcePool string
InstanceSnapshotInfo SEsxiInstanceSnapshotInfo
EnableEsxiSwap bool
}
type SEsxiInstanceSnapshotInfo struct {
@@ -1080,7 +1081,17 @@ func (host *SHost) DoCreateVM(ctx context.Context, ds *SDatastore, params SCreat
CpuHotAddEnabled: &True,
CpuHotRemoveEnabled: &True,
MemoryHotAddEnabled: &True,
ExtraConfig: []types.BaseOptionValue{},
}
if !params.EnableEsxiSwap {
spec.ExtraConfig = append(spec.ExtraConfig, &types.OptionValue{
Key: "sched.swap.vmxSwapEnabled",
Value: "FALSE",
})
}
spec.Files = &types.VirtualMachineFileInfo{
VmPathName: datastorePath,
}
@@ -1319,6 +1330,14 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
CpuHotAddEnabled: &True,
CpuHotRemoveEnabled: &True,
MemoryHotAddEnabled: &True,
ExtraConfig: []types.BaseOptionValue{},
}
if !params.EnableEsxiSwap {
spec.ExtraConfig = append(spec.ExtraConfig, &types.OptionValue{
Key: "sched.swap.vmxSwapEnabled",
Value: "FALSE",
})
}
cloneSpec.Config = &spec
task, err := ovm.Clone(ctx, folders.VmFolder, name, *cloneSpec)
+1
View File
@@ -42,6 +42,7 @@ type SDatastoreImageCache struct {
type EsxiOptions struct {
ReasonableCIDREsxi string `help:"Reasonable CIDR in esxi, such as '10.0.0.0/8'" defautl:""`
TemplateNameRegex string `help:"Regex of template name"`
EnableEsxiSwap bool `help:"Enable esxi vm swap" default:"false"`
}
var tempalteNameRegex *regexp.Regexp