def uninstall_only_vrouter_node(manage_nova_compute='yes', *args):
    """Uninstalls only vrouter pkgs in one or list of nodes. USAGE:fab uninstall_vrouter_node:[email protected],[email protected]
       If manage_nova_compute = no, User has to uninstall nova-compute in the compute node.
    """
    for host_string in args:
        ostype = detect_ostype()
        with  settings(host_string=host_string):
            manage_nova_compute = 'no'
            if is_package_installed('contrail-openstack-vrouter'):
                manage_nova_compute = 'yes'
            pkgs = get_compute_pkgs(manage_nova_compute)
            if ostype == 'ubuntu':
                if is_ceilometer_compute_install_supported():
                    pkgs.append('ceilometer-agent-compute')
                apt_uninstall(pkgs)
                sudo("sed -i  's/inet manual/inet dhcp/g' /etc/network/interfaces")
            else:
                pkgs = get_pkg_list()
                yum_uninstall(pkgs)
            with cd('/etc/'):
                sudo('sudo rm -rf libvirt')
                with settings(warn_only=True):
                    cmds = ['find ./contrail/*'
                            '! -iname "contrail_ifrename.sh"',
                            '! -iname "debs_list.txt"',
                            '! -iname "rpm_list.txt"',
                            '-delete',
                           ]
                    sudo(' '.join(cmds))
            with cd('/var/'):
                sudo('sudo rm -rf crashes')
                sudo('sudo rm -rf tmp')
            with cd('/var/log'):
                sudo('sudo rm -rf contrail/*')
            undo_setup_hugepages()
def uninstall_only_vrouter_node(manage_nova_compute="yes", *args):
    """Uninstalls only vrouter pkgs in one or list of nodes. USAGE:fab uninstall_vrouter_node:[email protected],[email protected]
       If manage_nova_compute = no, User has to uninstall nova-compute in the compute node.
    """
    for host_string in args:
        ostype = detect_ostype()
        with settings(host_string=host_string):
            manage_nova_compute = "no"
            if is_package_installed("contrail-openstack-vrouter"):
                manage_nova_compute = "yes"
            pkgs = get_compute_pkgs(manage_nova_compute)
            if ostype == "ubuntu":
                if is_ceilometer_compute_install_supported():
                    pkgs.append("ceilometer-agent-compute")
                apt_uninstall(pkgs)
                sudo("sed -i  's/inet manual/inet dhcp/g' /etc/network/interfaces")
            else:
                pkgs = get_pkg_list()
                yum_uninstall(pkgs)
            with cd("/etc/"):
                sudo("sudo rm -rf libvirt")
                with settings(warn_only=True):
                    cmds = [
                        "find ./contrail/*" '! -iname "contrail_ifrename.sh"',
                        '! -iname "debs_list.txt"',
                        '! -iname "rpm_list.txt"',
                        "-delete",
                    ]
                    sudo(" ".join(cmds))
            with cd("/var/"):
                sudo("sudo rm -rf crashes")
                sudo("sudo rm -rf tmp")
            with cd("/var/log"):
                sudo("sudo rm -rf contrail/*")
def upgrade_compute_node(from_rel, pkg, *args, **kwargs):
    """Upgrades compute pkgs in one or list of nodes. USAGE:fab upgrade_compute_node:[email protected],[email protected]"""
    for host_string in args:
        with settings(host_string=host_string):
            execute('install_pkg_node', pkg, host_string)
            execute('create_install_repo_node', host_string)
            pkg_install(['contrail-setup'])
            configure_nova = kwargs.get('configure_nova', 'yes')
            manage_nova_compute = kwargs.get('manage_nova_compute', 'yes')

            if (env.host_string in get_tsn_nodes() or
                get_orchestrator() == 'vcenter'):
                manage_nova_compute='no'

            # Identify packages to upgrade
            cmd = frame_vnc_compute_cmd(
                      host_string, 'upgrade-vnc-compute',
                      configure_nova=configure_nova,
                      manage_nova_compute=manage_nova_compute)
            if ('vcenter_compute' in env.roledefs and 
                    env.host_string in env.roledefs['vcenter_compute']):
                pkgs = get_vcenter_compute_pkgs() 
                roles = ['vcenter_compute']
            else:
                pkgs = get_compute_pkgs(manage_nova_compute=manage_nova_compute)
                if (getattr(env, 'interface_rename', True) and
                    detect_ostype() not in ['ubuntu', 'redhat']):
                    pkgs.append('contrail-interface-name')
                if LooseVersion(from_rel) <= LooseVersion('3.2.0.0'):
                    dist, version, extra = get_linux_distro()
                    if version == '14.04':
                       if 'contrail-vrouter-3.13.0-40-generic' in pkgs:
                          pkgs.remove('contrail-vrouter-3.13.0-40-generic')
                       if 'contrail-vrouter-3.13.0-85-generic' in pkgs:
                          pkgs.remove('contrail-vrouter-3.13.0-85-generic')
                       if 'contrail-vrouter-3.13.0-100-generic' in pkgs:
                          pkgs.remove('contrail-vrouter-3.13.0-100-generic')
                       if 'contrail-vrouter-3.13.0-106-generic' in pkgs:
                          pkgs.remove('contrail-vrouter-3.13.0-106-generic')
                       pkgs.append('contrail-vrouter-3.13.0-106-generic')
                # Identify roles of this node.
                roles = ['compute']
                if env.host_string in get_tsn_nodes():
                   roles.append('tsn')
                if env.host_string in get_toragent_nodes():
                   roles.append('toragent')

            cmd += ' -P %s' % ' '.join(pkgs)
            cmd += ' -F %s' % from_rel
            cmd += ' -T %s' % get_release()
            cmd += ' -R %s' % ' '.join(roles)
            sudo(cmd)
def install_only_vrouter_node(manage_nova_compute='yes', *args):
    """Installs only vrouter pkgs in one or list of nodes. USAGE:fab install_vrouter_node:[email protected],[email protected]
       If manage_nova_compute = no, User has to install nova-compute in the compute node.
    """
    for host_string in args:
        with  settings(host_string=host_string):
            ostype = detect_ostype()
            pkgs = get_compute_pkgs(manage_nova_compute)

            if ostype == 'ubuntu':
                sudo('echo "manual" >> /etc/init/supervisor-vrouter.override')
                apt_install(pkgs)
            else:
                yum_install(pkgs)
            install_ceilometer_compute_node(host_string)
Example #5
0
def install_only_vrouter_node(manage_nova_compute='yes', *args):
    """Installs only vrouter pkgs in one or list of nodes. USAGE:fab install_vrouter_node:[email protected],[email protected]
       If manage_nova_compute = no, User has to install nova-compute in the compute node.
    """
    for host_string in args:
        with  settings(host_string=host_string):
            ostype = detect_ostype()
            pkgs = get_compute_pkgs(manage_nova_compute)

            if ostype == 'ubuntu':
                sudo('echo "manual" >> /etc/init/supervisor-vrouter.override')
                apt_install(pkgs)
            else:
                yum_install(pkgs)
            install_ceilometer_compute_node(host_string)
Example #6
0
def uninstall_only_vrouter_node(manage_nova_compute='yes', *args):
    """Uninstalls only vrouter pkgs in one or list of nodes. USAGE:fab uninstall_vrouter_node:[email protected],[email protected]
       If manage_nova_compute = no, User has to uninstall nova-compute in the compute node.
    """
    for host_string in args:
        ostype = detect_ostype()
        with settings(host_string=host_string):
            manage_nova_compute = 'no'
            if is_package_installed('contrail-openstack-vrouter'):
                manage_nova_compute = 'yes'
            pkgs = get_compute_pkgs(manage_nova_compute)
            if ostype == 'ubuntu':
                if is_ceilometer_compute_install_supported():
                    pkgs.append('ceilometer-agent-compute')
                apt_uninstall(pkgs)
                sudo(
                    "sed -i  's/inet manual/inet dhcp/g' /etc/network/interfaces"
                )
                # Delete vhost0 interface
                sudo("""sed -ri.bak '
                        /^auto vhost0/ d
                        /^iface vhost0/,/^(\w|$)/ {
                            /iface vhost0/ d
                            /^\s/ d
                        }
                    ' /etc/network/interfaces""")
                # Remove SR-IOV configuration
                sudo("sed -i.bak '/sriov_numvfs/ d' /etc/rc.local")
            else:
                pkgs = get_pkg_list()
                yum_uninstall(pkgs)
            with cd('/etc/'):
                sudo('sudo rm -rf libvirt')
                with settings(warn_only=True):
                    cmds = [
                        'find ./contrail/*'
                        '! -iname "contrail_ifrename.sh"',
                        '! -iname "debs_list.txt"',
                        '! -iname "rpm_list.txt"',
                        '-delete',
                    ]
                    sudo(' '.join(cmds))
            with cd('/var/'):
                sudo('sudo rm -rf crashes')
                sudo('sudo rm -rf tmp')
            with cd('/var/log'):
                sudo('sudo rm -rf contrail/*')
            undo_setup_hugepages()
Example #7
0
def upgrade_compute_node(from_rel, pkg, *args, **kwargs):
    """Upgrades compute pkgs in one or list of nodes. USAGE:fab upgrade_compute_node:[email protected],[email protected]"""
    for host_string in args:
        with settings(host_string=host_string):
            execute("install_pkg_node", pkg, host_string)
            execute("create_install_repo_node", host_string)
            pkg_install(["contrail-setup"])
            configure_nova = kwargs.get("configure_nova", "yes")
            manage_nova_compute = kwargs.get("manage_nova_compute", "yes")

            if env.host_string in get_tsn_nodes() or get_orchestrator() == "vcenter":
                manage_nova_compute = "no"

            # Identify packages to upgrade
            cmd = frame_vnc_compute_cmd(
                host_string,
                "upgrade-vnc-compute",
                configure_nova=configure_nova,
                manage_nova_compute=manage_nova_compute,
            )
            if "vcenter_compute" in env.roledefs and env.host_string in env.roledefs["vcenter_compute"]:
                pkgs = get_vcenter_compute_pkgs()
                roles = ["vcenter_compute"]
            else:
                pkgs = get_compute_pkgs(manage_nova_compute=manage_nova_compute)
                if getattr(env, "interface_rename", True) and detect_ostype() not in ["ubuntu", "redhat"]:
                    pkgs.append("contrail-interface-name")
                if LooseVersion(from_rel) <= LooseVersion("3.0.2.0"):
                    dist, version, extra = get_linux_distro()
                    if version == "14.04" and "contrail-vrouter-3.13.0-40-generic" in pkgs:
                        pkgs.remove("contrail-vrouter-3.13.0-40-generic")
                        pkgs.append("contrail-vrouter-3.13.0-85-generic")
                # Identify roles of this node.
                roles = ["compute"]
                if env.host_string in get_tsn_nodes():
                    roles.append("tsn")
                if env.host_string in get_toragent_nodes():
                    roles.append("toragent")

            cmd += " -P %s" % " ".join(pkgs)
            cmd += " -F %s" % from_rel
            cmd += " -T %s" % get_release()
            cmd += " -R %s" % " ".join(roles)
            sudo(cmd)