mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-22 01:39:58 -05:00
Merge pull request #128 from tianhao64/master
fix network helper method
This commit is contained in:
commit
bc2c0cc710
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user