Пример #1
0
def install_prereq(ceph, timeout=1800, skip_subscription=False, repo=False, rhbuild=None):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd='while [ ! -f /ceph-qa-ready ]; do sleep 15; done')
    log.info("cloud config to completed on " + ceph.hostname)

    update_ca_cert(ceph, 'https://password.corp.redhat.com/RH-IT-Root-CA.crt')
    distro_info = ceph.distro_info
    distro_ver = distro_info['VERSION_ID']
    log.info('distro name: {name}'.format(name=distro_info['NAME']))
    log.info('distro id: {id}'.format(id=distro_info['ID']))
    log.info('distro version_id: {version_id}'.format(version_id=distro_info['VERSION_ID']))
    if ceph.pkg_type == 'deb':
        ceph.exec_command(cmd='sudo apt-get install -y ' + deb_all_packages, long_running=True)
    else:
        # workaround: rhel 7.7's cloud-init has a bug:
        # https://bugzilla.redhat.com/show_bug.cgi?id=1748015
        ceph.exec_command(cmd='sudo systemctl restart NetworkManager.service')
        if not skip_subscription:
            setup_subscription_manager(ceph)
            enable_rhel_rpms(ceph, distro_ver)
        if repo:
            setup_addition_repo(ceph, repo)
        # TODO enable only python3 rpms on both rhel7 &rhel8 once all component suites(rhcs3,4) are comptatible
        if distro_ver.startswith('8'):
            rpm_all_packages = ' '.join(rpm_packages.get('py3'))
        else:
            rpm_all_packages = ' '.join(rpm_packages.get('py2'))
        ceph.exec_command(cmd='sudo yum install -y ' + rpm_all_packages, long_running=True)
        if ceph.role == 'client':
            ceph.exec_command(cmd='sudo yum install -y attr', long_running=True)
            ceph.exec_command(cmd='sudo pip install crefi', long_running=True)
        ceph.exec_command(cmd='sudo yum clean metadata')
        config_ntp(ceph)
    registry_login(ceph, distro_ver)
Пример #2
0
def install_prereq(ceph,
                   timeout=1800,
                   skip_subscription=False,
                   repo=False,
                   rhbuild=None):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd="while [ ! -f /ceph-qa-ready ]; do sleep 15; done")
    log.info("cloud config to completed on " + ceph.hostname)

    update_ca_cert(ceph, "https://password.corp.redhat.com/RH-IT-Root-CA.crt")
    distro_info = ceph.distro_info
    distro_ver = distro_info["VERSION_ID"]
    log.info("distro name: {name}".format(name=distro_info["NAME"]))
    log.info("distro id: {id}".format(id=distro_info["ID"]))
    log.info("distro version_id: {version_id}".format(
        version_id=distro_info["VERSION_ID"]))
    if ceph.pkg_type == "deb":
        ceph.exec_command(cmd="sudo apt-get install -y " + deb_all_packages,
                          long_running=True)
    else:
        # workaround: rhel 7.7's cloud-init has a bug:
        # https://bugzilla.redhat.com/show_bug.cgi?id=1748015
        ceph.exec_command(cmd="sudo systemctl restart NetworkManager.service")
        if not skip_subscription:
            setup_subscription_manager(ceph)
            enable_rhel_rpms(ceph, distro_ver)
        if repo:
            setup_addition_repo(ceph, repo)
        # TODO enable only python3 rpms on both rhel7 &rhel8 once all component suites(rhcs3,4) are comptatible
        if distro_ver.startswith("8"):
            rpm_all_packages = rpm_packages.get("py3")
            if str(rhbuild).startswith("5"):
                rpm_all_packages = rpm_packages.get("py3") + ["lvm2", "podman"]
            rpm_all_packages = " ".join(rpm_all_packages)
        else:
            rpm_all_packages = " ".join(rpm_packages.get("py2"))
        ceph.exec_command(cmd="sudo yum install -y " + rpm_all_packages,
                          long_running=True)
        if ceph.role == "client":
            ceph.exec_command(cmd="sudo yum install -y attr",
                              long_running=True)
            ceph.exec_command(cmd="sudo pip install crefi", long_running=True)
        ceph.exec_command(cmd="sudo yum clean metadata")
        config_ntp(ceph)
    registry_login(ceph, distro_ver)
Пример #3
0
def install_prereq(ceph,
                   timeout=1800,
                   skip_subscription=False,
                   repo=False,
                   rhbuild=None):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd='while [ ! -f /ceph-qa-ready ]; do sleep 15; done')
    log.info("cloud config to completed on " + ceph.hostname)
    # workaround ,as there is bug on cloud-init which comes with rhel7.7 deployments
    # https://bugzilla.redhat.com/show_bug.cgi?id=1748015
    ceph.exec_command(cmd='sudo systemctl restart NetworkManager.service')
    update_ca_cert(ceph, 'https://password.corp.redhat.com/RH-IT-Root-CA.crt')
    update_ca_cert(ceph, 'https://password.corp.redhat.com/legacy.crt')
    distro_info = ceph.distro_info
    distro_ver = distro_info['VERSION_ID']
    log.info('distro name: {name}'.format(name=distro_info['NAME']))
    log.info('distro id: {id}'.format(id=distro_info['ID']))
    log.info('distro version_id: {version_id}'.format(
        version_id=distro_info['VERSION_ID']))
    if ceph.pkg_type == 'deb':
        ceph.exec_command(cmd='sudo apt-get install -y ' + deb_all_packages,
                          long_running=True)
    else:
        if not skip_subscription:
            setup_subscription_manager(ceph)
            enable_rhel_rpms(ceph, distro_ver)
        if repo:
            setup_addition_repo(ceph, repo)
        if distro_ver.startswith('8'):
            rpm_all_packages = ' '.join(rpm_packages.get('py3'))
        else:
            rpm_all_packages = ' '.join(rpm_packages.get('py2'))
        ceph.exec_command(cmd='sudo yum install -y ' + rpm_all_packages,
                          long_running=True)
        if ceph.role == 'client':
            ceph.exec_command(cmd='sudo yum install -y attr',
                              long_running=True)
            ceph.exec_command(cmd='sudo pip install crefi', long_running=True)
        # install epel package
        ceph.exec_command(cmd='sudo yum clean metadata')
        # finally install python2-pip directly using rpm since its available only in epel
        install_pip(ceph)
        config_ntp(ceph)
Пример #4
0
def install_prereq(ceph, timeout=1800, skip_subscription=False, repo=False, rhbuild=None):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd='while [ ! -f /ceph-qa-ready ]; do sleep 15; done')
    log.info("cloud config to completed on " + ceph.hostname)
    update_ca_cert(ceph, 'https://password.corp.redhat.com/RH-IT-Root-CA.crt')
    update_ca_cert(ceph, 'https://password.corp.redhat.com/legacy.crt')
    if ceph.pkg_type == 'deb':
        ceph.exec_command(cmd='sudo apt-get install -y ' + deb_all_pkgs, long_running=True)
    else:
        if not skip_subscription:
            setup_subscription_manager(ceph)
        if repo:
            setup_addition_repo(ceph, repo)
        ceph.exec_command(cmd='sudo yum install -y ' + rpm_all_pkgs, long_running=True)
        if ceph.role == 'client':
            ceph.exec_command(cmd='sudo yum install -y attr', long_running=True)
            ceph.exec_command(cmd='sudo pip install crefi', long_running=True)

        # install epel package
        ceph.exec_command(cmd='sudo yum clean metadata')
        # finally install python2-pip directly using rpm since its available only in epel
        install_pip(ceph)
        config_ntp(ceph)
Пример #5
0
def install_prereq(
    ceph,
    timeout=1800,
    skip_subscription=False,
    repo=False,
    rhbuild=None,
    enable_eus=False,
    skip_enabling_rhel_rpms=False,
    is_production=False,
    cloud_type="openstack",
):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd="while [ ! -f /ceph-qa-ready ]; do sleep 15; done")
    log.info("cloud config to completed on " + ceph.hostname)

    # Update certs
    update_ca_cert(
        node=ceph,
        cert_url="https://password.corp.redhat.com/RH-IT-Root-CA.crt",
        out_file="RH-IT-Root-CA.crt",
        check_ec=False,
    )

    # Update CephCI Cert to all nodes. Useful when creating self-signed certificates.
    update_ca_cert(
        node=ceph,
        cert_url=
        "http://magna002.ceph.redhat.com/cephci-jenkins/.cephqe-ca.pem",
        out_file="cephqe-ca.pem",
        check_ec=False,
    )
    distro_info = ceph.distro_info
    distro_ver = distro_info["VERSION_ID"]
    log.info("distro name: {name}".format(name=distro_info["NAME"]))
    log.info("distro id: {id}".format(id=distro_info["ID"]))
    log.info("distro version_id: {version_id}".format(
        version_id=distro_info["VERSION_ID"]))
    # Remove apache-arrow.repo for baremtal
    cmd_remove_apache_arrow = "sudo rm -f /etc/yum.repos.d/apache-arrow.repo"
    ceph.exec_command(cmd=cmd_remove_apache_arrow)

    if ceph.pkg_type == "deb":
        ceph.exec_command(cmd="sudo apt-get install -y " + deb_all_packages,
                          long_running=True)
    else:
        if distro_ver.startswith("7"):
            ceph.exec_command(
                cmd="sudo systemctl restart NetworkManager.service")

        if not skip_subscription:
            setup_subscription_manager(ceph, is_production, cloud_type)

            if not skip_enabling_rhel_rpms:
                if enable_eus:
                    enable_rhel_eus_rpms(ceph, distro_ver, cloud_type)
                else:
                    enable_rhel_rpms(ceph, distro_ver)
            else:
                log.info(
                    "Skipped enabling the RHEL RPM's provided by Subscription")

        if repo:
            setup_addition_repo(ceph, repo)

        ceph.exec_command(cmd="sudo yum -y upgrade", check_ec=False)

        rpm_all_packages = " ".join(rpm_packages.get("all"))
        if distro_ver.startswith("7"):
            rpm_all_packages = " ".join(rpm_packages.get("7"))

        ceph.exec_command(cmd=f"sudo yum install -y {rpm_all_packages}",
                          long_running=True)

        # Restarting the node for qdisc filter to be loaded. This is required for
        # RHEL-8
        if not distro_ver.startswith("7"):
            # Avoiding early channel close and ignoring channel exception thrown during
            # reboot
            time.sleep(10)
            ceph.exec_command(sudo=True, cmd="reboot", check_ec=False)

            # Sleep before and after reconnect
            time.sleep(60)
            ceph.reconnect()
            time.sleep(10)

        if skip_enabling_rhel_rpms and skip_subscription:
            # Ansible is required for RHCS 4.x
            if distro_ver.startswith("8"):
                ceph.exec_command(
                    sudo=True,
                    cmd=
                    "yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm",
                    check_ec=False,
                )
                ceph.exec_command(sudo=True,
                                  cmd="yum install -y ansible-2.9.27-1.el8")

            if distro_ver.startswith("7"):
                ceph.exec_command(
                    sudo=True,
                    cmd=
                    "yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm",
                    check_ec=False,
                )
                ceph.exec_command(sudo=True,
                                  cmd="yum install -y ansible-2.9.27-1.el7")

        if ceph.role == "client":
            ceph.exec_command(cmd="sudo yum install -y attr gcc",
                              long_running=True)
            ceph.exec_command(cmd="sudo pip install crefi", long_running=True)

        ceph.exec_command(cmd="sudo yum clean all")
        config_ntp(ceph, cloud_type)

    registry_login(ceph, distro_ver)
    update_iptables(ceph)
Пример #6
0
def install_prereq(
    ceph,
    timeout=1800,
    skip_subscription=False,
    repo=False,
    rhbuild=None,
    enable_eus=False,
    skip_enabling_rhel_rpms=False,
    is_production=False,
    cloud_type="openstack",
):
    log.info("Waiting for cloud config to complete on " + ceph.hostname)
    ceph.exec_command(cmd="while [ ! -f /ceph-qa-ready ]; do sleep 15; done")
    log.info("cloud config to completed on " + ceph.hostname)

    # Update certs
    update_ca_cert(
        node=ceph,
        cert_url="https://password.corp.redhat.com/RH-IT-Root-CA.crt",
        out_file="RH-IT-Root-CA.crt",
        check_ec=False,
    )

    # Update CephCI Cert to all nodes. Useful when creating self-signed certificates.
    update_ca_cert(
        node=ceph,
        cert_url=
        "http://magna002.ceph.redhat.com/cephci-jenkins/.cephqe-ca.pem",
        out_file="cephqe-ca.pem",
        check_ec=False,
    )
    distro_info = ceph.distro_info
    distro_ver = distro_info["VERSION_ID"]
    log.info("distro name: {name}".format(name=distro_info["NAME"]))
    log.info("distro id: {id}".format(id=distro_info["ID"]))
    log.info("distro version_id: {version_id}".format(
        version_id=distro_info["VERSION_ID"]))
    if ceph.pkg_type == "deb":
        ceph.exec_command(cmd="sudo apt-get install -y " + deb_all_packages,
                          long_running=True)
    else:
        # workaround: rhel 7.7's cloud-init has a bug:
        # https://bugzilla.redhat.com/show_bug.cgi?id=1748015
        ceph.exec_command(cmd="sudo systemctl restart NetworkManager.service")
        if not skip_subscription:
            setup_subscription_manager(ceph, is_production, cloud_type)

            if not skip_enabling_rhel_rpms:
                if enable_eus:
                    enable_rhel_eus_rpms(ceph, distro_ver, cloud_type)
                else:
                    enable_rhel_rpms(ceph, distro_ver)
            else:
                log.info(
                    "Skipped enabling the RHEL RPM's provided by Subscription")
        if repo:
            setup_addition_repo(ceph, repo)
        # TODO enable only python3 rpms on both rhel7 &rhel8 once all component
        #  suites(rhcs3,4) are compatible
        if distro_ver.startswith("8"):
            rpm_all_packages = rpm_packages.get("py3") + ["net-tools"]
            if str(rhbuild).startswith("5"):
                rpm_all_packages = rpm_packages.get("py3") + ["lvm2", "podman"]
            rpm_all_packages = " ".join(rpm_all_packages)
        else:
            rpm_all_packages = " ".join(rpm_packages.get("py2"))
        ceph.exec_command(cmd="sudo yum install -y " + rpm_all_packages,
                          long_running=True)
        if ceph.role == "client":
            ceph.exec_command(cmd="sudo yum install -y attr",
                              long_running=True)
            ceph.exec_command(cmd="sudo pip install crefi", long_running=True)
        ceph.exec_command(cmd="sudo yum clean metadata")
        config_ntp(ceph, cloud_type)

    registry_login(ceph, distro_ver)