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: Rename create* functions #4012

Merged
merged 1 commit into from
Nov 22, 2015
Merged
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
28 changes: 14 additions & 14 deletions builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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{
Expand Down