本文整理汇总了Python中zstackwoodpecker.test_lib.clean_up_all_vr函数的典型用法代码示例。如果您正苦于以下问题:Python clean_up_all_vr函数的具体用法?Python clean_up_all_vr怎么用?Python clean_up_all_vr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clean_up_all_vr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.NFS_PRIMARY_STORAGE_TYPE]
test_lib.skip_test_when_ps_type_not_in_list(allow_ps_list)
test_stub.skip_if_not_storage_network_separate(test_lib.all_scenario_config)
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()
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vr_hosts = test_stub.get_host_has_vr()
mn_hosts = test_stub.get_host_has_mn()
nfs_hosts = test_stub.get_host_has_nfs()
if not test_stub.ensure_vm_not_on(vm.get_vm().uuid, vm.get_vm().hostUuid, vr_hosts+mn_hosts+nfs_hosts):
test_util.test_fail("Not find out a suitable host")
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
#test_stub.down_host_network(host_ip, test_lib.all_scenario_config)
host_username = os.environ.get('hostUsername')
host_password = os.environ.get('hostPassword')
t = test_stub.async_exec_ifconfig_nic_down_up(1200, host_ip, host_username, host_password, "zsn1")
vm.destroy()
test_util.test_pass('Test VM ha change to running within 300s Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:58,代码来源:test_stor_sep_nfs_vm_ha_nfs_dis_destroy_vm.py
示例2: 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
示例3: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
must_ps_list = ['MiniStorage']
test_lib.skip_test_if_any_ps_not_deployed(must_ps_list)
test_stub.skip_if_not_storage_network_separate(test_lib.all_scenario_config)
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("ttylinux").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()
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
#conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
test_stub.down_host_network(host_ip, test_lib.all_scenario_config, "managment_net")
if test_stub.check_vm_running_on_host(vm.vm.uuid, host_ip):
test_util.test_fail("VM is expected to start running on another host")
vm.set_state(vm_header.RUNNING)
vm.check()
vm.destroy()
test_stub.up_host_network(host_ip, test_lib.all_scenario_config, "managment_net")
test_util.test_pass('Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:55,代码来源:test_minips_net_sep_vm_ha_mag_dis_vm_run.py
示例4: test
def test():
global vm, vm2
test_stub.skip_if_scenario_is_multiple_networks(mul_nets_sce_list=["scenario-config-ceph-sep-man.xml", "scenario-config-ceph-sep-pub.xml"])
test_stub.skip_if_vr_not_vyos("vr")
test_lib.clean_up_all_vr()
vm = test_stub.create_basic_vm()
vm.check()
vr_vm = test_lib.lib_find_vr_by_vm(vm.vm)[0]
vm.destroy()
t = threading.Thread(target=async_exec_reboot_vr, args=(vr_vm.uuid,))
t.start()
vm2 = test_stub.create_basic_vm(wait_vr_running=False)
vm2.check()
vm2.destroy()
test_util.test_pass('Create VM when vyos is rebooting Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:19,代码来源:test_vyos_rebooting_create_vm.py
示例5: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
must_ps_list = [inventory.NFS_PRIMARY_STORAGE_TYPE]
test_lib.skip_test_if_any_ps_not_deployed(must_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('l3NoVlanNetworkName1')
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vr_hosts = test_stub.get_host_has_vr()
mn_hosts = test_stub.get_host_has_mn()
nfs_hosts = test_stub.get_host_has_nfs()
if not test_stub.ensure_vm_not_on(vm.get_vm().uuid, vm.get_vm().hostUuid, vr_hosts+mn_hosts+nfs_hosts):
test_util.test_fail("Not find out a suitable host")
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
# l2_network_interface = os.environ.get('l2ManagementNetworkInterface')
#l2interface = test_lib.lib_get_l2s_by_vm(vm.get_vm())[0].physicalInterface
l2_network_interface = test_stub.get_host_l2_nic_name("br_eth0")
cmd = "ifconfig %s down && sleep 300 && ifconfig %s up" % (l2_network_interface, l2_network_interface)
host_username = os.environ.get('hostUsername')
host_password = os.environ.get('hostPassword')
rsp = test_lib.lib_execute_ssh_cmd(host_ip, host_username, host_password, cmd, 240)
if not rsp:
test_util.test_logger("host is expected to shutdown after its network down for a while")
#test_util.test_logger("wait for 600 seconds")
test_util.test_logger("wait for 300 seconds")
time.sleep(300)
vm.update()
if test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp == host_ip:
test_util.test_fail("VM is expected to start running on another host")
vm.set_state(vm_header.RUNNING)
vm.check()
vm.destroy()
cmd = 'PORT=%s bash -ex %s %s' % (host_port, os.environ.get('hostRecoverScript'), host_ip)
test_util.test_logger(cmd)
os.system(cmd)
host_ops.reconnect_host(host_uuid)
test_util.test_pass('Test VM ha on host failure Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:83,代码来源:test_2nfs_vm_ha_never_stop.py
示例6: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.CEPH_PRIMARY_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")
set_quick_ha_properties()
set_quick_ha_params()
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
# time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
test_stub.ensure_host_has_no_vr(host_uuid)
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
test_stub.down_host_network(host_ip, test_lib.all_scenario_config)
#test_util.test_logger("wait for 180 seconds")
#time.sleep(180)
vm_stop_time = None
cond = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
for i in range(0, max_time):
vm_stop_time = i
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Unknown":
test_stub.up_host_network(host_ip, test_lib.all_scenario_config)
break
time.sleep(1)
if vm_stop_time is None:
vm_stop_time = max_time
for i in range(vm_stop_time, max_time):
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Running":
break
time.sleep(1)
else:
test_util.test_fail("vm has not been changed to running as expected within %s s." %(max_time))
vm.destroy()
test_util.test_pass('Test VM ha change to running within 120s Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:82,代码来源:test_min_ha_param_vm_ha_net_dis.py
示例7: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
must_ps_list = [inventory.NFS_PRIMARY_STORAGE_TYPE]
test_lib.skip_test_if_any_ps_not_deployed(must_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('l3NoVlanNetworkName1')
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vr_hosts = test_stub.get_host_has_vr()
mn_hosts = test_stub.get_host_has_mn()
nfs_hosts = test_stub.get_host_has_nfs()
if not test_stub.ensure_vm_not_on(vm.get_vm().uuid, vm.get_vm().hostUuid, vr_hosts+mn_hosts+nfs_hosts):
test_util.test_fail("Not find out a suitable host")
host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
test_stub.ensure_all_vrs_on_host(host_uuid)
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#target_host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
#for vr in vrs:
# if test_lib.lib_find_host_by_vr(vr).managementIp != test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp:
# vm_ops.migrate_vm(vr.uuid, target_host_uuid)
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
test_util.test_logger("force stop host: %s" % (host_ip))
os.system('bash -ex %s %s' % (os.environ.get('hostForceStopScript'), host_ip))
test_util.test_logger("host is expected to shutdown for a while")
test_util.test_logger("wait for 300 seconds")
time.sleep(300)
vm.update()
if test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp == host_ip:
test_util.test_fail("VM is expected to start running on another host")
vm.set_state(vm_header.RUNNING)
vm.check()
if test_lib.lib_get_vm_last_host(vm.get_vm()).managementIp != host_ip:
test_util.test_fail("Migrated VM's last host is expected to be the last host[ip:%s]" % (host_ip))
vm.destroy()
os.system('bash -ex %s %s' % (os.environ.get('hostRecoverScript'), host_ip))
host_ops.reconnect_host(host_uuid)
test_util.test_pass('Test VM ha on host failure Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:85,代码来源:test_2nfs_vr_vm_ha_last_host.py
示例8: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.NFS_PRIMARY_STORAGE_TYPE]
test_lib.skip_test_when_ps_type_not_in_list(allow_ps_list)
test_stub.skip_if_not_storage_network_separate(test_lib.all_scenario_config)
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()
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vm.check()
vr_hosts = test_stub.get_host_has_vr()
mn_hosts = test_stub.get_host_has_mn()
nfs_hosts = test_stub.get_host_has_nfs()
if not test_stub.ensure_vm_not_on(vm.get_vm().uuid, vm.get_vm().hostUuid, vr_hosts+mn_hosts+nfs_hosts):
test_util.test_fail("Not find out a suitable host")
host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
test_stub.ensure_all_vrs_on_host(host_uuid)
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
host_list = test_stub.get_sce_hosts(test_lib.all_scenario_config, test_lib.scenario_file)
for host in host_list:
if host.ip_ == host_ip:
test_host = host
break
if not test_host:
test_util.test_fail('there is no host with ip %s in scenario file.' %(host_ip))
test_stub.stop_host(test_host, test_lib.all_scenario_config)
test_stub.check_if_vm_starting_incorrectly_on_original_host(vm.get_vm().uuid, host_uuid, max_count=300)
test_stub.start_host(test_host, test_lib.all_scenario_config)
test_stub.recover_host_vlan(test_host, test_lib.all_scenario_config, test_lib.deploy_config)
conditions = res_ops.gen_query_conditions('managementIp', '=', host_ip)
kvm_host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
host_ops.reconnect_host(kvm_host_uuid)
vm.set_state(vm_header.RUNNING)
vm.check()
vm.update()
if test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp == host_ip:
test_util.test_fail("VM is expected to start running on another host")
vm.destroy()
test_util.test_pass('Test checking vm status after graceful stop and start success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:80,代码来源:test_stor_sep_nfs_vr_vm_ha_grace_stop_start_host.py
示例9: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.CEPH_PRIMARY_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")
set_quick_ha_properties()
set_quick_ha_params()
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
# time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vm.check()
test_stub.ensure_host_has_no_vr(host_uuid)
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
host_list = test_stub.get_sce_hosts(test_lib.all_scenario_config, test_lib.scenario_file)
for host in host_list:
if host.ip_ == host_ip:
test_host = host
break
if not test_host:
test_util.test_fail('there is no host with ip %s in scenario file.' %(host_ip))
test_stub.stop_host(test_host, test_lib.all_scenario_config)
test_util.test_logger("wait for 120 seconds")
time.sleep(120)
test_stub.start_host(test_host, test_lib.all_scenario_config)
test_stub.recover_host_vlan(test_host, test_lib.all_scenario_config, test_lib.deploy_config)
vm.set_state(vm_header.RUNNING)
vm.check()
vm.update()
if test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp == host_ip:
test_util.test_fail("VM is expected to start running on another host")
vm.destroy()
test_util.test_pass('Test checking vm status after graceful stop and start success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:82,代码来源:test_min_ha_param_vm_ha_power_off.py
示例10: test
def test():
global vm
global host_uuid
global host_ip
must_ps_list = ['MiniStorage']
test_lib.skip_test_if_any_ps_not_deployed(must_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("ttylinux").uuid
#l3_name = os.environ.get('l3NoVlanNetworkName1')
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()
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
#conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
host_uuid = test_lib.lib_find_host_by_vm(vm.get_vm()).uuid
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
test_host = None
host_list = test_stub.get_sce_hosts(test_lib.all_scenario_config, test_lib.scenario_file)
for host in host_list:
if host.ip_ == host_ip:
test_host = host
break
if not test_host:
test_util.test_fail('there is no host with ip %s in scenario file.' %(host_ip))
test_stub.stop_host(test_host, test_lib.all_scenario_config, 'cold')
vm_stop_time = None
cond = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
for i in range(0, 300):
vm_stop_time = i
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Unknown":
test_stub.start_host(test_host, test_lib.all_scenario_config)
test_stub.recover_host_vlan(test_host, test_lib.all_scenario_config, test_lib.deploy_config)
break
time.sleep(1)
if vm_stop_time is None:
vm_stop_time = 300
for i in range(vm_stop_time, 300):
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Starting":
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 VM ha on host failure Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:74,代码来源:test_minips_vm_ha_force_stop.py
示例11: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
allow_ps_list = [inventory.CEPH_PRIMARY_STORAGE_TYPE, inventory.NFS_PRIMARY_STORAGE_TYPE, 'SharedMountPoint']
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('l3NoVlanNetworkName1')
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_name2 = os.environ.get('l3VlanNetwork2')
l3_net_uuid2 = test_lib.lib_get_l3_by_name(l3_name2).uuid
test_lib.clean_up_all_vr()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_uuid)
vm_creation_option.set_l3_uuids([l3_net_uuid, l3_net_uuid2])
vm_creation_option.set_default_l3_uuid(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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
test_stub.ensure_host_has_no_vr(host_uuid)
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
ha_ops.set_vm_instance_ha_level(vm.get_vm().uuid, "NeverStop")
test_stub.down_host_network(host_ip, test_lib.all_scenario_config)
test_util.test_logger("wait for 240 seconds")
time.sleep(240)
test_stub.up_host_network(host_ip, test_lib.all_scenario_config)
#vm.update() #bug for host uuid is not updated
cond = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
vm_inv = res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0]
vm_host_ip = test_lib.lib_find_host_by_vm(vm_inv).managementIp
for i in range(0, max_time):
test_util.test_logger("vm_host_ip:%s; host_ip:%s" %(vm_host_ip, host_ip))
time.sleep(1)
vm_inv = res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0]
vm_host_ip = test_lib.lib_find_host_by_vm(vm_inv).managementIp
if vm_host_ip != host_ip:
break
else:
test_util.test_fail("VM is expected to start running on another host")
test_lib.lib_set_vm_host_l2_ip(vm_inv)
#vm.check() #bug when multi-networks
#if test_lib.lib_wait_target_up(vm_inv.vmNics[0].ip, '22', 120):
# test_util.test_logger("%s can be connected within 120s" %(vm_inv.vmNics[0].ip))
#elif test_lib.lib_wait_target_up(vm_inv.vmNics[1].ip, '22', 120):
# test_util.test_logger("%s can be connected within 120s" %(vm_inv.vmNics[1].ip))
#else:
# test_util.test_fail("Both %s and %s can't be connected." %(vm_inv.vmNics[0].ip, vm_inv.vmNics[1].ip))
ssh_timeout = test_lib.SSH_TIMEOUT
test_lib.SSH_TIMEOUT = 120
if not test_lib.lib_ssh_vm_cmd_by_agent_with_retry(vm_host_ip, vm_inv.vmNics[0].ip, 'root', 'password', "pwd"):
test_lib.SSH_TIMEOUT = ssh_timeout
test_util.test_fail("vm can't be access by %s." %(vm_inv.vmNics[0].ip))
if not test_lib.lib_ssh_vm_cmd_by_agent_with_retry(vm_host_ip, vm_inv.vmNics[1].ip, 'root', 'password', "pwd"):
test_lib.SSH_TIMEOUT = ssh_timeout
test_util.test_fail("vm can't be access by %s." %(vm_inv.vmNics[1].ip))
test_lib.SSH_TIMEOUT = ssh_timeout
#.........这里部分代码省略.........
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:101,代码来源:test_vm_ha_nets_discon_host_vm_running.py
示例12: test
def test():
global vm
global host_uuid
global test_host
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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_none_status')
vm2 = test_vm_header.ZstackTestVm()
vm2.set_creation_option(vm_creation_option)
vm2.create()
test_stub.ensure_host_has_no_vr(host_uuid)
#vm.check()
host_ip = test_lib.lib_find_host_by_vm(vm2.get_vm()).managementIp
test_util.test_logger("host %s is disconnecting" %(host_ip))
host_list = test_stub.get_sce_hosts(test_lib.all_scenario_config, test_lib.scenario_file)
for host in host_list:
if host.ip_ == host_ip:
test_host = host
break
if not test_host:
test_util.test_fail('there is no host with ip %s in scenario file.' %(host_ip))
test_stub.stop_host(test_host, test_lib.all_scenario_config, 'cold')
cond = res_ops.gen_query_conditions('name', '=', 'ls_vm_none_status')
cond = res_ops.gen_query_conditions('uuid', '=', vm2.vm.uuid, cond)
vm_stop_time = None
for i in range(0, 300):
vm_stop_time = i
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Unknown":
test_stub.start_host(test_host, test_lib.all_scenario_config)
test_stub.recover_host_vlan(test_host, test_lib.all_scenario_config, test_lib.deploy_config)
break
time.sleep(1)
if vm_stop_time is None:
vm_stop_time = 300
for i in range(vm_stop_time, 300):
if res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Stopped":
break
time.sleep(1)
else:
test_util.test_fail("vm none is not change to Stopped as expected within 300s.")
test_util.test_pass('Test checking vm none status when host has been force stop Success.')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:85,代码来源:test_ls_vm_none_force_stop_host_vm_status.py
示例13: test
def test():
global vm
global host_uuid
global host_ip
global max_attempts
global storagechecker_timeout
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('l3NoVlanNetworkName1')
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()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
#vr_host_ips = []
#for vr in vrs:
# vr_ip = test_lib.lib_find_host_by_vr(vr).managementIp
# #ensure mn host has no vr
# if vr_ip == mn_ip:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip)
# host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
# vm_ops.migrate_vm(vr.uuid, host_uuid)
# vr_host_ips.append(vr_ip)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_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('multihost_basic_vm')
vm = test_vm_header.ZstackTestVm()
vm.set_creation_option(vm_creation_option)
vm.create()
vm.check()
test_stub.ensure_host_has_no_vr(host_uuid)
if not test_lib.lib_check_vm_live_migration_cap(vm.vm):
vm.destroy()
test_util.test_skip('skip ha if live migrate not supported')
ps = test_lib.lib_get_primary_storage_by_uuid(vm.get_vm().allVolumes[0].primaryStorageUuid)
if ps.type == inventory.LOCAL_STORAGE_TYPE:
vm.destroy()
test_util.test_skip('Skip test on localstorage')
host_ip = test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp
host_port = test_lib.lib_get_host_port(host_ip)
test_util.test_logger("host %s is disconnecting" %(host_ip))
host_list = test_stub.get_sce_hosts(test_lib.all_scenario_config, test_lib.scenario_file)
for host in host_list:
if host.ip_ == host_ip:
test_host = host
break
if not test_host:
test_util.test_fail('there is no host with ip %s in scenario file.' %(host_ip))
#test_stub.down_host_network(host_ip, test_lib.all_scenario_config)
test_stub.stop_host(test_host, test_lib.all_scenario_config, 'cold')
time.sleep(30)
#test_stub.up_host_network(host_ip, test_lib.all_scenario_config)
test_stub.start_host(test_host, test_lib.all_scenario_config)
test_stub.recover_host_vlan(test_host, test_lib.all_scenario_config, test_lib.deploy_config)
time.sleep(120)
cmd = "nohup zstack-ctl start &"
host_username = os.environ.get('hostUsername')
host_password = os.environ.get('hostPassword')
if not test_lib.lib_execute_ssh_cmd(mn_ip, host_username, host_password, cmd, timeout = 300):
test_util.test_fail("CMD:%s execute failed on %s" %(cmd, mn_ip))
#test_util.test_logger("wait for 480 seconds")
#time.sleep(480)
time.sleep(120)
cond = res_ops.gen_query_conditions('uuid', '=', vm.vm.uuid)
if not res_ops.query_resource(res_ops.VM_INSTANCE, cond)[0].state == "Stopped":
test_util.test_fail("vm is not stopped as expected.")
vm.destroy()
#this is used to design to check mn works normally
#.........这里部分代码省略.........
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:101,代码来源:test_vm_none_mn_force_stop_start_host_vm_status.py
示例14: test
def test():
global vm
global host_uuid
global test_host
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('l3NoVlanNetworkName1')
l3_name = os.environ.get('l3VlanNetworkName1')
l3_net_uuid = test_lib.lib_get_l3_by_name(l3_name).uuid
l3_name2 = os.environ.get('l3VlanNetwork2')
l3_net_uuid2 = test_lib.lib_get_l3_by_name(l3_name2).uuid
test_lib.clean_up_all_vr()
#vrs = test_lib.lib_find_vr_by_l3_uuid(l3_net_uuid)
#vr_host_ips = []
#for vr in vrs:
# vr_host_ips.append(test_lib.lib_find_host_by_vr(vr).managementIp)
# if test_lib.lib_is_vm_running(vr) != True:
# vm_ops.start_vm(vr.uuid)
#time.sleep(60)
mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
conditions = res_ops.gen_query_conditions('type', '=', 'UserVm')
instance_offering_uuid = res_ops.query_resource(res_ops.INSTANCE_OFFERING, conditions)[0].uuid
conditions = res_ops.gen_query_conditions('state', '=', 'Enabled')
conditions = res_ops.gen_query_conditions('status', '=', 'Connected', conditions)
conditions = res_ops.gen_query_conditions('managementIp', '!=', mn_ip, conditions)
#for vr_host_ip in vr_host_ips:
# conditions = res_ops.gen_query_conditions('managementIp', '!=', vr_host_ip, conditions)
host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].uuid
vm_creation_option.set_host_uuid(host_uuid)
vm_creation_option.set_l3_uuids([l3_net_uuid, l3_net_uuid2])
vm_creation_option.set_default_l3_uuid(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('multihost_bas
|
请发表评论