コード例 #1
0
def setup_first_provider():
    providers.setup_a_provider(prov_class="infra",
                               validate=True,
                               check_existing=True)
    providers.setup_a_provider(prov_class="cloud",
                               validate=True,
                               check_existing=True)
コード例 #2
0
def test_db_restore(request, soft_assert):

    appl1, appl2 = get_appliances()

    def finalize():
        appl1.destroy()
        appl2.destroy()
    request.addfinalizer(finalize)

    appl1.ipapp.browser_steal = True
    with appl1.ipapp:
        # Manage infra,cloud providers and set some roles before taking a DB backup
        config.set_server_roles(automate=True)
        roles = config.get_server_roles()
        provider_crud = setup_a_provider('infra', 'virtualcenter', validate=True)
        provider_mgmt = provider_crud.get_mgmt_system()
        wait_for_a_provider()
        setup_a_provider('cloud', 'ec2', validate=True)
        cloud_provider.wait_for_a_provider()

        providers_appl1 = appl1.ipapp.managed_providers
        appl1.ipapp.backup_database()

    # Fetch v2_key and DB backup from the first appliance
    with appl1.ipapp.ssh_client as ssh:
        rand_filename = "/tmp/v2_key_{}".format(fauxfactory.gen_alphanumeric())
        ssh.get_file("/var/www/miq/vmdb/certs/v2_key", rand_filename)
        dump_filename = "/tmp/db_dump_{}".format(fauxfactory.gen_alphanumeric())
        ssh.get_file("/tmp/evm_db.backup", dump_filename)

    with appl2.ipapp.ssh_client as ssh:
        ssh.put_file(rand_filename, "/var/www/miq/vmdb/certs/v2_key")
        ssh.put_file(dump_filename, "/tmp/evm_db.backup")

    appl2.ipapp.browser_steal = True
    with appl2.ipapp:
        # Restore DB on the second appliance
        appl2.ipapp.restore_database()
        appl2.ipapp.wait_for_web_ui()
        wait_for_a_provider()
        cloud_provider.wait_for_a_provider()

        # Assert providers on the second appliance
        providers_appl2 = appl2.ipapp.managed_providers
        assert set(providers_appl2).issubset(providers_appl1),\
            'Restored DB is missing some providers'

        # Verify that existing provider can detect new VMs on the second appliance
        vm = provision_vm(request, provider_crud, provider_mgmt)
        soft_assert(vm.find_quadicon().state == 'currentstate-on')
        soft_assert(vm.provider_crud.get_mgmt_system().is_vm_running(vm.name),
            "vm running")

        # Assert server roles on the second appliance
        for role, is_enabled in config.get_server_roles(db=False).iteritems():
            if is_enabled:
                assert roles[role], "Role '%s' is selected but should not be" % role
            else:
                assert not roles[role], "Role '%s' is not selected but should be" % role
コード例 #3
0
def providers():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_class="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    pytest.sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
コード例 #4
0
def vms():
    """Ensure the infra providers are set up and get list of vms"""
    try:
        setup_a_provider(prov_class="infra", required_keys=["large"])
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    navigate_to(Vm, 'VMsOnly')
    search.ensure_no_filter_applied()
    return virtual_machines.get_all_vms()
コード例 #5
0
def providers():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_type="infra")
    except Exception:
        pytest.skip(
            "It's not possible to set up any providers, therefore skipping")
    sel.force_navigate("infrastructure_providers")
    search.ensure_no_filter_applied()
コード例 #6
0
def vms():
    """Ensure the infra providers are set up and get list of vms"""
    try:
        setup_a_provider(prov_type="infra", required_keys="large")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    return virtual_machines.get_all_vms()
コード例 #7
0
def hosts():
    """Ensure the infra providers are set up and get list of hosts"""
    try:
        setup_a_provider(prov_class="infra")
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
    navigate_to(Host, 'All')
    search.ensure_no_filter_applied()
    return host.get_all_hosts()
コード例 #8
0
def vms():
    """Ensure the infra providers are set up and get list of vms"""
    try:
        setup_a_provider(prov_type="infra", required_keys="large")
    except Exception:
        pytest.skip(
            "It's not possible to set up any providers, therefore skipping")
    pytest.sel.force_navigate("infra_vms")
    search.ensure_no_filter_applied()
    return virtual_machines.get_all_vms()
コード例 #9
0
ファイル: test_retirement.py プロジェクト: FilipB/cfme_tests
def existing_vm(request):
    """ Fixture will be using for set\unset retirement date for existing vm instead of
    creation a new one
    """
    list_of_existing_providers = providers.existing_providers()
    if list_of_existing_providers:
        test_provider = providers.get_crud(list_of_existing_providers[0])
    else:
        test_provider = providers.setup_a_provider()
    all_vms = test_provider.mgmt.list_vm()
    need_to_create_vm = True
    for virtual_machine in all_vms:
        if test_provider.mgmt.is_vm_running(virtual_machine):
            need_vm = VM.factory(virtual_machine, test_provider)
            need_to_create_vm = False
            break
    if need_to_create_vm:
        machine_name = 'test_retire_prov_{}'.format(fauxfactory.gen_alpha(length=8).lower())
        need_vm = VM.factory(machine_name, test_provider)
        need_vm.create_on_provider(find_in_cfme=True, allow_skip="default")

    @request.addfinalizer
    def _delete_vm():
        if need_to_create_vm:
            test_provider.mgmt.delete_vm(need_vm.name)
    return need_vm
コード例 #10
0
def a_provider():
    try:
        pf = ProviderFilter(classes=[InfraProvider], required_fields=[
            ['provisioning', 'template'],
            ['provisioning', 'host'],
            ['provisioning', 'datastore'],
            ['provisioning', 'vlan'],
            ['provisioning', 'catalog_item_type']])
        return setup_a_provider(filters=[pf])
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
コード例 #11
0
def single_provider():
    """Ensure the infra provider is setup"""
    try:
        return setup_a_provider(prov_class="infra")
    except Exception as ex:
        pytest.skip("Exception while setting up providers, therefore skipping: {}".format(ex))
コード例 #12
0
def provider():
    return setup_a_provider(prov_class="infra", prov_type="virtualcenter")
コード例 #13
0
def setup_single_provider():
    setup_a_provider()
コード例 #14
0
def test_db_restore(request, soft_assert):

    appl1, appl2 = get_appliances()

    def finalize():
        appl1.destroy()
        appl2.destroy()

    request.addfinalizer(finalize)

    appl1.ipapp.browser_steal = True
    with appl1.ipapp:
        # Manage infra,cloud providers and set some roles before taking a DB backup
        config.set_server_roles(automate=True)
        roles = config.get_server_roles()
        provider_crud = setup_a_provider('infra',
                                         'virtualcenter',
                                         validate=True)
        wait_for_a_provider()
        setup_a_provider('cloud', 'ec2', validate=True)
        cloud_provider.wait_for_a_provider()

        providers_appl1 = appl1.ipapp.managed_providers
        appl1.ipapp.backup_database()

    # Fetch v2_key and DB backup from the first appliance
    with appl1.ipapp.ssh_client as ssh:
        rand_filename = "/tmp/v2_key_{}".format(fauxfactory.gen_alphanumeric())
        ssh.get_file("/var/www/miq/vmdb/certs/v2_key", rand_filename)
        dump_filename = "/tmp/db_dump_{}".format(
            fauxfactory.gen_alphanumeric())
        ssh.get_file("/tmp/evm_db.backup", dump_filename)

    with appl2.ipapp.ssh_client as ssh:
        ssh.put_file(rand_filename, "/var/www/miq/vmdb/certs/v2_key")
        ssh.put_file(dump_filename, "/tmp/evm_db.backup")

    appl2.ipapp.browser_steal = True
    with appl2.ipapp:
        # Restore DB on the second appliance
        appl2.ipapp.restore_database()
        appl2.ipapp.wait_for_web_ui()
        wait_for_a_provider()
        cloud_provider.wait_for_a_provider()

        # Assert providers on the second appliance
        providers_appl2 = appl2.ipapp.managed_providers
        assert set(providers_appl2).issubset(providers_appl1),\
            'Restored DB is missing some providers'

        # Verify that existing provider can detect new VMs on the second appliance
        vm = provision_vm(request, provider_crud)
        soft_assert(vm.find_quadicon().state == 'currentstate-on')
        soft_assert(vm.provider.mgmt.is_vm_running(vm.name), "vm running")

        # Assert server roles on the second appliance
        for role, is_enabled in config.get_server_roles(db=False).iteritems():
            if is_enabled:
                assert roles[
                    role], "Role '{}' is selected but should not be".format(
                        role)
            else:
                assert not roles[
                    role], "Role '{}' is not selected but should be".format(
                        role)
コード例 #15
0
def provider():
    return setup_a_provider(prov_class="infra", prov_type="virtualcenter")
コード例 #16
0
def setup_first_provider():
    setup_a_provider(validate=True, check_existing=True)
コード例 #17
0
def setup_first_cloud_provider():
    setup_a_provider(prov_class="cloud", validate=True, check_existing=True)
コード例 #18
0
def setup_first_provider():
    providers.setup_a_provider(prov_class="infra", validate=True, check_existing=True)
    providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)
コード例 #19
0
ファイル: provider.py プロジェクト: vprusa/cfme_tests
def any_provider_session():
    providers.clear_providers()  # To make it clean
    providers.setup_a_provider(validate=True, check_existing=True)
コード例 #20
0
ファイル: test_rest.py プロジェクト: rananda/cfme_tests
def a_provider():
    try:
        pf = ProviderFilter(classes=[VMwareProvider, RHEVMProvider])
        return setup_a_provider(filters=[pf])
    except Exception:
        pytest.skip("It's not possible to set up any providers, therefore skipping")
コード例 #21
0
def setup_infra_provider():
    return setup_a_provider(prov_class="infra", validate=True, check_existing=True,
        required_keys=['ownership_vm'])
コード例 #22
0
def provider():
    return setup_a_provider("infra")
コード例 #23
0
def test_ipappliance_managed_providers():
    ip_a = IPAppliance()
    provider = setup_a_provider(prov_class='infra')
    assert provider.key in ip_a.managed_providers
コード例 #24
0
ファイル: test_operations.py プロジェクト: FilipB/cfme_tests
def provider():
    return setup_a_provider("infra")
コード例 #25
0
ファイル: test_namespace.py プロジェクト: vprusa/cfme_tests
def setup_single_provider():
    setup_a_provider()
コード例 #26
0
def test_ipappliance_managed_providers():
    ip_a = IPAppliance()
    provider = setup_a_provider(prov_class='infra')
    assert provider.key in ip_a.managed_providers
コード例 #27
0
def setup_a_provider():
    return providers.setup_a_provider(prov_class="cloud", validate=True, check_existing=True)
コード例 #28
0
def setup_infra_provider():
    return setup_a_provider(prov_class="infra",
                            validate=True,
                            check_existing=True,
                            required_keys=['ownership_vm'])
コード例 #29
0
ファイル: provider.py プロジェクト: pombredanne/cfme_tests
def any_provider_session():
    providers.clear_providers()  # To make it clean
    providers.setup_a_provider(validate=True, check_existing=True)
コード例 #30
0
ファイル: provider.py プロジェクト: petrblaho/cfme_tests
def any_provider_session():
    providers.setup_a_provider(validate=True, check_existing=True)