本文整理汇总了Python中zstackwoodpecker.test_lib.lib_robot_cleanup函数的典型用法代码示例。如果您正苦于以下问题:Python lib_robot_cleanup函数的具体用法?Python lib_robot_cleanup怎么用?Python lib_robot_cleanup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lib_robot_cleanup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
def test():
global test_obj_dict
cond = res_ops.gen_query_conditions('state', '=', 'Enabled')
cond = res_ops.gen_query_conditions('type', '=', 'LocalStorage')
cond = res_ops.gen_query_conditions('status', '=', 'Connected', cond)
ps = res_ops.query_resource(res_ops.PRIMARY_STORAGE, cond)
if len(ps) < 2:
test_util.test_skip("Requres at least two local ps")
ps1_res = vol_ops.get_local_storage_capacity(None, ps[0].uuid)[0]
ps2_res = vol_ops.get_local_storage_capacity(None, ps[1].uuid)[0]
if ps1_res.availableCapacity > ps2_res.availableCapacity:
data_volume_size = ps2_res.availableCapacity + (ps1_res.availableCapacity - ps2_res.availableCapacity) / 2
else:
data_volume_size = ps1_res.availableCapacity + (ps2_res.availableCapacity - ps1_res.availableCapacity) / 2
disk_offering_option = test_util.DiskOfferingOption()
disk_offering_option.set_name('2-local-ps-test')
disk_offering_option.set_diskSize(data_volume_size)
data_volume_offering = vol_ops.create_volume_offering(disk_offering_option)
test_obj_dict.add_disk_offering(data_volume_offering)
vm = test_stub.create_vlan_vm(disk_offering_uuids=[data_volume_offering.uuid])
test_obj_dict.add_vm(vm)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('2 Local PS Test Pass')
return False
示例2: test
def test():
vm1 = test_stub.create_vm(vm_name = 'basic-test-vm')
test_obj_dict.add_vm(vm1)
vm1.check()
image_creation_option = test_util.ImageOption()
backup_storage_list = test_lib.lib_get_backup_storage_list_by_vm(vm1.vm)
for bs in backup_storage_list:
if bs.type == inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE:
image_creation_option.set_backup_storage_uuid_list([backup_storage_list[0].uuid])
break
else:
test_util.test_skip('Not find image store type backup storage.')
global default_snapshot_depth
default_snapshot_depth = conf_ops.change_global_config('volumeSnapshot', \
'incrementalSnapshot.maxNum', test_depth)
image_creation_option.set_root_volume_uuid(vm1.vm.rootVolumeUuid)
test_img_num = 1
while (test_img_num < 101):
image_creation_option.set_name('test_create_img_store_img_vm%d' % test_img_num)
#image_creation_option.set_platform('Linux')
image = test_image.ZstackTestImage()
image.set_creation_option(image_creation_option)
image.create()
image.check()
test_obj_dict.add_image(image)
test_img_num += 1
vm2 = test_stub.create_vm(image_name = 'test_create_img_store_img_vm100')
test_obj_dict.add_vm(vm2)
vm2.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Create 100 images Success')
示例3: test
def test():
imagestore_backup_storage = test_lib.lib_get_image_store_backup_storage()
if not imagestore_backup_storage:
test_util.test_skip('Not find image store type backup storage.')
img_option = test_util.ImageOption()
img_option.set_name('iso')
root_disk_uuid = test_lib.lib_get_disk_offering_by_name(os.environ.get('rootDiskOfferingName')).uuid
bs_uuid = imagestore_backup_storage.uuid
img_option.set_backup_storage_uuid_list([bs_uuid])
command = "command -v genisoimage"
result = test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
if not result:
command = "yum -y install genisoimage --disablerepo=* --enablerepo=zstack-local"
test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
command = "genisoimage -o %s/apache-tomcat/webapps/zstack/static/zstack-repo/7/x86_64/os/test.iso /tmp/" % os.environ.get('zstackInstallPath')
test_lib.lib_execute_ssh_cmd(os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'], 'root', 'password', command)
img_option.set_url('http://%s:8080/zstack/static/zstack-repo/7/x86_64/os/test.iso' % (os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP']))
image_inv = img_ops.add_iso_template(img_option)
image = test_image.ZstackTestImage()
image.set_image(image_inv)
image.set_creation_option(img_option)
test_obj_dict.add_image(image)
image_url = image.export()
image.delete_exported_image()
test_lib.lib_robot_cleanup(test_obj_dict)
if image_url.endswith('.iso'):
test_util.test_pass('Export ISO Image Test Success')
else:
test_util.test_fail('Export ISO Image Test Fail, exported ISO image ends with %s' % (image_url.split('.')[-1]))
示例4: test
def test():
data_migration.create_vm()
test_obj_dict.add_vm(data_migration.vm)
new_size = 5*1024*1024*1024
data_migration.resize_vm(new_size)
data_migration.vm.stop()
new_size2 = 6*1024*1024*1024
data_migration.resize_vm(new_size2)
data_migration.vm.start()
data_migration.vm.check()
data_migration.copy_data()
data_migration.migrate_vm()
data_migration.check_data()
data_migration.check_origin_data_exist()
data_migration.clean_up_ps_trash_and_check()
data_migration.vm.stop()
#delay start vm
data_migration.vm.start()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Create vm and resize vm Migrated VM from ceph to xsky Test Success')
示例5: test
def test():
#skip ceph in c74
cmd = "cat /etc/redhat-release | grep '7.4'"
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
rsp = test_lib.lib_execute_ssh_cmd(mn_ip, 'root', 'password', cmd, 180)
if rsp != False:
ps = res_ops.query_resource(res_ops.PRIMARY_STORAGE)
for i in ps:
if i.type == 'Ceph':
test_util.test_skip('cannot hotplug iso to the vm in ceph,it is a libvirt bug:https://bugzilla.redhat.com/show_bug.cgi?id=1541702.')
multi_iso.add_iso_image()
multi_iso.create_windows_vm()
test_obj_dict.add_vm(multi_iso.vm1)
multi_iso.get_all_iso_uuids()
multi_iso.attach_iso(multi_iso.iso_uuids[0])
multi_iso.attach_iso(multi_iso.iso_uuids[1])
multi_iso.attach_iso(multi_iso.iso_uuids[2])
multi_iso.check_windows_vm_cdrom(3)
multi_iso.detach_iso(multi_iso.iso_uuids[1])
multi_iso.check_windows_vm_cdrom(2)
# multi_iso.vm1.reboot()
multi_iso.detach_iso(multi_iso.iso_uuids[0])
multi_iso.check_windows_vm_cdrom(1)
multi_iso.detach_iso(multi_iso.iso_uuids[2])
multi_iso.check_windows_vm_cdrom(0)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Attach 3 ISO Test Success')
示例6: test
def test():
global volume_offering_uuid
test_util.test_dsc('Test VM data volume bandwidth QoS by 20MB')
#unit is KB
write_bandwidth = 5*1024*1024
new_volume_offering = test_lib.lib_create_disk_offering(write_bandwidth = write_bandwidth)
volume_offering_uuid = new_volume_offering.uuid
vm = test_stub.create_vm(vm_name='vm_volume_qos', disk_offering_uuids = [volume_offering_uuid])
vm.check()
test_obj_dict.add_vm(vm)
vm_inv = vm.get_vm()
cond = res_ops.gen_query_conditions("vmInstanceUuid", '=', vm_inv.uuid)
cond = res_ops.gen_query_conditions("type", '=', 'Data', cond)
volume_uuid = res_ops.query_resource(res_ops.VOLUME, cond)[0].uuid
test_lib.lib_mkfs_for_volume(volume_uuid, vm_inv)
path = '/mnt'
user_name = 'root'
user_password = 'password'
os.system("sshpass -p '%s' ssh %[email protected]%s 'mount /dev/vdb1 %s'"%(user_password, user_name, vm_inv.vmNics[0].ip, path))
vm.check()
test_stub.make_ssh_no_password(vm_inv)
test_stub.install_fio(vm_inv)
if vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid).volumeBandwidthRead != -1 and \
vm_ops.get_vm_disk_qos(test_lib.lib_get_data_volumes(vm_inv)[0].uuid).volumeBandwidthWrite != write_bandwidth:
test_util.test_fail('Retrieved disk qos not match')
test_stub.test_fio_bandwidth(vm_inv, write_bandwidth, path)
if test_stub.test_fio_bandwidth(vm_inv, write_bandwidth/2, '/dev/vdb', raise_exception=False):
test_util.test_fail('disk read qos is not expected to have limit as only write qos was set')
vol_ops.delete_disk_offering(volume_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM data volume write QoS Test Pass')
示例7: test
def test():
test_util.test_dsc('Create original vm')
vm = test_stub.create_vlan_vm()
test_obj_dict.add_vm(vm)
vm1 = test_stub.create_vlan_vm()
test_obj_dict.add_vm(vm1)
root_volume_uuid = test_lib.lib_get_root_volume_uuid(vm.get_vm())
test_util.test_dsc('Stop vm before create snapshot.')
vm.stop()
test_util.test_dsc('create snapshot and check')
snapshots = test_obj_dict.get_volume_snapshot(root_volume_uuid)
snapshots.set_utility_vm(vm1)
vm1.check()
snapshots.create_snapshot('create_root_snapshot1')
volume2 = snapshots.get_current_snapshot().create_data_volume('data_volume_for_root')
test_obj_dict.add_volume(volume2)
snapshots2 = test_obj_dict.get_volume_snapshot(volume2.get_volume().uuid)
snapshots2.set_utility_vm(vm1)
snapshots2.create_snapshot('create_root_snapshot2')
snapshots2.use_snapshot(snapshots2.get_current_snapshot())
snapshots2.backup_snapshot(snapshots2.get_current_snapshot())
snapshots2.delete_backuped_snapshot(snapshots2.get_current_snapshot())
volume2.attach(vm)
volume2.detach()
snapshots.delete_snapshot(snapshots.get_current_snapshot())
test_util.test_dsc('start vm')
vm.start()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Do snapshot ops on VM root volume with VM ops successfully')
示例8: test
def test():
global new_offering_uuid
test_util.test_dsc('Test change VM network bandwidth QoS by 1MB')
vm = test_stub.create_vm(vm_name = 'vm_net_qos')
l3_uuid = vm.get_vm().vmNics[0].l3NetworkUuid
test_obj_dict.add_vm(vm)
net_bandwidth = 512 * 1024
vm_nic = test_lib.lib_get_vm_nic_by_l3(vm.vm, l3_uuid)
vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth=net_bandwidth)
vm.check()
time.sleep(1)
test_stub.make_ssh_no_password(vm.get_vm())
test_stub.create_test_file(vm.get_vm(), net_bandwidth)
test_stub.test_scp_vm_outbound_speed(vm.get_vm(), net_bandwidth)
vm_ops.set_vm_nic_qos(vm_nic.uuid, outboundBandwidth=net_bandwidth/2)
vm.check()
time.sleep(1)
test_stub.make_ssh_no_password(vm.get_vm())
test_stub.create_test_file(vm.get_vm(), net_bandwidth/2)
test_stub.test_scp_vm_outbound_speed(vm.get_vm(), net_bandwidth/2)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network QoS change instance offering Test Pass')
示例9: test
def test():
test_util.test_dsc('''
Will doing random test Security Group operations, including SG create/delete, rule add/remove, vm nics attach/detach. If reach max 4 coexisting running vm, testing will success and quit. Volume actions and Image actions are removed in this robot test.
VM resources: Since SG testing will create target test vm, there might be max 12 running VMs: 4 VR VMs, 4 SG target test VMs and 4 test VMs.
''')
target_running_vm = 4
vm_create_option = test_util.VmOption()
test_util.test_dsc('Random Test Begin. Test target: 4 coexisting running VM (not include VR and SG target test VMs.).')
robot_test_obj = test_util.Robot_Test_Object()
robot_test_obj.set_test_dict(test_dict)
robot_test_obj.set_vm_creation_option(vm_create_option)
priority_actions = [test_state.TestAction.sg_rule_operations]*2
priority_action_obj = action_select.ActionPriority()
priority_action_obj.add_priority_action_list(priority_actions)
robot_test_obj.set_priority_actions(priority_action_obj)
robot_test_obj.set_exclusive_actions_list(\
test_state.TestAction.volume_actions \
+ test_state.TestAction.image_actions \
+ test_state.TestAction.vip_actions \
+ test_state.TestAction.sg_actions \
+ test_state.TestAction.snapshot_actions)
rounds = 1
while len(test_dict.get_vm_list(vm_header.RUNNING)) < target_running_vm:
test_util.test_dsc('New round %s starts: random operation pickup.' % rounds)
test_lib.lib_vm_random_operation(robot_test_obj)
test_util.test_dsc('===============Round %s finished. Begin status checking.================' % rounds)
rounds += 1
test_lib.lib_robot_status_check(test_dict)
test_util.test_dsc('Reach test pass exit criterial.')
test_lib.lib_robot_cleanup(test_dict)
test_util.test_pass('Create random VM Test Success')
示例10: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM disk bandwidth QoS by 20MB')
#unit is KB
volume_bandwidth = 25*1024*1024
new_offering = test_lib.lib_create_instance_offering(volume_bandwidth = volume_bandwidth)
new_offering_uuid = new_offering.uuid
vm = test_stub.create_vm(vm_name = 'vm_volume_qos', \
instance_offering_uuid = new_offering.uuid)
test_obj_dict.add_vm(vm)
vm.check()
volume_creation_option = test_util.VolumeOption()
disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('largeDiskOfferingName'))
volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
volume_creation_option.set_name('volume-1')
volume = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume)
vm_inv = vm.get_vm()
test_lib.lib_mkfs_for_volume(volume.get_volume().uuid, vm_inv)
mount_point = '/tmp/zstack/test'
test_stub.attach_mount_volume(volume, vm, mount_point)
test_stub.make_ssh_no_password(vm_inv)
test_stub.install_fio(vm_inv)
test_stub.test_fio_bandwidth(vm_inv, volume_bandwidth, mount_point)
vm_ops.delete_instance_offering(new_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Disk QoS Test Pass')
示例11: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM network outbound bandwidth QoS by 1MB')
#unit is KB
net_bandwidth = 1*1024
new_offering = test_lib.lib_create_instance_offering(net_outbound_bandwidth = net_bandwidth*8*1024)
new_offering_uuid = new_offering.uuid
vm = test_stub.create_vm(vm_name = 'vm_net_qos', \
instance_offering_uuid = new_offering.uuid)
test_obj_dict.add_vm(vm)
vm.check()
vm_inv = vm.get_vm()
test_stub.make_ssh_no_password(vm_inv)
test_stub.create_test_file(vm_inv, net_bandwidth)
test_stub.test_scp_vm_outbound_speed(vm_inv, net_bandwidth)
if test_stub.test_scp_vm_inbound_speed(vm_inv, net_bandwidth, raise_exception=False):
test_util.test_fail('VM network inbound is not expected to be limited when only outbound qos is set')
vm_ops.delete_instance_offering(new_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network Outbound QoS Test Pass')
示例12: test
def test():
global new_offering_uuid
test_util.test_dsc('Test VM network outbound & inbound bandwidth QoS by 1MB')
#unit is KB
net_bandwidth = 1*1024
new_offering = test_lib.lib_create_instance_offering(net_outbound_bandwidth = net_bandwidth*8*1024, \
net_inbound_bandwidth = net_bandwidth*8*1024)
new_offering_uuid = new_offering.uuid
vm = test_stub.create_vm(vm_name = 'vm_net_inbound_outbound_qos', \
instance_offering_uuid = new_offering.uuid)
test_obj_dict.add_vm(vm)
vm.check()
vm_inv = vm.get_vm()
test_stub.make_ssh_no_password(vm_inv)
test_stub.create_test_file(vm_inv, net_bandwidth)
test_stub.test_scp_vm_outbound_speed(vm_inv, net_bandwidth)
test_stub.test_scp_vm_inbound_speed(vm_inv, net_bandwidth)
vm_ops.delete_instance_offering(new_offering_uuid)
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM Network Outbound QoS Test Pass')
示例13: test
def test():
vm = test_stub.create_vm(vm_name = vn_prefix)
test_obj_dict.add_vm(vm)
backup_storage_list = test_lib.lib_get_backup_storage_list_by_vm(vm.vm)
for bs in backup_storage_list:
if bs.type in [inventory.IMAGE_STORE_BACKUP_STORAGE_TYPE, inventory.CEPH_BACKUP_STORAGE_TYPE]:
break
else:
vm.destroy()
test_util.test_skip('Not find image store or ceph type backup storage.')
vm1 = test_stub.create_vm(vm_name = vn_prefix)
test_obj_dict.add_vm(vm1)
vm_root_volume_inv = test_lib.lib_get_root_volume(vm.get_vm())
test_util.test_dsc('create snapshot and check')
snapshots = test_obj_dict.get_volume_snapshot(vm_root_volume_inv.uuid)
snapshots.set_utility_vm(vm1)
snapshots.create_snapshot('create_root_snapshot1')
snapshot1 = snapshots.get_current_snapshot()
snapshots.create_snapshot('create_root_snapshot2')
snapshots.delete_snapshot(snapshot1)
vm.reboot()
new_vm1 = vm.clone(vm_name1)[0]
test_obj_dict.add_vm(new_vm1)
vm.destroy()
new_vm1.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('Clone VM Test with snapshot operations Success')
示例14: test
def test():
test_util.test_dsc('Test VM online change instance offering')
image_name = os.environ.get('imageName_net')
image_uuid = test_lib.lib_get_image_by_name(image_name).uuid
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_net_list = [l3_net_uuid]
vm = test_stub.create_vm(l3_net_list, image_uuid, 'online_chg_offering_vm', system_tags=['instanceOfferingOnlinechange::true'])
test_obj_dict.add_vm(vm)
vm.check()
cpuNum = 1
cpuSpeed = 222
memorySize = 666 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
cpuSpeed = cpuSpeed, memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
test_lib.lib_execute_command_in_vm(vm.get_vm(), 'ls -d /sys/devices/system/cpu/cpu*')
test_lib.lib_execute_command_in_vm(vm.get_vm(), 'ls -d /sys/devices/system/memory/memory*')
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')
示例15: test
def test():
test_util.test_dsc('Test VM online change instance offering')
cpuNum = 1
memorySize = 555 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
vm = test_stub.create_vm(vm_name = 'ckvmoffering-c7-64', image_name = "imageName_i_c7", instance_offering_uuid=new_offering.uuid)
vm.check()
test_obj_dict.add_vm(vm)
test_obj_dict.add_instance_offering(new_offering)
cpuNum = 1
memorySize = 667 * 1024 * 1024
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum,\
memorySize = memorySize)
test_obj_dict.add_instance_offering(new_offering)
new_offering_uuid = new_offering.uuid
vm.change_instance_offering(new_offering_uuid)
vm.check()
test_lib.lib_robot_cleanup(test_obj_dict)
test_util.test_pass('VM online change instance offering Test Pass')