Skip to content
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

Merged
merged 4 commits into from
May 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Contributor

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 :)

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 @@ -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)

Expand Down Expand Up @@ -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"
Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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())
}

Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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{}
Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider setting false as a parameter. No change needed at this point.

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