本文整理汇总了Python中zstackwoodpecker.operations.primarystorage_operations.change_primary_storage_state函数的典型用法代码示例。如果您正苦于以下问题:Python change_primary_storage_state函数的具体用法?Python change_primary_storage_state怎么用?Python change_primary_storage_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了change_primary_storage_state函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'disable')
if not test_lib.lib_wait_target_up(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to running when PS change to disable state')
vm.set_state(vm_header.RUNNING)
vm.check()
vm.destroy()
vm.check()
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
vm_ops.reconnect_vr(vr_uuid)
test_util.test_pass('PS disable mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_disable_ps_del_vm.py
示例2: test
def test():
ps_env = test_stub.PSEnvChecker()
nfs_ps = ps_env.get_random_nfs()
test_util.test_dsc("Create 1 vm with {} data volume".format(VOLUME_NUMBER))
vm = test_stub.create_multi_vms(name_prefix='test-', count=1, data_volume_number=VOLUME_NUMBER)[0]
test_obj_dict.add_vm(vm)
test_util.test_dsc("disable NFS PS")
ps_ops.change_primary_storage_state(nfs_ps.uuid, state='disable')
disabled_ps_list.append(nfs_ps)
test_util.test_dsc("make sure VM till OK and running")
vm.update()
vm.check()
assert vm.get_vm().state == inventory.RUNNING
with test_stub.expected_failure("Create datavol in nfs-local env when nfs disabled", Exception):
test_stub.create_multi_volumes(count=1, ps=nfs_ps)
test_util.test_dsc("Try to create vm")
new_vm = test_stub.create_multi_vms(name_prefix='test-vm', count=1)[0]
test_obj_dict.add_vm(new_vm)
test_util.test_pass('Multi PrimaryStorage Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:26,代码来源:test_nfs_local_disable_nfs.py
示例3: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
#l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
#vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
#vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'maintain')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to maintain state')
vm.set_state(vm_header.STOPPED)
vm.check()
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
#vm_ops.reconnect_vr(vr_uuid)
vrs = test_lib.lib_get_all_vrs()
for vr in vrs:
vm_ops.start_vm(vr.uuid)
vm.start()
vm.check()
vm.destroy()
test_util.test_pass('PS maintain mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:35,代码来源:test_maintain_ps.py
示例4: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
#l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
#vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
#vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
test_util.test_dsc('Add ISO Image')
cond = res_ops.gen_query_conditions("status", '=', "Connected")
bs_uuid = res_ops.query_resource(res_ops.BACKUP_STORAGE, cond)[0].uuid
img_option = test_util.ImageOption()
img_option.set_name('iso')
img_option.set_backup_storage_uuid_list([bs_uuid])
os.system("echo fake iso for test only > %s/apache-tomcat/webapps/zstack/static/test.iso" % (os.environ.get('zstackInstallPath')))
img_option.set_url('http://%s:8080/zstack/static/test.iso' % (os.environ.get('node1Ip')))
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)
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'maintain')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to maintain state')
vm.set_state(vm_header.STOPPED)
vm.check()
test_util.test_dsc('Attach ISO to VM')
cond = res_ops.gen_query_conditions('name', '=', 'iso')
iso_uuid = res_ops.query_resource(res_ops.IMAGE, cond)[0].uuid
img_ops.attach_iso(iso_uuid, vm.vm.uuid)
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
#vm_ops.reconnect_vr(vr_uuid)
vrs = test_lib.lib_get_all_vrs()
for vr in vrs:
vm_ops.start_vm(vr.uuid)
vm.start()
vm.check()
vm.destroy()
vm.check()
#vm.expunge()
#vm.check()
test_util.test_pass('PS maintain mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_maintain_ps_attach_iso.py
示例5: env_recover
def env_recover():
global ps_uuid
if ps_uuid != None:
try:
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
except:
pass
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:7,代码来源:test_ls_vm_ha_ps_maintain_recover_vm_self_start.py
示例6: env_recover
def env_recover():
local_ps, shared_ps = test_stub.PSEnvChecker().get_two_ps()
if local_ps.state == 'Disabled':
ps_ops.change_primary_storage_state(local_ps.uuid, state='enable')
if shared_ps.state == 'Disabled':
ps_ops.change_primary_storage_state(shared_ps.uuid, state='enable')
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:7,代码来源:test_local_shared_default.py
示例7: env_recover
def env_recover():
test_lib.lib_error_cleanup(test_obj_dict)
for disabled_ps in disabled_ps_list:
ps_ops.change_primary_storage_state(disabled_ps.uuid, state='enable')
if new_ps_list:
for new_ps in new_ps_list:
ps_ops.detach_primary_storage(new_ps.uuid, new_ps.attachedClusterUuids[0])
ps_ops.delete_primary_storage(new_ps.uuid)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_two_ps_disabled.py
示例8: test
def test():
ps_env = test_stub.PSEnvChecker()
if ps_env.is_sb_ceph_env:
env = test_stub.SanAndCephPrimaryStorageEnv(test_object_dict=test_obj_dict,
first_ps_vm_number=VM_COUNT,
second_ps_vm_number=VM_COUNT,
first_ps_volume_number=VOLUME_NUMBER,
second_ps_volume_number=VOLUME_NUMBER)
else:
env = test_stub.TwoPrimaryStorageEnv(test_object_dict=test_obj_dict,
first_ps_vm_number=VM_COUNT,
second_ps_vm_number=VM_COUNT,
first_ps_volume_number=VOLUME_NUMBER,
second_ps_volume_number=VOLUME_NUMBER)
env.check_env()
env.deploy_env()
first_ps_vm_list = env.first_ps_vm_list
first_ps_volume_list = env.first_ps_volume_list
second_ps_vm_list = env.second_ps_vm_list
second_ps_volume_list = env.second_ps_volume_list
if env.new_ps:
new_ps_list.append(env.second_ps)
tbj_list = first_ps_vm_list + second_ps_vm_list + first_ps_volume_list + second_ps_volume_list
test_util.test_dsc('Disable All Primary Storage')
for ps in [env.first_ps, env.second_ps]:
ps_ops.change_primary_storage_state(ps.uuid, state='disable')
disabled_ps_list.append(ps)
test_util.test_dsc('make sure all VM and Volumes still OK and running')
for test_object in tbj_list:
test_object.check()
test_util.test_dsc("Try to Create one vm")
with test_stub.expected_failure("Create vm when no ps in enable status", Exception):
test_stub.create_multi_vms(name_prefix='test-vm', count=1)
test_util.test_dsc("Try to Create one volume")
with test_stub.expected_failure("Create volume when no ps in enable status", Exception):
test_stub.create_multi_volumes(count=1, ps=random.choice([env.first_ps, env.second_ps]))
test_util.test_dsc("enable All primaryStorage")
for ps in [env.first_ps, env.second_ps]:
ps_ops.change_primary_storage_state(ps.uuid, state='enable')
disabled_ps_list.remove(ps)
test_util.test_dsc("Try to create vm in both PrimaryStorage")
if ps_env.is_sb_ceph_env:
vm1 = test_stub.create_multi_vms(name_prefix='test-vm_first_ps', count=1, ps_uuid=env.first_ps.uuid, bs_type='ImageStoreBackupStorage')[0]
vm2 = test_stub.create_multi_vms(name_prefix='test-vm_second_ps', count=1, ps_uuid=env.second_ps.uuid, bs_type='Ceph')[0]
else:
vm1 = test_stub.create_multi_vms(name_prefix='test-vm_first_ps', count=1, ps_uuid=env.first_ps.uuid)[0]
vm2 = test_stub.create_multi_vms(name_prefix='test-vm_second_ps', count=1, ps_uuid=env.second_ps.uuid)[0]
test_obj_dict.add_vm(vm1)
test_obj_dict.add_vm(vm2)
test_util.test_pass('Multi PrimaryStorage Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:58,代码来源:test_two_ps_disabled.py
示例9: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
test_lib.lib_set_delete_policy('vm', 'Delay')
test_lib.lib_set_delete_policy('volume', 'Delay')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
#l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
#vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
#vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('rootDiskOfferingName'))
volume_creation_option = test_util.VolumeOption()
volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
volume_creation_option.set_system_tags(['ephemeral::shareable', 'capability::virtio-scsi'])
volume = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume)
volume.check()
volume.delete()
volume.check()
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'maintain')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to maintain state')
vm.set_state(vm_header.STOPPED)
vm.check()
volume.recover()
volume.check()
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
#vm_ops.reconnect_vr(vr_uuid)
vrs = test_lib.lib_get_all_vrs()
for vr in vrs:
vm_ops.start_vm(vr.uuid)
vm.start()
vm.check()
volume.delete()
#volume.expunge()
volume.check()
vm.destroy()
test_lib.lib_set_delete_policy('vm', 'Direct')
test_lib.lib_set_delete_policy('volume', 'Direct')
test_util.test_pass('Delete volume under PS maintain mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:58,代码来源:test_maintain_ps_recover_share_vol.py
示例10: test
def test():
global vm
global test_host
global ps_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.LOCAL_STORAGE_TYPE]
test_lib.skip_test_when_ps_type_not_in_list(allow_ps_list)
if test_lib.lib_get_ha_enable() != 'true':
test_util.test_skip("vm ha not enabled. Skip test")
vm_creation_option = test_util.VmOption()
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
test_lib.clean_up_all_vr()
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
vm_creation_option.set_l3_uuids([l3_net_uuid])
vm_creation_option.set_image_uuid(image_uuid)
vm_creation_option.set_instance_offering_uuid(instance_offering_uuid)
vm_creation_option.set_name('ls_vm_ha_self_start')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'maintain')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to maintain state')
vm.set_state(vm_header.STOPPED)
vm.check()
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
for i in range(0, 300):
if res_ops.query_resource(res_ops.VM_INSTANCE, conditions)[0].state == "Running":
break
time.sleep(1)
else:
test_util.test_fail("vm has not been changed to running as expected within 300s.")
vm.destroy()
test_util.test_pass('Test checking VM ha and none status when force stop vm Success.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:56,代码来源:test_ls_vm_ha_ps_maintain_recover_vm_self_start.py
示例11: env_recover
def env_recover():
local_ps, shared_ps = test_stub.PSEnvChecker().get_two_ps()
if local_ps.state in ('Disabled', "Maintenance"):
ps_ops.change_primary_storage_state(local_ps.uuid, state='enable')
if shared_ps.state in ('Disabled', "Maintenance"):
ps_ops.change_primary_storage_state(shared_ps.uuid, state='enable')
for vr in res_ops.get_resource(res_ops.APPLIANCE_VM):
if vr.state != inventory.RUNNING:
vm_ops.start_vm(vr.uuid)
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:10,代码来源:test_local_shared_ps_ops.py
示例12: error_cleanup
def error_cleanup():
global ps_uuid
if ps_uuid != None:
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
global host_uuid
if host_uuid != None:
host_ops.reconnect_host(host_uuid)
global vr_uuid
if vr_uuid != None:
vm_ops.reconnect_vr(vr_uuid)
global test_obj_dict
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:12,代码来源:test_disable_ps_detach_iso.py
示例13: error_cleanup
def error_cleanup():
global ps_uuid
test_lib.lib_set_delete_policy('vm', 'Direct')
test_lib.lib_set_delete_policy('volume', 'Direct')
if ps_uuid != None:
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
global host_uuid
if host_uuid != None:
host_ops.reconnect_host(host_uuid)
global vr_uuid
if vr_uuid != None:
vm_ops.reconnect_vr(vr_uuid)
global test_obj_dict
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:14,代码来源:test_disable_ps_expunge_vol.py
示例14: error_cleanup
def error_cleanup():
global ps_uuid
if ps_uuid != None:
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
global host_uuid
if host_uuid != None:
host_ops.reconnect_host(host_uuid)
vrs = test_lib.lib_get_all_vrs()
for vr in vrs:
vm_ops.start_vm(vr.uuid)
#global vr_uuid
#if vr_uuid != None:
# vm_ops.reconnect_vr(vr_uuid)
global test_obj_dict
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:15,代码来源:test_maintain_ps_attach_iso.py
示例15: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
l3_1_name = os.environ.get('l3VlanNetworkName1')
vm = test_stub.create_vlan_vm(l3_name=l3_1_name)
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
vr_uuid = vr.uuid
#l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('rootDiskOfferingName'))
volume_creation_option = test_util.VolumeOption()
volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
#volume_creation_option.set_system_tags(['ephemeral::shareable', 'capability::virtio-scsi'])
volume = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume)
volume.check()
volume.attach(vm)
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'disable')
if not test_lib.lib_wait_target_up(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to running when PS change to disable state')
vm.set_state(vm_header.RUNNING)
vm.check()
volume.detach(vm.get_vm().uuid)
ps_ops.change_primary_storage_state(ps_uuid, 'enable')
host_ops.reconnect_host(host_uuid)
vm_ops.reconnect_vr(vr_uuid)
volume.delete()
#volume.expunge()
volume.check()
vm.destroy()
test_util.test_pass('Delete volume under PS disable mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:47,代码来源:test_disable_ps_detach_vol.py
示例16: test
def test():
global vm
ova_image_name = 'centos-dhcp'
network_pattern1 = os.environ['vcenterDefaultNetwork']
cpuNum = 2
memorySize = 2*1024*1024*1024
cond = res_ops.gen_query_conditions('type', '!=', 'Vcenter')
ps = res_ops.query_resource(res_ops.PRIMARY_STORAGE, cond)
for i in ps:
if (i.type == 'Ceph') or (i.type == 'Sharedblock'):
break
else:
test_util.test_skip('Skip test on non ceph or sharedblock PS')
ps_uuid = ps[0].uuid
cond = res_ops.gen_query_conditions('primaryStorage.uuid', '=', ps_uuid)
cluster_uuid = res_ops.query_resource(res_ops.CLUSTER, cond)[0].uuid
cond = res_ops.gen_query_conditions('clusterUuid', '=', cluster_uuid)
host = res_ops.query_resource(res_ops.HOST, cond)[0]
new_offering = test_lib.lib_create_instance_offering(cpuNum = cpuNum, memorySize = memorySize)
vm = test_stub.create_vm_in_vcenter(vm_name = 'v2v-test', image_name = ova_image_name, l3_name = network_pattern1, instance_offering_uuid = new_offering.uuid)
vm.check()
disk_offering = test_lib.lib_get_disk_offering_by_name(os.environ.get('smallDiskOfferingName'))
volume_creation_option = test_util.VolumeOption()
volume_creation_option.set_disk_offering_uuid(disk_offering.uuid)
volume_creation_option.set_name('vcenter_volume')
volume = test_stub.create_volume(volume_creation_option)
test_obj_dict.add_volume(volume)
volume.check()
volume.attach(vm)
l3_name = os.environ.get('l3VlanNetworkName1')
l3_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
v2v_conversion_host = test_stub.add_v2v_conversion_host('v2v_host', host.uuid, '/tmp/zstack', 'VMWARE')
url = 'vmware://%s' % vm.vm.uuid
migrate_task = test_stub.convert_vm_from_foreign_hypervisor('test', url, cpuNum, memorySize, ps_uuid, [l3_uuid], cluster_uuid, v2v_conversion_host.uuid)
time.sleep(10)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
ps_ops.change_primary_storage_state(ps_uuid, state='disable')
rerunLongJob(migrate_task.uuid, ps_uuid, 1, 0)
#cleanup
test_lib.lib_error_cleanup(test_obj_dict)
test_util.test_pass("Rerun v2v long job test passed.")
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:45,代码来源:test_rerun_job.py
示例17: test
def test():
global test_obj_dict
global ps_uuid
global host_uuid
global vr_uuid
test_util.test_dsc('Create test vm and check')
vm = test_stub.create_vr_vm('vm1', 'imageName_net', 'l3VlanNetwork3')
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 == inventory.CEPH_BACKUP_STORAGE_TYPE:
break
else:
vm.destroy()
test_util.test_skip('Not find ceph type backup storage.')
l3_1_name = os.environ.get('l3VlanNetwork3')
l3_1 = test_lib.lib_get_l3_by_name(l3_1_name)
vr = test_lib.lib_find_vr_by_l3_uuid(l3_1.uuid)[0]
vr_uuid = vr.uuid
host = test_lib.lib_get_vm_host(vm.get_vm())
host_uuid = host.uuid
test_obj_dict.add_vm(vm)
vm.check()
ps = test_lib.lib_get_primary_storage_by_vm(vm.get_vm())
ps_uuid = ps.uuid
ps_ops.change_primary_storage_state(ps_uuid, 'disable')
if not test_lib.lib_wait_target_down(vm.get_vm().vmNics[0].ip, '22', 90):
test_util.test_fail('VM is expected to stop when PS change to disable state')
vm.set_state(vm_header.STOPPED)
vm.check()
test_stub.migrate_vm_to_random_host(vm)
vm.check()
volume.check()
ps_ops.change_primary_storage_state(ps_uuid, 'Enabled')
host_ops.reconnect_host(host_uuid)
vm_ops.reconnect_vr(vr_uuid)
test_util.test_pass('PS disable mode Test Success')
开发者ID:mrwangxc,项目名称:zstack-woodpecker,代码行数:43,代码来源:test_disable_ps_live_migrate.py
示例18: rerunLongJob
def rerunLongJob(job_uuid, ps_uuid, max_retry_times=1, executed_times=0):
if executed_times != 0:
ps_ops.change_primary_storage_state(ps_uuid, state='enable')
rerun_job = longjob_ops.rerun_longjob(job_uuid)
for i in range(30):
cond = res_ops.gen_query_conditions('uuid', '=', job_uuid)
long_job = res_ops.query_resource(res_ops.LONGJOB, cond)[0]
if long_job.state == 'Failed':
executed_times += 1
if executed_times > max_retry_times:
test_util.test_fail("Long job failed to rerun")
else:
rerunLongJob(job_uuid, ps_uuid, max_retry_times, executed_times)
# elif long_job.state == 'Running':
# time.sleep(60)
elif long_job.state == 'Succeeded':
test_util.test_fail('v2v long job did not fail after disable ps.')
else:
time.sleep(60)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:20,代码来源:test_rerun_job.py
示例19: test
def test():
ps_env = test_stub.PSEnvChecker()
local_ps = ps_env.get_random_local()
nfs_ps = ps_env.get_random_nfs()
test_util.test_dsc("Create {0} vm ".format(VM_COUNT))
vm = test_stub.create_multi_vms(name_prefix='test-', count=VM_COUNT)[0]
vm.check()
test_obj_dict.add_vm(vm)
test_util.test_dsc("Create {0} volumes in NFS".format(VOLUME_NUMBER))
volume_in_nfs = test_stub.create_multi_volumes(count=VOLUME_NUMBER, ps=nfs_ps)
for volume in volume_in_nfs:
test_obj_dict.add_volume(volume)
volume.check()
test_util.test_dsc("Attach all volumes to VM")
for volume in volume_in_nfs:
volume.attach(vm)
volume.check()
test_util.test_dsc("disable local PS")
ps_ops.change_primary_storage_state(local_ps.uuid, state='disable')
disabled_ps_list.append(local_ps)
test_util.test_dsc("make sure all VM and Volumes still OK and running")
vm.check()
for volume in volume_in_nfs:
volume.check()
test_util.test_dsc("Try to create vm with datavolume")
with test_stub.expected_failure('Create vm with datavol in nfs-local env when local disabled', Exception):
test_stub.create_multi_vms(name_prefix='test-vm', count=1, datavolume=10)
test_util.test_dsc("Try to create datavolume in NFS")
volume = test_stub.create_multi_volumes(count=1, ps=nfs_ps)[0]
test_obj_dict.add_volume(volume)
test_util.test_pass('Multi PrimaryStorage Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:40,代码来源:test_nfs_local_disable_local.py
示例20: test
def test():
flavor = case_flavor[os.environ.get('CASE_FLAVOR')]
ps_env = test_stub.PSEnvChecker()
local_ps, shared_ps = ps_env.get_two_ps()
if flavor['local_enable'] == False:
ps_ops.change_primary_storage_state(local_ps.uuid, state='disable')
if flavor['shared_enable'] == False:
ps_ops.change_primary_storage_state(shared_ps.uuid, state='disable')
test_util.test_dsc("Try to Create VM without specified ps")
if flavor['local_enable']:
vm_list = test_stub.create_multi_vms(name_prefix='test-vm', count=2)
for vm in vm_list:
test_obj_dict.add_vm(vm)
assert test_lib.lib_get_root_volume(vm.get_vm()).primaryStorageUuid == local_ps.uuid
else:
with test_lib.expected_failure('Create vm when no ps enabled', Exception):
test_stub.create_multi_vms(name_prefix='test-vm', count=2)
test_util.test_dsc("Create VM with Volume without specified ps")
if flavor['local_enable'] and flavor['shared_enable']:
vm_list = test_stub.create_multi_vms(name_prefix='test-vm', count=2, data_volume_number=1)
for vm in vm_list:
test_obj_dict.add_vm(vm)
assert test_lib.lib_get_root_volume(vm.get_vm()).primaryStorageUuid == local_ps.uuid
for data_vol in [volume for volume in vm.get_vm().allVolumes if volume.type != 'Root']:
assert data_vol.primaryStorageUuid == shared_ps.uuid
else:
with test_lib.expected_failure('Create vm with volume when no ps enabled', Exception):
test_stub.create_multi_vms(name_prefix='test-vm', count=2, data_volume_number=1)
if flavor['local_enable'] == False:
ps_ops.change_primary_storage_state(local_ps.uuid, state='enable')
if flavor['shared_enable'] == False:
ps_ops.change_primary_storage_state(shared_ps.uuid, state='enable')
test_lib.lib_error_cleanup(test_obj_dict)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:40,代码来源:test_local_shared_default.py
注:本文中的zstackwoodpecker.operations.primarystorage_operations.change_primary_storage_state函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论