def env_recover():
    global mn_host
    global pub_mn_ip
    global mag_mn_ip
    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
    os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'] = pub_mn_ip
def env_recover():
    global need_recover_mn_host_list
    if need_recover_mn_host_list:
        for index in need_recover_mn_host_list:
            test_util.test_logger("recover host: %s" % (mn_host_list[index].ip_))
            test_stub.recover_host(mn_host_list[index], test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
示例#3
0
def env_recover():
    global need_recover_mn_host_list
    if need_recover_mn_host_list:
        for index in need_recover_mn_host_list:
            test_util.test_logger("recover host: %s" % (mn_host_list[index].ip_))
            test_stub.recover_host(mn_host_list[index], test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
def env_recover():
    global mn_host
    global pub_mn_ip
    global mag_mn_ip
    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
    os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'] = pub_mn_ip
def env_recover():
    global s_vm0
    global s_vm1
    test_util.test_logger("recover host: %s and %s" % (s_vm0.ip_, s_vm1.ip_))
    test_stub.recover_host(s_vm0, test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.recover_host(s_vm1, test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
    test_stub.exec_zsha2_version(vip_s_vm_cfg_lst[0].ip_, "root", "password")
def test():
    global vm
    global mn_host

    test_stub.skip_if_scenario_is_multiple_networks()

    for i in range(0, 10):
        test_util.test_logger("shutdown host network round %s" % (i))
        mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
        if len(mn_host) != 1:
            test_util.test_fail('MN VM is running on %d host(s)' % len(mn_host))
        test_util.test_logger("shutdown host's network [%s] that mn vm is running on" % (mn_host[0].ip_))
        test_stub.shutdown_host_network(mn_host[0], test_lib.all_scenario_config)
        test_util.test_logger("wait for 20 seconds to see if management node VM starts on another host")
        time.sleep(20)
    
        new_mn_host_ip = test_stub.get_host_by_consul_leader(test_lib.all_scenario_config, test_lib.scenario_file)
        if new_mn_host_ip == "" or new_mn_host_ip == mn_host[0].ip_:
            test_util.test_fail("management node VM not run correctly on [%s] after its former host [%s] down for 20s" % (new_mn_host_ip, mn_host[0].ip_))
        else:
            test_util.test_logger("management node VM run on [%s] after its former host [%s] down for 20s" % (new_mn_host_ip, mn_host[0].ip_))
    
        count = 60
        while count > 0:
            new_mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
            if len(new_mn_host) == 1:
                test_util.test_logger("management node VM run after its former host down for 30s")
                break
            elif len(new_mn_host) > 1:
                test_util.test_fail("management node VM runs on more than one host after its former host down")
            time.sleep(5)
            count -= 1
    
        if len(new_mn_host) == 0:
            test_util.test_fail("management node VM does not run after its former host down for 30s")
        elif len(new_mn_host) > 1:
            test_util.test_fail("management node VM runs on more than one host after its former host down")
    
        #node_ops.wait_for_management_server_start()
        test_stub.wrapper_of_wait_for_management_server_start(600)
    
        test_stub.ensure_hosts_connected(exclude_host=[mn_host[0]])
        test_stub.ensure_bss_host_connected_from_stop(test_lib.scenario_file, test_lib.all_scenario_config, test_lib.deploy_config)
        test_stub.ensure_pss_connected()
        test_stub.ensure_bss_connected()

        if os.path.basename(os.environ.get('WOODPECKER_SCENARIO_CONFIG_FILE')).strip() == "scenario-config-vpc-ceph-3-sites.xml":
            pass
        else:
            vm = test_stub.create_basic_vm()
            vm.check()
            vm.destroy()

        test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
        test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)

    test_util.test_pass('Create VM Test Success')
def env_recover():
    global pub_mn_ip
    global mag_mn_ip
    if need_recover_mn_host_list:
        for index in need_recover_mn_host_list:
            test_util.test_logger("recover host: %s" % (mn_host_list[index].ip_))
            test_stub.recover_host(mn_host_list[index], test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
    os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'] = pub_mn_ip
def env_recover():
    global pub_mn_ip
    global mag_mn_ip
    if need_recover_mn_host_list:
        for index in need_recover_mn_host_list:
            test_util.test_logger("recover host: %s" % (mn_host_list[index].ip_))
            test_stub.recover_host(mn_host_list[index], test_lib.all_scenario_config, test_lib.deploy_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
    os.environ['ZSTACK_BUILT_IN_HTTP_SERVER_IP'] = pub_mn_ip
示例#9
0
def test():
    global vm
    global mn_host

    test_stub.skip_if_scenario_is_multiple_networks()

    for i in range(0, 10):
        test_util.test_logger("shutdown host network round %s" % (i))
        mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
        if len(mn_host) != 1:
            test_util.test_fail('MN VM is running on %d host(s)' % len(mn_host))
        test_util.test_logger("shutdown host's network [%s] that mn vm is running on" % (mn_host[0].ip_))
        test_stub.shutdown_host_network(mn_host[0], test_lib.all_scenario_config)
        test_util.test_logger("wait for 20 seconds to see if management node VM starts on another host")
        time.sleep(20)
    
        new_mn_host_ip = test_stub.get_host_by_consul_leader(test_lib.all_scenario_config, test_lib.scenario_file)
        if new_mn_host_ip == "" or new_mn_host_ip == mn_host[0].ip_:
            test_util.test_fail("management node VM not run correctly on [%s] after its former host [%s] down for 20s" % (new_mn_host_ip, mn_host[0].ip_))
        else:
            test_util.test_logger("management node VM run on [%s] after its former host [%s] down for 20s" % (new_mn_host_ip, mn_host[0].ip_))
    
        count = 60
        while count > 0:
            new_mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
            if len(new_mn_host) == 1:
                test_util.test_logger("management node VM run after its former host down for 30s")
                break
            elif len(new_mn_host) > 1:
                test_util.test_fail("management node VM runs on more than one host after its former host down")
            time.sleep(5)
            count -= 1
    
        if len(new_mn_host) == 0:
            test_util.test_fail("management node VM does not run after its former host down for 30s")
        elif len(new_mn_host) > 1:
            test_util.test_fail("management node VM runs on more than one host after its former host down")
    
        try:
            node_ops.wait_for_management_server_start()
        except:
            test_util.test_fail("management node does not recover after its former host's network down")
    
        test_stub.ensure_hosts_connected(exclude_host=[mn_host[0]])
        test_stub.ensure_bss_host_connected_from_stop(test_lib.scenario_file, test_lib.all_scenario_config, test_lib.deploy_config)
        test_stub.ensure_pss_connected()
        test_stub.ensure_bss_connected()

        vm = test_stub.create_basic_vm()
        vm.check()
        vm.destroy()

        test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
        test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)

    test_util.test_pass('Create VM Test Success')
def test():
    global vm
    global mn_host

    test_stub.skip_if_scenario_not_multiple_networks()

    mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
    if len(mn_host) != 1:
        test_util.test_fail('MN VM is running on %d host(s)' % len(mn_host))
    test_util.test_logger("shutdown host's network [%s] that mn vm is running on" % (mn_host[0].ip_))
    test_stub.shutdown_host_network(mn_host[0], test_lib.all_scenario_config, downMagt=True)
    test_util.test_logger("wait for 20 seconds to see if management node VM starts on another host")
    time.sleep(20)

    new_mn_host_ip = test_stub.get_host_by_consul_leader(test_lib.all_scenario_config, test_lib.scenario_file)
    if new_mn_host_ip == "" or (new_mn_host_ip != mn_host[0].ip_ and new_mn_host_ip != mn_host[0].managementIp_):
        test_util.test_fail("management network down, mn host should not changed. Expected on [%s] while is on [%s]" % (mn_host[0].ip_, new_mn_host_ip))

    count = 120
    while count > 0:
        new_mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config, test_lib.scenario_file)
        if len(new_mn_host) == 1:
            test_util.test_logger("management node VM run after its former host down for 120s")
            break
        elif len(new_mn_host) > 1:
            test_util.test_fail("management node VM runs on more than one host after its former host down")
        time.sleep(5)
        count -= 1

    if len(new_mn_host) == 0:
        test_util.test_fail("management node VM does not run after its former host down for 120s")
    elif len(new_mn_host) > 1:
        test_util.test_fail("management node VM runs on more than one host after its former host down")

    #node_ops.wait_for_management_server_start()
    test_stub.wrapper_of_wait_for_management_server_start(600)

    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)

    test_stub.ensure_hosts_connected()
    test_stub.ensure_bss_host_connected_from_sep_net_down(test_lib.scenario_file, test_lib.all_scenario_config, downMagt=True)
    test_stub.ensure_bss_connected()
    test_stub.ensure_pss_connected()

    test_stub.return_pass_ahead_if_3sites("TEST PASS")
    vm = test_stub.create_basic_vm()
    vm.check()
    vm.destroy()

    test_util.test_pass('Create VM Test Success')
def env_recover():
    test_util.test_logger("wait for mn ha ready")
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                   test_lib.scenario_file)
def env_recover():
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
def test():
    global vm
    global mn_host
    for i in range(0, 10):
        test_util.test_logger("force shutdown host round %s" % (i))

        mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config,
                                              test_lib.scenario_file)
        if len(mn_host) != 1:
            test_util.test_fail('MN VM is running on %d host(s)' %
                                len(mn_host))
        test_util.test_logger(
            "force shutdown host [%s] that mn vm is running on" %
            (mn_host[0].ip_))
        test_stub.stop_host(mn_host[0], test_lib.all_scenario_config, 'cold')
        test_util.test_logger(
            "wait for 40 seconds to see if management node VM starts on another host"
        )
        time.sleep(20)

        new_mn_host_ip = test_stub.get_host_by_consul_leader(
            test_lib.all_scenario_config, test_lib.scenario_file)
        if new_mn_host_ip == "" or new_mn_host_ip == mn_host[0].ip_:
            test_util.test_fail(
                "management node VM not run correctly on [%s] after its former host [%s] down for 20s"
                % (new_mn_host_ip, mn_host[0].ip_))

        count = 60
        while count > 0:
            new_mn_host = test_stub.get_host_by_mn_vm(
                test_lib.all_scenario_config, test_lib.scenario_file)
            if len(new_mn_host) == 1:
                test_util.test_logger(
                    "management node VM run after its former host down for 30s"
                )
                break
            elif len(new_mn_host) > 1:
                test_util.test_fail(
                    "management node VM runs on more than one host after its former host down"
                )
            time.sleep(5)
            count -= 1

        if len(new_mn_host) == 0:
            test_util.test_fail(
                "management node VM does not run after its former host down for 30s"
            )
        elif len(new_mn_host) > 1:
            test_util.test_fail(
                "management node VM runs on more than one host after its former host down"
            )

        try:
            node_ops.wait_for_management_server_start(300)
        except:
            test_util.test_fail(
                "management node does not recover after its former host down")

        test_util.test_logger("try to create vm, timeout is 30s")
        time_out = 30
        while time_out > 0:
            try:
                vm = test_stub.create_basic_vm()
                break
            except:
                time.sleep(1)
                time_out -= 1
        if time_out == 0:
            test_util.test_fail('Fail to create vm after mn is ready')
        vm.check()
        vm.destroy()
        test_stub.recover_host(mn_host[0], test_lib.all_scenario_config,
                               test_lib.deploy_config)
        test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                       test_lib.scenario_file)

    test_util.test_pass('Create VM Test Success')
def env_recover():
    global mn_host
    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                   test_lib.scenario_file)
def test():
    global vm
    global mn_host

    test_stub.skip_if_scenario_not_multiple_networks()

    mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config,
                                          test_lib.scenario_file)
    if len(mn_host) != 1:
        test_util.test_fail('MN VM is running on %d host(s)' % len(mn_host))
    test_util.test_logger(
        "shutdown host's network [%s] that mn vm is running on" %
        (mn_host[0].ip_))
    test_stub.shutdown_host_network(mn_host[0],
                                    test_lib.all_scenario_config,
                                    downMagt=True)
    test_util.test_logger(
        "wait for 20 seconds to see if management node VM starts on another host"
    )
    time.sleep(20)

    new_mn_host_ip = test_stub.get_host_by_consul_leader(
        test_lib.all_scenario_config, test_lib.scenario_file)
    if new_mn_host_ip == "" or (new_mn_host_ip != mn_host[0].ip_ and
                                new_mn_host_ip != mn_host[0].managementIp_):
        test_util.test_fail(
            "management network down, mn host should not changed. Expected on [%s] while is on [%s]"
            % (mn_host[0].ip_, new_mn_host_ip))

    count = 120
    while count > 0:
        new_mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config,
                                                  test_lib.scenario_file)
        if len(new_mn_host) == 1:
            test_util.test_logger(
                "management node VM run after its former host down for 120s")
            break
        elif len(new_mn_host) > 1:
            test_util.test_fail(
                "management node VM runs on more than one host after its former host down"
            )
        time.sleep(5)
        count -= 1

    if len(new_mn_host) == 0:
        test_util.test_fail(
            "management node VM does not run after its former host down for 120s"
        )
    elif len(new_mn_host) > 1:
        test_util.test_fail(
            "management node VM runs on more than one host after its former host down"
        )

    try:
        node_ops.wait_for_management_server_start()
    except:
        test_util.test_fail(
            "management node does not recover after its former host's network down"
        )

    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                   test_lib.scenario_file)

    test_stub.ensure_hosts_connected()
    test_stub.ensure_bss_host_connected_from_sep_net_down(
        test_lib.scenario_file, test_lib.all_scenario_config, downMagt=True)
    test_stub.ensure_bss_connected()
    test_stub.ensure_pss_connected()

    vm = test_stub.create_basic_vm()
    vm.check()
    vm.destroy()

    test_util.test_pass('Create VM Test Success')
示例#16
0
def env_recover():
    test_util.test_logger("recover consul on host: %s" % (test_host.ip_))
    test_stub.start_consul(test_host, test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                   test_lib.scenario_file)
def test():
    global vm
    global mn_host
    for i in range(0, 10):
        test_util.test_logger("force shutdown host round %s" % (i))

        mn_host = test_stub.get_host_by_mn_vm(test_lib.all_scenario_config,
                                              test_lib.scenario_file)
        if len(mn_host) != 1:
            test_util.test_fail('MN VM is running on %d host(s)' %
                                len(mn_host))
        test_util.test_logger(
            "force shutdown host [%s] that mn vm is running on" %
            (mn_host[0].ip_))
        test_stub.stop_host(mn_host[0], test_lib.all_scenario_config, 'cold')
        test_util.test_logger(
            "wait for 40 seconds to see if management node VM starts on another host"
        )
        time.sleep(20)

        new_mn_host_ip = test_stub.get_host_by_consul_leader(
            test_lib.all_scenario_config, test_lib.scenario_file)
        if new_mn_host_ip == "" or new_mn_host_ip == mn_host[0].ip_:
            test_util.test_fail(
                "management node VM not run correctly on [%s] after its former host [%s] down for 20s"
                % (new_mn_host_ip, mn_host[0].ip_))

        count = 60
        while count > 0:
            new_mn_host = test_stub.get_host_by_mn_vm(
                test_lib.all_scenario_config, test_lib.scenario_file)
            if len(new_mn_host) == 1:
                test_util.test_logger(
                    "management node VM run after its former host down for 30s"
                )
                break
            elif len(new_mn_host) > 1:
                test_util.test_fail(
                    "management node VM runs on more than one host after its former host down"
                )
            time.sleep(5)
            count -= 1

        if len(new_mn_host) == 0:
            test_util.test_fail(
                "management node VM does not run after its former host down for 30s"
            )
        elif len(new_mn_host) > 1:
            test_util.test_fail(
                "management node VM runs on more than one host after its former host down"
            )

        #node_ops.wait_for_management_server_start(300)
        test_stub.wrapper_of_wait_for_management_server_start(600)

        test_stub.ensure_hosts_connected(exclude_host=[mn_host[0]])
        test_stub.ensure_bss_host_connected_from_stop(
            test_lib.scenario_file, test_lib.all_scenario_config,
            test_lib.deploy_config)
        test_stub.ensure_bss_connected()
        test_stub.ensure_pss_connected()

        if os.path.basename(
                os.environ.get('WOODPECKER_SCENARIO_CONFIG_FILE')).strip(
                ) == "scenario-config-vpc-ceph-3-sites.xml":
            pass
        else:
            vm = test_stub.create_basic_vm()
            vm.check()
            vm.destroy()
        test_stub.recover_host(mn_host[0], test_lib.all_scenario_config,
                               test_lib.deploy_config)
        test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                       test_lib.scenario_file)

    test_util.test_pass('Create VM Test Success')
def env_recover():
    test_util.test_logger("wait for mn ha ready")
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
示例#19
0
def env_recover():
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config,
                                   test_lib.scenario_file)
def env_recover():
    test_stub.reopen_host_network(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
def env_recover():
    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.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)
def env_recover():
    test_util.test_logger("recover consul on host: %s" % (mn_host[0].ip_))
    test_stub.start_consul(mn_host[0], test_lib.all_scenario_config)
    test_stub.wait_for_mn_ha_ready(test_lib.all_scenario_config, test_lib.scenario_file)