Merge pull request #4012 from rakutentech/rename-function

provider/vsphere: Rename create* functions
This commit is contained in:
James Nugent 2015-11-22 11:34:42 +02:00
commit 774ed1ded8
1 changed files with 14 additions and 14 deletions

View File

@ -563,8 +563,8 @@ func addHardDisk(vm *object.VirtualMachine, size, iops int64, diskType string) e
}
}
// createNetworkDevice creates VirtualDeviceConfigSpec for Network Device.
func createNetworkDevice(f *find.Finder, label, adapterType string) (*types.VirtualDeviceConfigSpec, error) {
// buildNetworkDevice builds VirtualDeviceConfigSpec for Network Device.
func buildNetworkDevice(f *find.Finder, label, adapterType string) (*types.VirtualDeviceConfigSpec, error) {
network, err := f.Network(context.TODO(), "*"+label)
if err != nil {
return nil, err
@ -608,8 +608,8 @@ func createNetworkDevice(f *find.Finder, label, adapterType string) (*types.Virt
}
}
// createVMRelocateSpec creates VirtualMachineRelocateSpec to set a place for a new VirtualMachine.
func createVMRelocateSpec(rp *object.ResourcePool, ds *object.Datastore, vm *object.VirtualMachine) (types.VirtualMachineRelocateSpec, error) {
// buildVMRelocateSpec builds VirtualMachineRelocateSpec to set a place for a new VirtualMachine.
func buildVMRelocateSpec(rp *object.ResourcePool, ds *object.Datastore, vm *object.VirtualMachine) (types.VirtualMachineRelocateSpec, error) {
var key int
devices, err := vm.Device(context.TODO())
@ -655,8 +655,8 @@ func getDatastoreObject(client *govmomi.Client, f *object.DatacenterFolders, nam
return ref.Reference(), nil
}
// createStoragePlacementSpecCreate creates StoragePlacementSpec for create action.
func createStoragePlacementSpecCreate(f *object.DatacenterFolders, rp *object.ResourcePool, storagePod object.StoragePod, configSpec types.VirtualMachineConfigSpec) types.StoragePlacementSpec {
// buildStoragePlacementSpecCreate builds StoragePlacementSpec for create action.
func buildStoragePlacementSpecCreate(f *object.DatacenterFolders, rp *object.ResourcePool, storagePod object.StoragePod, configSpec types.VirtualMachineConfigSpec) types.StoragePlacementSpec {
vmfr := f.VmFolder.Reference()
rpr := rp.Reference()
spr := storagePod.Reference()
@ -674,8 +674,8 @@ func createStoragePlacementSpecCreate(f *object.DatacenterFolders, rp *object.Re
return sps
}
// createStoragePlacementSpecClone creates StoragePlacementSpec for clone action.
func createStoragePlacementSpecClone(c *govmomi.Client, f *object.DatacenterFolders, vm *object.VirtualMachine, rp *object.ResourcePool, storagePod object.StoragePod) types.StoragePlacementSpec {
// buildStoragePlacementSpecClone builds StoragePlacementSpec for clone action.
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()
@ -784,7 +784,7 @@ func (vm *virtualMachine) createVirtualMachine(c *govmomi.Client) error {
networkDevices := []types.BaseVirtualDeviceConfigSpec{}
for _, network := range vm.networkInterfaces {
// network device
nd, err := createNetworkDevice(finder, network.label, "e1000")
nd, err := buildNetworkDevice(finder, network.label, "e1000")
if err != nil {
return err
}
@ -821,7 +821,7 @@ func (vm *virtualMachine) createVirtualMachine(c *govmomi.Client) error {
sp := object.StoragePod{
object.NewFolder(c.Client, d),
}
sps := createStoragePlacementSpecCreate(dcFolders, resourcePool, sp, configSpec)
sps := buildStoragePlacementSpecCreate(dcFolders, resourcePool, sp, configSpec)
datastore, err = findDatastore(c, sps)
if err != nil {
return err
@ -938,7 +938,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
sp := object.StoragePod{
object.NewFolder(c.Client, d),
}
sps := createStoragePlacementSpecClone(c, dcFolders, template, resourcePool, sp)
sps := buildStoragePlacementSpecClone(c, dcFolders, template, resourcePool, sp)
datastore, err = findDatastore(c, sps)
if err != nil {
return err
@ -950,7 +950,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
}
log.Printf("[DEBUG] datastore: %#v", datastore)
relocateSpec, err := createVMRelocateSpec(resourcePool, datastore, template)
relocateSpec, err := buildVMRelocateSpec(resourcePool, datastore, template)
if err != nil {
return err
}
@ -961,7 +961,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
networkConfigs := []types.CustomizationAdapterMapping{}
for _, network := range vm.networkInterfaces {
// network device
nd, err := createNetworkDevice(finder, network.label, "vmxnet3")
nd, err := buildNetworkDevice(finder, network.label, "vmxnet3")
if err != nil {
return err
}
@ -1003,7 +1003,7 @@ func (vm *virtualMachine) deployVirtualMachine(c *govmomi.Client) error {
}
log.Printf("[DEBUG] virtual machine config spec: %v", configSpec)
// create CustomizationSpec
// build CustomizationSpec
customSpec := types.CustomizationSpec{
Identity: &types.CustomizationLinuxPrep{
HostName: &types.CustomizationFixedName{