def add_secondary_storage_domains(prefix):
    if MASTER_SD_TYPE == 'iscsi':
        vt = utils.VectorThread(
            [
                functools.partial(import_non_template_from_glance, prefix),
                functools.partial(import_template_from_glance, prefix),
                functools.partial(add_nfs_storage_domain, prefix),
                functools.partial(add_iso_storage_domain, prefix),
                functools.partial(add_templates_storage_domain, prefix),
                functools.partial(add_second_nfs_storage_domain, prefix),
            ],
        )
    else:
        vt = utils.VectorThread(
            [
                functools.partial(import_non_template_from_glance, prefix),
                functools.partial(import_template_from_glance, prefix),
                functools.partial(add_iscsi_storage_domain, prefix),
                functools.partial(add_iso_storage_domain, prefix),
                functools.partial(add_templates_storage_domain, prefix),
                functools.partial(add_second_nfs_storage_domain, prefix),
            ],
        )
    vt.start_all()
    vt.join_all()
def add_secondary_storage_domains(prefix):
    if MASTER_SD_TYPE == 'iscsi':
        vt = utils.VectorThread(
            [
                functools.partial(add_nfs_storage_domain, prefix),
                # 12/07/2017 commenting out iso domain creation until we know why it causing random failures
                # Bug-Url: http://bugzilla.redhat.com/1463263
                #                functools.partial(add_iso_storage_domain, prefix),
                functools.partial(add_templates_storage_domain, prefix),
                functools.partial(add_second_nfs_storage_domain, prefix),
                functools.partial(import_non_template_from_glance, prefix),
                functools.partial(import_template_from_glance, prefix),
            ], )
    else:
        vt = utils.VectorThread(
            [
                functools.partial(add_iscsi_storage_domain, prefix),
                # 12/07/2017 commenting out iso domain creation until we know why it causing random failures
                #Bug-Url: http://bugzilla.redhat.com/1463263
                #                functools.partial(add_iso_storage_domain, prefix),
                functools.partial(add_templates_storage_domain, prefix),
                functools.partial(add_second_nfs_storage_domain, prefix),
                functools.partial(import_non_template_from_glance, prefix),
                functools.partial(import_template_from_glance, prefix),
            ], )
    vt.start_all()
    vt.join_all()
def disk_operations(api):
    vt = utils.VectorThread([
        functools.partial(live_storage_migration),
        functools.partial(snapshot_cold_merge, api),
    ], )
    vt.start_all()
    vt.join_all()
def add_glance_storage(prefix):
    vt = utils.VectorThread([
        functools.partial(import_non_template_from_glance, prefix),
        functools.partial(import_template_from_glance, prefix),
    ], )
    vt.start_all()
    vt.join_all()
Exemple #5
0
def assign_hosts_network_label(api):
    """
    Assigns NETWORK_LABEL to first network interface of every host in cluster
    """
    engine = api.system_service()

    def _assign_host_network_label(host):
        host_service = engine.hosts_service().host_service(id=host.id)
        nics_service = host_service.nics_service()
        nics = sorted(nics_service.list(),
                      key=lambda n: n.name)
        nt.assert_greater_equal(len(nics), 1)
        nic = nics[0]
        nic_service = nics_service.nic_service(id=nic.id)
        labels_service = nic_service.network_labels_service()
        return labels_service.add(
                NetworkLabel(
                    id=NETWORK_LABEL,
                    host_nic=nic
                )
            )

    hosts = test_utils.hosts_in_cluster_v4(engine, CLUSTER_NAME)
    vec = utils.func_vector(_assign_host_network_label, [(h,) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))
Exemple #6
0
def test_disk_operations(api_v4):
    vt = utils.VectorThread([
        functools.partial(cold_storage_migration, api_v4),
        functools.partial(snapshot_cold_merge, api_v4),
    ], )
    vt.start_all()
    vt.join_all()
def metrics_and_log_collector(prefix):
    vt = utils.VectorThread([
        functools.partial(configure_metrics, prefix),
        functools.partial(run_log_collector, prefix),
    ], )
    vt.start_all()
    vt.join_all()
Exemple #8
0
def add_hosts(prefix):
    api = prefix.virt_env.engine_vm().get_api()

    def _add_host(vm):
        p = params.Host(
            name=vm.name(),
            address=vm.ip(),
            cluster=params.Cluster(
                name=CLUSTER_NAME,
            ),
            root_password=vm.root_password(),
            override_iptables=True,
        )

        return api.hosts.add(p)

    def _host_is_up():
        cur_state = api.hosts.get(host.name()).status.state

        if cur_state == 'up':
            return True

        if cur_state == 'install_failed':
            raise RuntimeError('Host %s failed to install' % host.name())

    hosts = prefix.virt_env.host_vms()
    vec = utils.func_vector(_add_host, [(h,) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))

    for host in hosts:
        testlib.assert_true_within(_host_is_up, timeout=15 * 60)
def snapshots_merge(api):
    vt = utils.VectorThread([
        functools.partial(snapshot_live_merge, api),
        functools.partial(snapshot_cold_merge, api),
    ], )
    vt.start_all()
    vt.join_all()
def add_hosts(prefix):
    api = prefix.virt_env.engine_vm().get_api()

    def _add_host(vm):
        p = params.Host(
            name=vm.name(),
            address=vm.ip(),
            cluster=params.Cluster(
                name=CLUSTER_NAME,
            ),
            root_password=vm.root_password(),
            override_iptables=True,
        )

        return api.hosts.add(p)

    hosts = prefix.virt_env.host_vms()
    vec = utils.func_vector(_add_host, [(h,) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))

    for host in hosts:
        testlib.assert_true_within(
            lambda: api.hosts.get(host.name()).status.state == 'up',
            timeout=15 * 60,
        )
def add_secondary_storage_domains(prefix):
    vt = utils.VectorThread([
        functools.partial(import_non_template_from_glance, prefix),
        functools.partial(import_template_from_glance, prefix),
        functools.partial(add_datastore_storage_domain, prefix),
    ], )
    vt.start_all()
    vt.join_all()
Exemple #12
0
def add_glance_images(prefix):
    api = prefix.virt_env.engine_vm().get_api()
    glance_provider = api.storagedomains.get(SD_GLANCE_NAME)

    vt = utils.VectorThread([
        functools.partial(import_non_template_from_glance, glance_provider),
        functools.partial(import_template_from_glance, glance_provider),
    ], )
    vt.start_all()
    vt.join_all()
Exemple #13
0
def install_cockpit_ovirt(prefix):
    def _install_cockpit_ovirt_on_host(host):
        ret = host.ssh(['yum', '-y', 'install', 'cockpit-ovirt-dashboard'])
        nt.assert_equals(ret.code, 0, '_install_cockpit_ovirt_on_host(): failed to install cockpit-ovirt-dashboard on host %s' % host)
        return True

    hosts = prefix.virt_env.host_vms()
    vec = utils.func_vector(_install_cockpit_ovirt_on_host, [(h,) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()), 'not all threads finished: %s' % vt)
def add_glance_storage(prefix, api):
    engine = api.system_service()
    vt = utils.VectorThread([
        functools.partial(import_non_template_from_glance, prefix),
        functools.partial(import_template_from_glance, prefix),
    ], )
    vt.start_all()
    vt.join_all()

    with test_utils.TestEvent(engine, 3018):
        print('done adding disk')
def assign_hosts_network_label(api):
    """
    Assigns NETWORK_LABEL to first network interface of every host in cluster
    """
    def _assign_host_network_label(host):
        nics = host.nics.list()
        nt.assert_greater_equal(len(nics), 1)
        nic = nics[0]
        return nic.labels.add(params.Label(id=NETWORK_LABEL, host_nic=nic))

    hosts = _hosts_in_cluster(CLUSTER_NAME)
    vec = utils.func_vector(_assign_host_network_label, [(h, ) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))
def add_hosts_3(api, hosts):
    def _add_host(vm):
        p = params.Host(
            name=vm.name(),
            address=vm.ip(),
            cluster=params.Cluster(name=CLUSTER_NAME, ),
            root_password=vm.root_password(),
            override_iptables=True,
        )

        return api.hosts.add(p)

    vec = utils.func_vector(_add_host, [(h, ) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))
Exemple #17
0
def add_hosts(prefix):
    api = prefix.virt_env.engine_vm().get_api_v4()
    hosts_service = api.system_service().hosts_service()

    def _add_host_4(vm):
        return hosts_service.add(
            sdk4.types.Host(
                name=vm.name(),
                description='host %s' % vm.name(),
                address=vm.name(),
                root_password=str(vm.root_password()),
                override_iptables=True,
                cluster=sdk4.types.Cluster(name=CLUSTER_NAME, ),
            ), )

    def _host_is_up_4():
        host_service = hosts_service.host_service(api_host.id)
        host_obj = host_service.get()

        if host_obj.status == sdk4.types.HostStatus.INSTALLING:
            return False

        if host_obj.status == sdk4.types.HostStatus.UP:
            return True

        if host_obj.status == sdk4.types.HostStatus.NON_OPERATIONAL:
            raise RuntimeError('Host %s is in non operational state' %
                               api_host.name)
        if host_obj.status == sdk4.types.HostStatus.INSTALL_FAILED:
            raise RuntimeError('Host %s installation failed' % api_host.name)
        if host_obj.status == sdk4.types.HostStatus.NON_RESPONSIVE:
            raise RuntimeError('Host %s is in non responsive state' %
                               api_host.name)

    hosts = prefix.virt_env.host_vms()
    vec = utils.func_vector(_add_host_4, [(h, ) for h in hosts])
    vt = utils.VectorThread(vec)
    vt.start_all()
    nt.assert_true(all(vt.join_all()))

    api_hosts = hosts_service.list()
    for api_host in api_hosts:
        testlib.assert_true_within(_host_is_up_4,
                                   timeout=constants.ADD_HOST_TIMEOUT)

    for host in hosts:
        host.ssh(['rm', '-rf', '/dev/shm/yum', '/dev/shm/*.rpm'])