-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provider/vsphere: govmomi v0.6.1 update and fixes #6479
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ type virtualMachine struct { | |
cluster string | ||
resourcePool string | ||
datastore string | ||
vcpu int | ||
vcpu int32 | ||
memoryMb int64 | ||
memoryAllocation memoryAllocation | ||
template string | ||
|
@@ -423,7 +423,7 @@ func resourceVSphereVirtualMachineUpdate(d *schema.ResourceData, meta interface{ | |
configSpec := types.VirtualMachineConfigSpec{} | ||
|
||
if d.HasChange("vcpu") { | ||
configSpec.NumCPUs = d.Get("vcpu").(int) | ||
configSpec.NumCPUs = int32(d.Get("vcpu").(int)) | ||
hasChanges = true | ||
rebootRequired = true | ||
} | ||
|
@@ -505,7 +505,7 @@ func resourceVSphereVirtualMachineCreate(d *schema.ResourceData, meta interface{ | |
|
||
vm := virtualMachine{ | ||
name: d.Get("name").(string), | ||
vcpu: d.Get("vcpu").(int), | ||
vcpu: int32(d.Get("vcpu").(int)), | ||
memoryMb: int64(d.Get("memory").(int)), | ||
memoryAllocation: memoryAllocation{ | ||
reservation: int64(d.Get("memory_reservation").(int)), | ||
|
@@ -933,15 +933,7 @@ func addHardDisk(vm *object.VirtualMachine, size, iops int64, diskType string, d | |
} | ||
log.Printf("[DEBUG] disk controller: %#v\n", controller) | ||
|
||
// If diskPath is not specified, pass empty string to CreateDisk() | ||
var newDiskPath string | ||
if diskPath == "" { | ||
newDiskPath = "" | ||
} else { | ||
// TODO Check if diskPath & datastore exist | ||
newDiskPath = fmt.Sprintf("[%v] %v", datastore.Name(), diskPath) | ||
} | ||
disk := devices.CreateDisk(controller, newDiskPath) | ||
disk := devices.CreateDisk(controller, datastore.Reference(), diskPath) | ||
existing := devices.SelectByBackingInfo(disk.Backing) | ||
log.Printf("[DEBUG] disk: %#v\n", disk) | ||
|
||
|
@@ -1046,7 +1038,7 @@ func buildNetworkDevice(f *find.Finder, label, adapterType string) (*types.Virtu | |
|
||
// buildVMRelocateSpec builds VirtualMachineRelocateSpec to set a place for a new VirtualMachine. | ||
func buildVMRelocateSpec(rp *object.ResourcePool, ds *object.Datastore, vm *object.VirtualMachine, linkedClone bool, initType string) (types.VirtualMachineRelocateSpec, error) { | ||
var key int | ||
var key int32 | ||
var moveType string | ||
if linkedClone { | ||
moveType = "createNewChildDiskBacking" | ||
|
@@ -1061,7 +1053,7 @@ func buildVMRelocateSpec(rp *object.ResourcePool, ds *object.Datastore, vm *obje | |
} | ||
for _, d := range devices { | ||
if devices.Type(d) == "disk" { | ||
key = d.GetVirtualDevice().Key | ||
key = int32(d.GetVirtualDevice().Key) | ||
} | ||
} | ||
|
||
|
@@ -1139,9 +1131,9 @@ func buildStoragePlacementSpecClone(c *govmomi.Client, f *object.DatacenterFolde | |
return types.StoragePlacementSpec{} | ||
} | ||
|
||
var key int | ||
var key int32 | ||
for _, d := range devices.SelectByType((*types.VirtualDisk)(nil)) { | ||
key = d.GetVirtualDevice().Key | ||
key = int32(d.GetVirtualDevice().Key) | ||
log.Printf("[DEBUG] findDatastore: virtual devices: %#v\n", d.GetVirtualDevice()) | ||
} | ||
|
||
|
@@ -1533,7 +1525,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error { | |
ipv6Spec.Ip = []types.BaseCustomizationIpV6Generator{ | ||
&types.CustomizationFixedIpV6{ | ||
IpAddress: network.ipv6Address, | ||
SubnetMask: network.ipv6PrefixLength, | ||
SubnetMask: int32(network.ipv6PrefixLength), | ||
}, | ||
} | ||
ipv6Spec.Gateway = []string{network.ipv6Gateway} | ||
|
@@ -1592,7 +1584,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error { | |
guiUnattended := types.CustomizationGuiUnattended{ | ||
AutoLogon: false, | ||
AutoLogonCount: 1, | ||
TimeZone: timeZone, | ||
TimeZone: int32(timeZone), | ||
} | ||
|
||
customIdentification := types.CustomizationIdentification{} | ||
|
@@ -1692,7 +1684,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error { | |
for _, dvc := range devices { | ||
// Issue 3559/3560: Delete all ethernet devices to add the correct ones later | ||
if devices.Type(dvc) == "ethernet" { | ||
err := newVM.RemoveDevice(context.TODO(), dvc) | ||
err := newVM.RemoveDevice(context.TODO(), false, dvc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should consider setting |
||
if err != nil { | ||
return err | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jen20 the cast to
int32
is new ... opinion? I know you go fu is strong :)