diff --git a/samples/vsphere/vcenter/vm/create/create_basic_vm.py b/samples/vsphere/vcenter/vm/create/create_basic_vm.py index 18c31cde..01799b50 100644 --- a/samples/vsphere/vcenter/vm/create/create_basic_vm.py +++ b/samples/vsphere/vcenter/vm/create/create_basic_vm.py @@ -21,7 +21,7 @@ from com.vmware.vcenter.vm.hardware_client import ( Disk, Ethernet) from com.vmware.vcenter.vm.hardware_client import ScsiAddressSpec from com.vmware.vcenter.vm_client import (Power) -from com.vmware.vcenter_client import VM +from com.vmware.vcenter_client import VM, Network from vmware.vapi.vsphere.client import create_vsphere_client from samples.vsphere.common.ssl_helper import get_unverified_session @@ -84,10 +84,11 @@ class CreateBasicVM(object): datastore_name) # Get a standard network backing - standard_network = network_helper.get_standard_network_backing( + standard_network = network_helper.get_network_backing( self.client, std_portgroup_name, - datacenter_name) + datacenter_name, + Network.Type.STANDARD_PORTGROUP) """ Create a basic VM. diff --git a/samples/vsphere/vcenter/vm/create/create_exhaustive_vm.py b/samples/vsphere/vcenter/vm/create/create_exhaustive_vm.py index 40e2cb68..a9be7e8e 100644 --- a/samples/vsphere/vcenter/vm/create/create_exhaustive_vm.py +++ b/samples/vsphere/vcenter/vm/create/create_exhaustive_vm.py @@ -21,7 +21,7 @@ from com.vmware.vcenter.vm.hardware_client import ( Cpu, Memory, Disk, Ethernet, Cdrom, Serial, Parallel, Floppy, Boot) from com.vmware.vcenter.vm.hardware_client import ScsiAddressSpec from com.vmware.vcenter.vm_client import (Hardware, Power) -from com.vmware.vcenter_client import VM +from com.vmware.vcenter_client import VM, Network from vmware.vapi.vsphere.client import create_vsphere_client from samples.vsphere.common.ssl_helper import get_unverified_session @@ -94,17 +94,19 @@ class CreateExhaustiveVM(object): # Get a standard network backing if not self.standard_network: - self.standard_network = network_helper.get_standard_network_backing( + self.standard_network = network_helper.get_network_backing( self.client, std_portgroup_name, - datacenter_name) + datacenter_name, + Network.Type.STANDARD_PORTGROUP) # Get a distributed network backing if not self.distributed_network: - self.distributed_network = network_helper.get_distributed_network_backing( + self.distributed_network = network_helper.get_network_backing( self.client, dv_portgroup_name, - datacenter_name) + datacenter_name, + Network.Type.DISTRIBUTED_PORTGROUP) """ Create an exhaustive VM. diff --git a/samples/vsphere/vcenter/vm/main.py b/samples/vsphere/vcenter/vm/main.py index 282298b5..52526244 100644 --- a/samples/vsphere/vcenter/vm/main.py +++ b/samples/vsphere/vcenter/vm/main.py @@ -14,6 +14,8 @@ __author__ = 'VMware, Inc.' __vcenter_version__ = '6.5+' +from com.vmware.vcenter_client import Network + import samples.vsphere.vcenter.helper.network_helper import samples.vsphere.vcenter.vm.hardware.main import samples.vsphere.vcenter.vm.placement @@ -55,17 +57,19 @@ class VMSetup(object): # 2. DISTRIBUTED_PORTGROUP on DATACENTER2 ########################################################################### standard_network = samples.vsphere.vcenter.helper \ - .network_helper.get_standard_network_backing( + .network_helper.get_network_backing( context.client, context.testbed.config['STDPORTGROUP_NAME'], - context.testbed.config['VM_DATACENTER_NAME']) + context.testbed.config['VM_DATACENTER_NAME'], + Network.Type.STANDARD_PORTGROUP) print('standard_network={}'.format(standard_network)) distributed_network = samples.vsphere.vcenter.helper \ .network_helper.get_distributed_network_backing( context.client, context.testbed.config['VDPORTGROUP1_NAME'], - context.testbed.config['VM_DATACENTER_NAME']) + context.testbed.config['VM_DATACENTER_NAME'], + Network.Type.DISTRIBUTED_PORTGROUP) print('distributed_network={}'.format(distributed_network)) print('=' * 79)