diff --git a/samples/vsphere/common/sample_util.py b/samples/vsphere/common/sample_util.py index 40321297..5d5da362 100644 --- a/samples/vsphere/common/sample_util.py +++ b/samples/vsphere/common/sample_util.py @@ -55,9 +55,9 @@ def parse_cli_args_vm(vm_name): if args.vm_name: vm_name = args.vm_name else: - print("Using vm name({}) specified in testbed.py".format(vm_name)) + print("Try to use vm name({}) specified in testbed.py".format(vm_name)) if not vm_name: - exit("vm name is required") + raise Exception("vm name is required") print("vm name = {}".format(vm_name)) return server, username, password, cleardata, skip_verification, vm_name @@ -74,7 +74,7 @@ def process_cli_args(args): print("Using vcenter server specified in testbed.py") server = testbed.config['SERVER'] if not server: - exit("vcenter server is required") + raise Exception("vcenter server is required") print("vcenter server = {}".format(server)) if args.username: @@ -83,8 +83,8 @@ def process_cli_args(args): print("Using vc user specified in testbed.py") username = testbed.config['USERNAME'] if not username: - exit("vc user is required") - print("vc user = {}".format(username)) + raise Exception("vc username is required") + print("vc username = {}".format(username)) if args.password: password = args.password diff --git a/samples/vsphere/vcenter/setup/testbed_setup.py b/samples/vsphere/vcenter/setup/testbed_setup.py index 3a9843fb..f7c0ef01 100644 --- a/samples/vsphere/vcenter/setup/testbed_setup.py +++ b/samples/vsphere/vcenter/setup/testbed_setup.py @@ -32,19 +32,19 @@ Inputs: different folders looking for the entities. * Two Datacenters - * "Sample DC 1" - * "Sample DC 2" + * "Sample_DC_1" + * "Sample_DC_2" * One Cluster - * "Sample Cluster" + * "Sample_Cluster" * 2 host environment - * 1 host in Sample Cluster in Sample DC 1 + * 1 host in Sample Cluster in Sample_DC_1 * One network adapter per Host * Name of Host will be the IP address * 3 Datastores, any constraints? * Shared NFS Datastore - * "Shared NFS Volume" + * "Shared_NFS_Volume" * 2 Local VMFS Datastore (name the datastores based on the host) - * "Local VMFS Datastore on " + * "Local_VMFS_Datastore_on_" * 1 Standard Portgroups (verify) * "VM Network" (the default created per host) * 1 Distributed Switch ("DSwitch 1") diff --git a/samples/vsphere/vcenter/vm/hardware/adapter/sata.py b/samples/vsphere/vcenter/vm/hardware/adapter/sata.py index edf38e60..b3be2c67 100644 --- a/samples/vsphere/vcenter/vm/hardware/adapter/sata.py +++ b/samples/vsphere/vcenter/vm/hardware/adapter/sata.py @@ -54,8 +54,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for SATA Sample".format(vm_name, vm)) # Create SATA adapter stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/adapter/scsi.py b/samples/vsphere/vcenter/vm/hardware/adapter/scsi.py index 6c013381..2627c248 100644 --- a/samples/vsphere/vcenter/vm/hardware/adapter/scsi.py +++ b/samples/vsphere/vcenter/vm/hardware/adapter/scsi.py @@ -54,8 +54,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for SCSI Sample".format(vm_name, vm)) # Create SCSI adapter stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/boot.py b/samples/vsphere/vcenter/vm/hardware/boot.py index 0f9f415a..1b6ed990 100644 --- a/samples/vsphere/vcenter/vm/hardware/boot.py +++ b/samples/vsphere/vcenter/vm/hardware/boot.py @@ -55,8 +55,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Boot Sample".format(vm_name, vm)) # Create Boot stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/boot_device.py b/samples/vsphere/vcenter/vm/hardware/boot_device.py index e7dea1ed..ca4b26ff 100644 --- a/samples/vsphere/vcenter/vm/hardware/boot_device.py +++ b/samples/vsphere/vcenter/vm/hardware/boot_device.py @@ -61,8 +61,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for BootDevice Sample".format(vm_name, vm)) # Create BootDevice stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/cdrom.py b/samples/vsphere/vcenter/vm/hardware/cdrom.py index abface15..9d0ca7a1 100644 --- a/samples/vsphere/vcenter/vm/hardware/cdrom.py +++ b/samples/vsphere/vcenter/vm/hardware/cdrom.py @@ -63,8 +63,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for CD-ROM Sample".format(vm_name, vm)) iso_datastore_path = testbed.config['ISO_DATASTORE_PATH'] diff --git a/samples/vsphere/vcenter/vm/hardware/cpu.py b/samples/vsphere/vcenter/vm/hardware/cpu.py index d75e10b6..7fdc4a38 100644 --- a/samples/vsphere/vcenter/vm/hardware/cpu.py +++ b/samples/vsphere/vcenter/vm/hardware/cpu.py @@ -55,8 +55,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Cpu Sample".format(vm_name, vm)) # Create Cpu stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/disk.py b/samples/vsphere/vcenter/vm/hardware/disk.py index 113ad60c..d9889b6c 100644 --- a/samples/vsphere/vcenter/vm/hardware/disk.py +++ b/samples/vsphere/vcenter/vm/hardware/disk.py @@ -83,8 +83,8 @@ def setup(context=None): global datastore_mo, datacenter_mo, datastore_root_path vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Disk Sample".format(vm_name, vm)) # Get the datacenter and datastore managed objects to be able to create and diff --git a/samples/vsphere/vcenter/vm/hardware/ethernet.py b/samples/vsphere/vcenter/vm/hardware/ethernet.py index fa3dca54..f364cb24 100644 --- a/samples/vsphere/vcenter/vm/hardware/ethernet.py +++ b/samples/vsphere/vcenter/vm/hardware/ethernet.py @@ -58,8 +58,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Disk Sample".format(vm_name, vm)) # Get standard portgroup to use as backing for sample diff --git a/samples/vsphere/vcenter/vm/hardware/floppy.py b/samples/vsphere/vcenter/vm/hardware/floppy.py index aef0d4c1..ebf9c176 100644 --- a/samples/vsphere/vcenter/vm/hardware/floppy.py +++ b/samples/vsphere/vcenter/vm/hardware/floppy.py @@ -56,8 +56,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Floppy Sample".format(vm_name, vm)) img_datastore_path = testbed.config['FLOPPY_DATASTORE_PATH'] diff --git a/samples/vsphere/vcenter/vm/hardware/main.py b/samples/vsphere/vcenter/vm/hardware/main.py index a8971945..7e25393e 100644 --- a/samples/vsphere/vcenter/vm/hardware/main.py +++ b/samples/vsphere/vcenter/vm/hardware/main.py @@ -71,8 +71,8 @@ def validate(context): if not get_vm(context.stub_config, name): valid = False if not valid: - exit('==> Samples Setup validation failed: ' - 'Missing VMs required to run hardware samples') + raise Exception('==> Samples Setup validation failed: ' + 'Missing VMs required to run hardware samples') print('==> Samples Setup validated') diff --git a/samples/vsphere/vcenter/vm/hardware/memory.py b/samples/vsphere/vcenter/vm/hardware/memory.py index 9b5b22ee..97105c31 100644 --- a/samples/vsphere/vcenter/vm/hardware/memory.py +++ b/samples/vsphere/vcenter/vm/hardware/memory.py @@ -54,8 +54,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Memory Sample".format(vm_name, vm)) # Create Memory stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/parallel.py b/samples/vsphere/vcenter/vm/hardware/parallel.py index 5ebd4a27..a12f8efe 100644 --- a/samples/vsphere/vcenter/vm/hardware/parallel.py +++ b/samples/vsphere/vcenter/vm/hardware/parallel.py @@ -70,8 +70,8 @@ def run(): global vm, parallel_svc vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Parallel Sample".format(vm_name, vm)) # Create Parallel port stub used for making requests diff --git a/samples/vsphere/vcenter/vm/hardware/serial.py b/samples/vsphere/vcenter/vm/hardware/serial.py index d145eeed..514b1571 100644 --- a/samples/vsphere/vcenter/vm/hardware/serial.py +++ b/samples/vsphere/vcenter/vm/hardware/serial.py @@ -78,8 +78,8 @@ def run(): global vm, serial_svc vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}). ' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Serial Sample".format(vm_name, vm)) # Create Serial port stub used for making requests diff --git a/samples/vsphere/vcenter/vm/power.py b/samples/vsphere/vcenter/vm/power.py index 9ea7fee7..b63454f8 100644 --- a/samples/vsphere/vcenter/vm/power.py +++ b/samples/vsphere/vcenter/vm/power.py @@ -56,8 +56,8 @@ def run(): global vm vm = get_vm(stub_config, vm_name) if not vm: - exit('Sample requires an existing vm with name ({}). ' - 'Please create the vm first.'.format(vm_name)) + raise Exception('Sample requires an existing vm with name ({}).' + 'Please create the vm first.'.format(vm_name)) print("Using VM '{}' ({}) for Power Sample".format(vm_name, vm)) # Create Power stub used for making requests