当前位置: 首页>>代码示例>>Python>>正文


Python host_operations.reconnect_host函数代码示例

本文整理汇总了Python中zstackwoodpecker.operations.host_operations.reconnect_host函数的典型用法代码示例。如果您正苦于以下问题:Python reconnect_host函数的具体用法?Python reconnect_host怎么用?Python reconnect_host使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reconnect_host函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

def test():
    global test_obj_dict
    global ps_uuid
    global host_uuid
    global vr_uuid
    allow_ps_list = [inventory.CEPH_PRIMARY_STORAGE_TYPE, "SharedBlock"]
    test_lib.skip_test_when_ps_type_not_in_list(allow_ps_list)

    test_util.test_dsc('Create test vm and check')

    bs_cond = res_ops.gen_query_conditions("status", '=', "Connected")
    bss = res_ops.query_resource_fields(res_ops.BACKUP_STORAGE, bs_cond, \
            None)
    if not bss:
        test_util.test_skip("not find available backup storage. Skip test")

    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.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')
    test_stub.disable_all_pss()
    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.delete()
    volume.check()
    volume.expunge()
    volume.check()

    #ps_ops.change_primary_storage_state(ps_uuid, 'enable')
    test_stub.enable_all_pss()
    host_ops.reconnect_host(host_uuid)
    vm_ops.reconnect_vr(vr_uuid)
    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 disable mode Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:60,代码来源:test_disable_ps_expunge_attached_share_vol.py

示例2: 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

示例3: test

def test():
    test_util.test_dsc("create vr vm and vpc vrouter")
    vm = test_stub.create_vr_vm('vr_vm','imageName_s','l3NoVlanNetworkName2')
    test_obj_dict.add_vm(vm)

    if not test_lib.lib_find_vr_by_vm(vm.vm) or not test_lib.lib_find_vr_by_vm(vm.vm)[0]:
        test_lib.lib_error_cleanup(test_obj_dict)
        test_util.test_skip("skip the test for no vr found in the env.")
    vpc_vr = test_stub.create_vpc_vrouter()
    check_host_prometheus_conf()
    check_vrouter_prometheus_conf()
    check_prometheus_data()
    hosts = test_lib.lib_get_all_hosts_from_plan()
    
    for host in hosts:
        host_ops.reconnect_host(host_uuid)
    check_host_prometheus_conf()
    check_vrouter_prometheus_conf()
    check_prometheus_data()

    test_lib.lib_execute_ssh_cmd(mn_ip,"root","password","zstack-ctl restart_node",timeout=300)
    check_host_prometheus_conf()
    check_vrouter_prometheus_conf()
    check_prometheus_data()

    test_lib.lib_error_cleanup(test_obj_dict)
    test_util.test_pass('Test prometheus Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:27,代码来源:test_prometheus.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: 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()
    #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')
    test_stub.disable_all_pss()
    if not test_lib.lib_wait_target_up(vm.get_vm().vmNics[0].ip, '22', 90):
        test_util.test_fail('VM is expected to runnning when PS change to disable state')

    vm.set_state(vm_header.RUNNING)
    vm.check()
    vm.suspend()
    vm.check()

    #ps_ops.change_primary_storage_state(ps_uuid, 'enable')
    test_stub.enable_all_pss()
    host_ops.reconnect_host(host_uuid)
    vm_ops.reconnect_vr(vr_uuid)
    test_util.test_pass('PS disable mode Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:34,代码来源:test_disable_ps_suspend_vm.py

示例6: test

def test():
    instance_offering_name = os.environ.get('instanceOfferingName_m')
    instance_offering_uuid = test_lib.lib_get_instance_offering_by_name(instance_offering_name).uuid

    vm = test_stub.create_vm(image_name = os.environ.get('sshkeyImageName'), instance_offering_uuid = instance_offering_uuid)
    test_obj_dict.add_vm(vm)
    vm_ip = vm.get_vm().vmNics[0].ip
    time.sleep(10)
    test_lib.lib_add_vm_sshkey(vm.get_vm().uuid, os.environ.get('sshkeyPubKey'))
    host = test_lib.lib_get_vm_host(vm.get_vm())
    host_uuid = host.uuid
    host_ops.reconnect_host(host_uuid)
    vm.reboot()
    test_lib.lib_wait_target_up(vm_ip, '22', 240)
    time.sleep(10)
    for i in range(5):
        ssh_cmd = 'timeout 5 ssh -i %s -oPasswordAuthentication=no -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null %s echo pass' % (os.environ.get('sshkeyPriKey_file'), vm_ip)
        process_result = test_stub.execute_shell_in_process(ssh_cmd, tmp_file)
        if process_result == 0:
            break
        else:
            time.sleep(10)
    else:
        test_util.test_fail("fail to use ssh key connect to VM")

    vm.destroy()
    test_util.test_pass('Create VM Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:27,代码来源:test_create_vm_sshkey3.py

示例7: test

def test():
    test_util.test_dsc("check all hosts chrony status")
    host_uuid_list = []
    host_ip_list = []
    host_port_list = []
    hosts = {}

    for host_id in range(len(res_ops.query_resource(res_ops.HOST))):
        managementIp = res_ops.query_resource(res_ops.HOST)[host_id].managementIp
        sshPort = res_ops.query_resource(res_ops.HOST)[host_id].sshPort
        uuid = res_ops.query_resource(res_ops.HOST)[host_id].uuid
        host_ip_list.append(managementIp)
        host_port_list.append(sshPort)
        host_uuid_list.append(uuid)
    hosts = dict(zip(host_ip_list, host_port_list))
    print "hosts is %s" %(hosts)
    for k, v in hosts.items():
        check_chrony_status(k, v)
    for host_uuid in host_uuid_list:
        host_ops.reconnect_host(host_uuid)
        time.sleep(5)
    for k, v in hosts.items():
        check_chrony_status(k, v)

    host_ops.change_host_state(host_uuid_list[0], "disable")
    for k, v in hosts.items():
        check_chrony_status(k, v)
    host_ops.change_host_state(host_uuid_list[0], "enable")

    test_lib.lib_error_cleanup(test_obj_dict)
    test_util.test_pass('Test chrony Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:31,代码来源:test_chrony.py

示例8: error_cleanup

def error_cleanup():
    global email_endpoint_uuid,email_platform_uuid,my_sns_topic_uuid,host_sns_topic_uuid,ps_uuid,hostname,host_management_ip,host_status,bs_type,bs_status,event_list
    if host_status == 'Disconnected':
        host_ops.update_host(host_uuid, 'managementIp', host_management_ip)
        host_ops.reconnect_host(host_uuid)
    if bs_status == 'Disconnected':
        if bs_type == res_ops.IMAGE_STORE_BACKUP_STORAGE:
            bs_ops.update_image_store_backup_storage_info(bs_uuid, 'hostname', hostname)
            bs_ops.reconnect_backup_storage(bs_uuid)
        elif bs_type == res_ops.SFTP_BACKUP_STORAGE:
            bs_ops.update_sftp_backup_storage_info(bs_uuid, 'hostname', hostname)
            bs_ops.reconnect_backup_storage(bs_uuid)
    if ps_uuid:
        ps_ops.delete_primary_storage(ps_uuid)
    if host_sns_topic_uuid:
        zwt_ops.delete_sns_topic(host_sns_topic_uuid)
    if my_sns_topic_uuid:
        zwt_ops.delete_sns_topic(my_sns_topic_uuid)
    if event_list:
        for event_uuid in event_list:
            zwt_ops.unsubscribe_event(event_uuid)
    if email_endpoint_uuid:
        zwt_ops.delete_sns_application_endpoint(email_endpoint_uuid)
    if email_platform_uuid:
        zwt_ops.delete_sns_application_platform(email_platform_uuid)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:25,代码来源:test_event_host_bs_ps_disconnected_with_email.py

示例9: test

def test():
    global vm_inv,host_name, host_uuid, host_management_ip, vm_ip, bs_name, bs_uuid
    test_util.test_dsc('Create test vm to test zstack upgrade by -u.')

    image_name = os.environ.get('imageTestAlarm_230_mn')
    iso_path = os.environ.get('iso_path')
    zstack_latest_version = os.environ.get('zstackLatestVersion')
    zstack_latest_path = os.environ.get('zstackLatestInstaller')
    vm_name = os.environ.get('vmName') + image_name
    upgrade_script_path = os.environ.get('upgradeScript')

    vm_inv = test_stub.create_vm_scenario(image_name, vm_name)
    vm_ip = vm_inv.vmNics[0].ip
    test_lib.lib_wait_target_up(vm_ip, 22)
    #vm_ip = '172.20.197.159'
    os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'] = vm_ip
    test_stub.make_ssh_no_password(vm_ip, tmp_file)

    test_util.test_logger('Update MN IP')
    test_stub.update_mn_hostname(vm_ip, tmp_file)
    test_stub.update_mn_ip(vm_ip, tmp_file)
    test_stub.start_mn(vm_ip, tmp_file)


    test_util.test_logger('Update host management IP and reconnect host')
    host_name = 'Host-1'
    cond1 = res_ops.gen_query_conditions('name', '=', host_name)
    test2 = res_ops.query_resource(res_ops.HOST, cond1)
    test_util.test_logger('aaaaa %s' % test2)
    #host_uuid = res_ops.query_resource(res_ops.HOST, conditions)[0].inventories[0]
    management_ip = vm_ip
    host_uuid = scen_ops.query_resource(management_ip, res_ops.HOST, cond1).inventories[0].uuid
    print 'test = ' 
    print  host_uuid
    host_management_ip = vm_ip
    host_ops.update_host(host_uuid, 'managementIp', host_management_ip)
    host_ops.reconnect_host(host_uuid)

    test_util.test_logger('Update bs IP and reconnect bs')
    bs_name = 'BS-1'
    cond2 = res_ops.gen_query_conditions('name', '=', bs_name)
    #bs_uuid = res_ops.query_resource(res_ops.BACKUP_STORAGE, conditions)[0].inventories[0].uuid    
    bs_uuid = scen_ops.query_resource(management_ip, res_ops.BACKUP_STORAGE, cond2).inventories[0].uuid
    bs_ip = vm_ip
    bs_ops.update_image_store_backup_storage_info(bs_uuid, 'hostname', bs_ip)
    bs_ops.reconnect_backup_storage(bs_uuid)

    #test_stub.check_installation(vm_ip, tmp_file)

    test_util.test_logger('Upgrade zstack to latest') 
    test_stub.update_iso(vm_ip, tmp_file, iso_path, upgrade_script_path)
    test_stub.upgrade_zstack(vm_ip, zstack_latest_path, tmp_file) 
    test_stub.check_zstack_version(vm_ip, tmp_file, zstack_latest_version)
    test_stub.start_mn(vm_ip, tmp_file)
    test_stub.check_installation(vm_ip, tmp_file)

    os.system('rm -f %s' % tmp_file)
    test_stub.destroy_vm_scenario(vm_inv.uuid)
    test_util.test_pass('ZStack upgrade Test Success')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:59,代码来源:test_zs_upgd_2.3.0_latest_test_alarm_on_cos7.py

示例10: env_recover

def env_recover():
    global host_ip
    test_util.test_logger("recover host: %s" % (test_host.ip_))
    test_stub.recover_host(test_host, test_lib.all_scenario_config, test_lib.deploy_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)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_stor_sep_nfs_vr_vm_ha_grace_stop_start_host.py

示例11: env_recover

def env_recover():
    global host_ip
    cmd = 'bash -ex %s %s' % (os.environ.get('hostRecoverScript'), host_ip)
    test_util.test_logger(cmd)
    os.system(cmd)
    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)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:8,代码来源:test_stor_sep_nfs_vm_ha_nfs_dis_vm_run.py

示例12: 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

示例13: env_recover

def env_recover():
    global host_ip
    try:
        test_stub.up_host_network(host_ip, test_lib.all_scenario_config)
    except:
        pass
    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)
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:9,代码来源:test_nfs_ls_vm_none_net_discon_connect_vm_status.py

示例14: test

def test():

    ps_env = test_stub.PSEnvChecker()
    
    mn_ip = res_ops.query_resource(res_ops.MANAGEMENT_NODE)[0].hostName
    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 = random.choice(res_ops.query_resource(res_ops.HOST, conditions))
    record['host_ip'] = host.managementIp
    record['host_port'] = host.sshPort
    record['host_uuid'] = host.uuid

    test_util.test_dsc("Create {0} vm each with {1} datavolume".format(VM_COUNT, DATA_VOLUME_NUMBER))
    if ps_env.is_sb_ceph_env:
        ps_list = res_ops.query_resource(res_ops.PRIMARY_STORAGE)
        ps = random.choice(ps_list)
        ps_uuid = ps.uuid
        vm_list = test_stub.create_multi_vms(name_prefix='test-', count=VM_COUNT,
                                             data_volume_number=DATA_VOLUME_NUMBER, host_uuid=host.uuid, ps_uuid=ps_uuid, timeout=1800000, bs_type="ImageStoreBackupStorage" if ps.type == "SharedBlock" else "Ceph")
    else:
        vm_list = test_stub.create_multi_vms(name_prefix='test-', count=VM_COUNT,
                                             data_volume_number=DATA_VOLUME_NUMBER, host_uuid=host.uuid, timeout=1800000)

    for vm in vm_list:
        test_obj_dict.add_vm(vm)

    test_util.test_logger("host %s is disconnecting" % host.managementIp)
    for vm in vm_list:
        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(l2interface)
    cmd = "ifdown %s && sleep 180 && ifup %s" % (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.managementIp, 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 180 seconds")
    time.sleep(180)
    for vm in vm_list:
        vm.update()
        if test_lib.lib_find_host_by_vm(vm.get_vm()).managementIp == host.managementIp:
            test_util.test_fail("VM is expected to start running on another host")
        vm.set_state(vm_header.RUNNING)
        vm.check()

    cmd = 'PORT=%s bash -ex %s %s' % (host.sshPort, os.environ.get('hostRecoverScript'),host.managementIp)
    test_util.test_logger(cmd)
    os.system(cmd)
    host_ops.reconnect_host(host.uuid)

    test_util.test_pass('Multi PrimaryStorage Vm HA Test Pass')
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:56,代码来源:test_vm_ha_multi_ps.py

示例15: env_recover

def env_recover():
    global test_host
    try:
        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)
    except:
        pass
开发者ID:zstackorg,项目名称:zstack-woodpecker,代码行数:10,代码来源:test_2nfs_vr_vm_ha_grace_stop_host_vm_status.py


注:本文中的zstackwoodpecker.operations.host_operations.reconnect_host函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。