def install_vcenter_compute_node(*args):
    """Installs nova compute in all nodes defined in vcenter_compute role."""
    for host_string in args:
        with  settings(host_string=host_string):
              ostype = detect_ostype()
              pkgs = get_vcenter_compute_pkgs()

              if ostype == 'ubuntu':
                 apt_install(pkgs)
              else:
                 yum_install(pkgs)
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)
Example #3
0
def install_vcenter_compute_node(*args):
    """Installs nova compute in all nodes defined in vcenter_compute role."""
    for host_string in args:
        with  settings(host_string=host_string):
              ostype = detect_ostype()
              pkgs = get_vcenter_compute_pkgs()

              if ostype == 'ubuntu':
                 apt_install(pkgs)
              else:
                 yum_install(pkgs)

              if 'vcenter_compute' in env.roledefs:
                 pkg = get_vcenter_plugin_pkg()
                 install_contrail_vcenter_plugin(pkg)
Example #4
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)