mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): vendor update
This commit is contained in:
@@ -83,14 +83,14 @@ 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.20230922055518-0b8dd444c8bf
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230927100743-ebff763b8ccc
|
||||
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.20230912084455-1393f31347db
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230823191329-dc02ac3a547c
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230928111914-f6800c3983db
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
|
||||
)
|
||||
|
||||
|
||||
@@ -1174,8 +1174,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.20230922055518-0b8dd444c8bf h1:7lo3kA2IZzJGLQ/jLP8h7J1e44kOoKhtsJrJv7aZRYg=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230922055518-0b8dd444c8bf/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230927100743-ebff763b8ccc h1:gpJnK51ko5tt+VNyAAxmQfQZQMWfpHGmjx4qfbM8vfI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230927100743-ebff763b8ccc/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
|
||||
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=
|
||||
@@ -1193,7 +1193,7 @@ yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db h1:yxiqu3C7wDnL3M8Nn54QmBp+
|
||||
yunion.io/x/pkg v1.0.1-0.20230912084455-1393f31347db/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.20230823191329-dc02ac3a547c h1:9R2cTcmPBUno1P2YI321nztK1Jpu7QRBNbnHsI1uX1Q=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230823191329-dc02ac3a547c/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230928111914-f6800c3983db h1:PcELFdUFfgYsqbdompNcRioiwHew0fr0vdp1jc95FVQ=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20230928111914-f6800c3983db/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
|
||||
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
Vendored
+2
-2
@@ -1432,7 +1432,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.20230922055518-0b8dd444c8bf
|
||||
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230927100743-ebff763b8ccc
|
||||
## explicit; go 1.18
|
||||
yunion.io/x/cloudmux/pkg/apis
|
||||
yunion.io/x/cloudmux/pkg/apis/billing
|
||||
@@ -1586,7 +1586,7 @@ yunion.io/x/pkg/utils
|
||||
# yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
## explicit; go 1.12
|
||||
yunion.io/x/s3cli
|
||||
# yunion.io/x/sqlchemy v1.1.2-0.20230823191329-dc02ac3a547c
|
||||
# yunion.io/x/sqlchemy v1.1.2-0.20230928111914-f6800c3983db
|
||||
## explicit; go 1.17
|
||||
yunion.io/x/sqlchemy
|
||||
yunion.io/x/sqlchemy/backends
|
||||
|
||||
+48
-55
@@ -17,6 +17,7 @@ package esxi
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -30,7 +31,9 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/netutils"
|
||||
"yunion.io/x/pkg/util/reflectutils"
|
||||
"yunion.io/x/pkg/util/regutils"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
api "yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
@@ -1158,54 +1161,31 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
|
||||
|
||||
deviceChange := make([]types.BaseVirtualDeviceConfigSpec, 0, 3)
|
||||
|
||||
addDeviceChange := make([]types.BaseVirtualDeviceConfigSpec, 0, 3)
|
||||
|
||||
// change nic if set
|
||||
if params.Nics != nil && len(params.Nics) > 0 {
|
||||
// get origin nics
|
||||
originNics := make([]types.BaseVirtualDevice, 0, 1)
|
||||
for _, nic := range from.vnics {
|
||||
originNics = append(originNics, nic.getVirtualEthernetCard())
|
||||
macAddrs := []string{}
|
||||
for _, nic := range params.Nics {
|
||||
index, _ := nic.Int("index")
|
||||
mac, _ := nic.GetString("mac")
|
||||
macAddrs = append(macAddrs, mac)
|
||||
bridge, _ := nic.GetString("bridge")
|
||||
driver := "e1000"
|
||||
if nic.Contains("driver") {
|
||||
driver, _ = nic.GetString("driver")
|
||||
}
|
||||
nicIndex := 0
|
||||
nics := params.Nics
|
||||
for _, nic := range nics {
|
||||
index, _ := nic.Int("index")
|
||||
mac, _ := nic.GetString("mac")
|
||||
bridge, _ := nic.GetString("bridge")
|
||||
driver := "e1000"
|
||||
if nic.Contains("driver") {
|
||||
driver, _ = nic.GetString("driver")
|
||||
}
|
||||
if host.isVersion50() {
|
||||
driver = "e1000"
|
||||
}
|
||||
var vlanId int64 = 1
|
||||
if nic.Contains("vlan") {
|
||||
vlanId, _ = nic.Int("vlan")
|
||||
}
|
||||
dev, err := NewVNICDev(host, mac, driver, bridge, int32(vlanId), 4000, 100, int32(index))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "NewVNICDev")
|
||||
}
|
||||
op := types.VirtualDeviceConfigSpecOperationAdd
|
||||
if nicIndex < len(originNics) {
|
||||
// edit
|
||||
op = types.VirtualDeviceConfigSpecOperationEdit
|
||||
host.changeNic(originNics[nicIndex], dev)
|
||||
dev = originNics[nicIndex]
|
||||
deviceChange = append(deviceChange, &types.VirtualDeviceConfigSpec{
|
||||
Operation: op,
|
||||
Device: dev,
|
||||
})
|
||||
} else {
|
||||
addDeviceChange = append(addDeviceChange, &types.VirtualDeviceConfigSpec{
|
||||
Operation: op,
|
||||
Device: dev,
|
||||
})
|
||||
}
|
||||
nicIndex += 1
|
||||
if host.isVersion50() {
|
||||
driver = "e1000"
|
||||
}
|
||||
var vlanId int64 = 1
|
||||
if nic.Contains("vlan") {
|
||||
vlanId, _ = nic.Int("vlan")
|
||||
}
|
||||
dev, err := NewVNICDev(host, mac, driver, bridge, int32(vlanId), 4000, 100, int32(index))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "NewVNICDev")
|
||||
}
|
||||
deviceChange = append(deviceChange, &types.VirtualDeviceConfigSpec{
|
||||
Operation: types.VirtualDeviceConfigSpecOperationAdd,
|
||||
Device: dev,
|
||||
})
|
||||
}
|
||||
|
||||
if len(params.Disks) > 0 && snapshot == nil {
|
||||
@@ -1221,7 +1201,7 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
|
||||
if host.isVersion50() {
|
||||
driver = "scsi"
|
||||
}
|
||||
addDeviceChange = append(addDeviceChange, addDevSpec(NewSCSIDev(key, 100, driver)))
|
||||
deviceChange = append(deviceChange, addDevSpec(NewSCSIDev(key, 100, driver)))
|
||||
}
|
||||
} else {
|
||||
ideDevs, err := from.FindController(ctx, "ide")
|
||||
@@ -1230,8 +1210,7 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
|
||||
}
|
||||
if len(ideDevs) == 0 {
|
||||
// add ide driver
|
||||
addDeviceChange = append(addDeviceChange, addDevSpec(NewIDEDev(200, 0)))
|
||||
// addDeviceChange = append(deviceChange, addDevSpec(NewIDEDev(200, 1)))
|
||||
deviceChange = append(deviceChange, addDevSpec(NewIDEDev(200, 0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1255,11 +1234,10 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
|
||||
hostref := host.GetHostSystem().Reference()
|
||||
dsref := ds.getDatastoreObj().Reference()
|
||||
relocateSpec := types.VirtualMachineRelocateSpec{
|
||||
DeviceChange: deviceChange,
|
||||
Folder: &folderref,
|
||||
Pool: &poolref,
|
||||
Host: &hostref,
|
||||
Datastore: &dsref,
|
||||
Folder: &folderref,
|
||||
Pool: &poolref,
|
||||
Host: &hostref,
|
||||
Datastore: &dsref,
|
||||
}
|
||||
cloneSpec := &types.VirtualMachineCloneSpec{
|
||||
PowerOn: false,
|
||||
@@ -1304,11 +1282,26 @@ func (host *SHost) CloneVM(ctx context.Context, from *SVirtualMachine, snapshot
|
||||
return nil, errors.Error("clone successfully but unable to NewVirtualMachine")
|
||||
}
|
||||
|
||||
// remove old nics
|
||||
svm := vm.getVirtualMachine()
|
||||
for i := range svm.Config.Hardware.Device {
|
||||
dev := svm.Config.Hardware.Device[i]
|
||||
devType := reflect.Indirect(reflect.ValueOf(dev)).Type()
|
||||
etherType := reflect.TypeOf((*types.VirtualEthernetCard)(nil)).Elem()
|
||||
if reflectutils.StructContains(devType, etherType) {
|
||||
nic := NewVirtualNIC(vm, dev, i)
|
||||
if !utils.IsInStringArray(nic.GetMAC(), macAddrs) {
|
||||
deviceChange = append(deviceChange, &types.VirtualDeviceConfigSpec{
|
||||
Operation: types.VirtualDeviceConfigSpecOperationRemove,
|
||||
Device: nic.getVirtualEthernetCard(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if snapshot != nil {
|
||||
return vm, nil
|
||||
}
|
||||
|
||||
deviceChange = addDeviceChange
|
||||
// adjust disk
|
||||
var i int
|
||||
if len(params.Disks) > 0 {
|
||||
|
||||
+6
-6
@@ -34,27 +34,27 @@ func (mysql *SMySQLBackend) CommitTableChangeSQL(ts sqlchemy.ITableSpec, changes
|
||||
alters := make([]string, 0)
|
||||
// first check if primary key is modifed
|
||||
changePrimary := false
|
||||
// oldHasPrimary := false
|
||||
oldHasPrimary := false
|
||||
for _, col := range changes.RemoveColumns {
|
||||
if col.IsPrimary() {
|
||||
changePrimary = true
|
||||
// oldHasPrimary = true
|
||||
oldHasPrimary = true
|
||||
}
|
||||
}
|
||||
for _, cols := range changes.UpdatedColumns {
|
||||
if cols.OldCol.IsPrimary() != cols.NewCol.IsPrimary() {
|
||||
changePrimary = true
|
||||
}
|
||||
// if cols.OldCol.IsPrimary() {
|
||||
// oldHasPrimary = true
|
||||
// }
|
||||
if cols.OldCol.IsPrimary() {
|
||||
oldHasPrimary = true
|
||||
}
|
||||
}
|
||||
for _, col := range changes.AddColumns {
|
||||
if col.IsPrimary() {
|
||||
changePrimary = true
|
||||
}
|
||||
}
|
||||
if changePrimary {
|
||||
if changePrimary && oldHasPrimary {
|
||||
sql := fmt.Sprintf("DROP PRIMARY KEY")
|
||||
alters = append(alters, sql)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user