Skip to content

Commit

Permalink
add resource pool on relocateSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
kota.nakamoto committed Apr 14, 2016
1 parent f0b41c1 commit f5fd6a9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,10 @@ func buildStoragePlacementSpecCreate(f *object.DatacenterFolders, rp *object.Res
}

// buildStoragePlacementSpecClone builds StoragePlacementSpec for clone action.
func buildStoragePlacementSpecClone(c *govmomi.Client, f *object.DatacenterFolders, vm *object.VirtualMachine, storagePod *object.StoragePod) types.StoragePlacementSpec {
func buildStoragePlacementSpecClone(c *govmomi.Client, f *object.DatacenterFolders, vm *object.VirtualMachine, rp *object.ResourcePool, storagePod *object.StoragePod) types.StoragePlacementSpec {
vmr := vm.Reference()
vmfr := f.VmFolder.Reference()
rpr := rp.Reference()
spr := storagePod.Reference()

var o mo.VirtualMachine
Expand All @@ -792,7 +793,9 @@ func buildStoragePlacementSpecClone(c *govmomi.Client, f *object.DatacenterFolde
StoragePod: &spr,
},
CloneSpec: &types.VirtualMachineCloneSpec{
Location: types.VirtualMachineRelocateSpec{},
Location: types.VirtualMachineRelocateSpec{
Pool: &rpr,
},
PowerOn: false,
Template: false,
},
Expand Down Expand Up @@ -1049,7 +1052,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
if err != nil {
return err
}
sps := buildStoragePlacementSpecClone(c, dcFolders, template, sp)
sps := buildStoragePlacementSpecClone(c, dcFolders, template, resourcePool, sp)
datastore, err = findDatastore(c, sps)
if err != nil {
return err
Expand Down

0 comments on commit f5fd6a9

Please sign in to comment.