Skip to content

Commit

Permalink
provider/vsphere: govmomi v0.6.1 update and fixes (#6479)
Browse files Browse the repository at this point in the history
* vendor: Update dependency vmware/govmomi

* fixed data types

* fixed RemoveDevice

* fixed CreateDisk usage
  • Loading branch information
thetuxkeeper authored and stack72 committed May 13, 2016
1 parent c07f1ff commit 390b0d5
Show file tree
Hide file tree
Showing 41 changed files with 1,768 additions and 1,258 deletions.
60 changes: 30 additions & 30 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 11 additions & 19 deletions builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type virtualMachine struct {
cluster string
resourcePool string
datastore string
vcpu int
vcpu int32
memoryMb int64
memoryAllocation memoryAllocation
template string
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)),
Expand Down Expand Up @@ -958,15 +958,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)

Expand Down Expand Up @@ -1071,7 +1063,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"
Expand All @@ -1086,7 +1078,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)
}
}

Expand Down Expand Up @@ -1164,9 +1156,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())
}

Expand Down Expand Up @@ -1558,7 +1550,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}
Expand Down Expand Up @@ -1620,7 +1612,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
guiUnattended := types.CustomizationGuiUnattended{
AutoLogon: false,
AutoLogonCount: 1,
TimeZone: timeZone,
TimeZone: int32(timeZone),
}

customIdentification := types.CustomizationIdentification{}
Expand Down Expand Up @@ -1720,7 +1712,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)
if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/vmware/govmomi/.drone.sec

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions vendor/github.com/vmware/govmomi/.drone.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/vmware/govmomi/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions vendor/github.com/vmware/govmomi/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions vendor/github.com/vmware/govmomi/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions vendor/github.com/vmware/govmomi/CONTRIBUTING.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 390b0d5

Please sign in to comment.