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: ostype = detect_ostype() with settings(host_string=host_string): pkg = ['contrail-openstack-vrouter'] # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms if ostype in ['ubuntu']: dkms_status = get_build('contrail-vrouter-dkms') if dkms_status is not None: contrail_vrouter_pkg = 'contrail-vrouter-dkms' else: vrouter_generic_pkg = run( "apt-cache pkgnames contrail-vrouter-$(uname -r)") contrail_vrouter_pkg = vrouter_generic_pkg or 'contrail-vrouter-dkms' pkg = [contrail_vrouter_pkg, 'contrail-openstack-vrouter'] if (manage_nova_compute == 'no' and ostype in ['centos', 'redhat']): pkg = [ 'contrail-vrouter', 'abrt', #'openstack-nova-compute', 'openstack-utils', 'python-thrift', #'librabbitmq', 'contrail-nova-vif', 'contrail-setup', 'contrail-nodemgr', 'contrail-vrouter-init', ] elif (manage_nova_compute == 'no' and ostype in ['ubuntu']): pkg = [ 'contrail-nodemgr', 'contrail-setup', 'contrail-vrouter-init', #'nova-compute', 'python-iniparse', #'python-novaclient', 'contrail-nova-vif', #'librabbitmq0', 'linux-crashdump', contrail_vrouter_pkg, ] if getattr(testbed, 'haproxy', False): pkg.append('haproxy') if (ostype == 'ubuntu' and is_lbaas_enabled()): pkg.append('haproxy') pkg.append('iproute') if ostype == 'ubuntu': sudo('echo "manual" >> /etc/init/supervisor-vrouter.override') apt_install(pkg) else: yum_install(pkg)
def upgrade_vrouter_node(from_rel, pkg, *args): """Upgrades vrouter pkgs in one or list of nodes. USAGE:fab upgrade_vrouter_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): execute('backup_install_repo_node', host_string) execute('install_pkg_node', pkg, host_string) execute('create_install_repo_node', host_string) upgrade(from_rel, 'compute') ostype = detect_ostype() if (ostype == 'ubuntu' and is_lbaas_enabled()): sudo( "apt-get -o Dpkg::Options::='--force-confold' install -y haproxy iproute" ) # Populate new params of contrail-vrouter-agent config file conf_file = '/etc/contrail/contrail-vrouter-agent.conf' lbaas_svc_instance_params = { 'netns_command': '/usr/bin/opencontrail-vrouter-netns', } for param, value in lbaas_svc_instance_params.items(): sudo("openstack-config --set %s SERVICE-INSTANCE %s %s" % (conf_file, param, value)) if from_rel in ['1.10', '1.20', '1.30']: sudo( "openstack-config --set %s DEFAULT log_file /var/log/contrail/contrail-vrouter-agent.log" % conf_file) sudo("openstack-config --set %s DEFAULT log_local 1" % conf_file) sudo("openstack-config --set %s DEFAULT log_level SYS_NOTICE" % conf_file) if ostype in ['centos']: execute('setup_vrouter_node', host_string)
def get_compute_pkgs(manage_nova_compute='yes'): """Returns a list of packages to be installed in the compute node. """ ostype = detect_ostype() if get_orchestrator() is 'vcenter': pkgs = ['contrail-vmware-vrouter'] else: pkgs = ['contrail-openstack-vrouter'] if ostype in ['ubuntu']: # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms contrail_vrouter_pkg = get_vrouter_kmod_pkg() if env.host_string in getattr(env, 'dpdk', []): contrail_vrouter_pkg = 'contrail-vrouter-dpdk-init' # This order of installation matters, because in a node with # non recommended kernel installed, contrail-vrouter-dkms pkg # needs to get installed first before contrail-openstack-vrouter. if get_orchestrator() is 'vcenter': pkgs = [contrail_vrouter_pkg, 'contrail-vmware-vrouter'] else: pkgs = [contrail_vrouter_pkg, 'contrail-openstack-vrouter'] # Append only vrouter and contrail vrouter dependent packages # no need to append the contrail-openstack-vrouter, which when # installed will bring in nova-compute and its dependents. if (manage_nova_compute == 'no' and ostype in ['centos', 'redhat', 'fedora', 'centoslinux']): pkgs = [ 'contrail-vrouter-common', 'openstack-utils', ] if get_openstack_sku() in ['juno']: pkgs.append('contrail-nova-vif') elif (manage_nova_compute == 'no' and ostype in ['ubuntu']): pkgs = [contrail_vrouter_pkg, 'contrail-vrouter-common'] if get_orchestrator() is 'openstack': pkgs.append('contrail-nova-vif') else: pkgs.append('contrail-vmware-vrouter') # Append lbaas dependent packages if haproxy is enabled.. if getattr(testbed, 'haproxy', False): pkgs.append('haproxy') # Append lbaas dependent packages if Lbaas is enabled.. if is_lbaas_enabled(): pkgs.append('haproxy') pkgs.append('iproute') if ostype == 'ubuntu': # Append nova-docker if hypervisor for this compute host is docker. if get_hypervisor(env.host_string) == 'docker': pkgs.append('nova-docker') return pkgs
def get_compute_pkgs(manage_nova_compute='yes'): """Returns a list of packages to be installed in the compute node. """ ostype = detect_ostype() if get_orchestrator() is 'vcenter': pkgs = ['contrail-vmware-vrouter'] else: pkgs = ['contrail-openstack-vrouter'] if ostype in ['ubuntu']: # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms contrail_vrouter_pkg = get_vrouter_kmod_pkg() if env.host_string in getattr(env, 'dpdk', []): contrail_vrouter_pkg = 'contrail-vrouter-dpdk-init' # This order of installation matters, because in a node with # non recommended kernel installed, contrail-vrouter-dkms pkg # needs to get installed first before contrail-openstack-vrouter. if get_orchestrator() is 'vcenter': pkgs = [contrail_vrouter_pkg, 'contrail-vmware-vrouter'] else: pkgs = [contrail_vrouter_pkg, 'contrail-openstack-vrouter'] # Append only vrouter and contrail vrouter dependent packages # no need to append the contrail-openstack-vrouter, which when # installed will bring in nova-compute and its dependents. if (manage_nova_compute == 'no' and ostype in ['centos', 'redhat', 'fedora', 'centoslinux']): pkgs = ['contrail-vrouter-common', 'openstack-utils', ] if get_openstack_sku() in ['juno']: pkgs.append('contrail-nova-vif') elif (manage_nova_compute== 'no' and ostype in ['ubuntu']): pkgs = [contrail_vrouter_pkg, 'contrail-vrouter-common'] if get_orchestrator() is 'openstack': pkgs.append('contrail-nova-vif') else: pkgs.append('contrail-vmware-vrouter') # Append lbaas dependent packages if haproxy is enabled.. if getattr(testbed, 'haproxy', False): pkgs.append('haproxy') # Append lbaas dependent packages if Lbaas is enabled.. if is_lbaas_enabled(): pkgs.append('haproxy') pkgs.append('iproute') if ostype == 'ubuntu': # Append nova-docker if hypervisor for this compute host is docker. if get_hypervisor(env.host_string) == 'docker': pkgs.append('nova-docker') return pkgs
def upgrade_vrouter_node(from_rel, pkg, *args): """Upgrades vrouter pkgs in one or list of nodes. USAGE:fab upgrade_vrouter_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) execute("backup_config", from_rel) execute("backup_config_dir", from_rel) execute("fix_vrouter_configs_node", host_string) upgrade(from_rel, "compute") ostype = detect_ostype() if is_lbaas_enabled(): if ostype == "ubuntu": sudo("apt-get -o Dpkg::Options::='--force-confold' install -y haproxy iproute") if ostype == "centos": sudo("yum -y --disablerepo=* --enablerepo=contrail_install_repo install haproxy iproute") # Populate new params of contrail-vrouter-agent config file conf_file = "/etc/contrail/contrail-vrouter-agent.conf" lbaas_svc_instance_params = {"netns_command": "/usr/bin/opencontrail-vrouter-netns"} for param, value in lbaas_svc_instance_params.items(): sudo("openstack-config --set %s SERVICE-INSTANCE %s %s" % (conf_file, param, value)) if from_rel in ["1.10", "1.20", "1.30", "1.21"]: sudo( "openstack-config --set %s DEFAULT log_file /var/log/contrail/contrail-vrouter-agent.log" % conf_file ) sudo("openstack-config --set %s DEFAULT log_local 1" % conf_file) sudo("openstack-config --set %s DEFAULT log_level SYS_NOTICE" % conf_file) if ostype in ["centos"]: execute("setup_vrouter_node", host_string) if is_lbaas_enabled(): sudo("groupadd -f nogroup") sudo("sed -i s/'Defaults requiretty'/'#Defaults requiretty'/g /etc/sudoers") # Upgrade nova parameters in nova.conf in compute host from 2.0 to 2.1 if get_openstack_internal_vip() and from_rel in ["2.0"]: nova_conf_file = "/etc/nova/nova.conf" openstack_compute_service = "openstack-nova-compute" if ostype == "ubuntu": openstack_compute_service = "nova-compute" sudo("service %s stop" % openstack_compute_service) sudo("openstack-config --set /etc/nova/nova.conf DEFAULT rpc_response_timeout 30") sudo("openstack-config --set /etc/nova/nova.conf DEFAULT report_interval 15") sudo("service %s start" % openstack_compute_service) execute("reboot_node", "no", host_string)
def get_compute_pkgs(manage_nova_compute="yes"): """Returns a list of packages to be installed in the compute node. """ ostype = detect_ostype() if get_orchestrator() is "vcenter": pkgs = ["contrail-vmware-vrouter"] else: pkgs = ["contrail-openstack-vrouter"] if ostype in ["ubuntu"]: # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms contrail_vrouter_pkg = get_vrouter_kmod_pkg() if env.host_string in getattr(env, "dpdk", []): contrail_vrouter_pkg = "contrail-vrouter-dpdk-init" # This order of installation matters, because in a node with # non recommended kernel installed, contrail-vrouter-dkms pkg # needs to get installed first before contrail-openstack-vrouter. if get_orchestrator() is "vcenter": pkgs = [contrail_vrouter_pkg, "contrail-vmware-vrouter"] else: pkgs = [contrail_vrouter_pkg, "contrail-openstack-vrouter"] # Append only vrouter and contrail vrouter dependent packages # no need to append the contrail-openstack-vrouter, which when # installed will bring in nova-compute and its dependents. if manage_nova_compute == "no" and ostype in ["centos", "redhat", "fedora", "centoslinux"]: pkgs = ["contrail-vrouter-common", "openstack-utils", "contrail-nova-vif"] elif manage_nova_compute == "no" and ostype in ["ubuntu"]: pkgs = [contrail_vrouter_pkg, "contrail-vrouter-common"] if get_orchestrator() is "openstack": pkgs.append("contrail-nova-vif") else: pkgs.append("contrail-vmware-vrouter") # Append lbaas dependent packages if haproxy is enabled.. if getattr(testbed, "haproxy", False): pkgs.append("haproxy") # Append lbaas dependent packages if Lbaas is enabled.. if ostype == "ubuntu" and is_lbaas_enabled(): pkgs.append("haproxy") pkgs.append("iproute") if ostype == "ubuntu": # Append nova-docker if hypervisor for this compute host is docker. if get_hypervisor(env.host_string) == "docker": pkgs.append("nova-docker") return pkgs
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() pkg = ['contrail-openstack-vrouter'] # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms if ostype in ['ubuntu']: dkms_status = get_build('contrail-vrouter-dkms') if dkms_status is not None: contrail_vrouter_pkg = 'contrail-vrouter-dkms' else: vrouter_generic_pkg = sudo( "apt-cache pkgnames contrail-vrouter-$(uname -r)") contrail_vrouter_pkg = vrouter_generic_pkg or 'contrail-vrouter-dkms' dpdk = getattr(env, 'dpdk', None) if dpdk: if env.host_string in dpdk: contrail_vrouter_pkg = 'contrail-vrouter-dpdk-init' pkg = [contrail_vrouter_pkg, 'contrail-openstack-vrouter'] if (manage_nova_compute == 'no' and ostype in ['centos', 'redhat']): pkg = [ 'contrail-vrouter-common', 'openstack-utils', 'contrail-nova-vif', ] elif (manage_nova_compute == 'no' and ostype in ['ubuntu']): pkg = [contrail_vrouter_pkg, 'contrail-vrouter-common'] if getattr(testbed, 'haproxy', False): pkg.append('haproxy') if (ostype == 'ubuntu' and is_lbaas_enabled()): pkg.append('haproxy') pkg.append('iproute') if ostype == 'ubuntu': sudo('echo "manual" >> /etc/init/supervisor-vrouter.override') if get_hypervisor(host_string) == 'docker': pkg.append('nova-docker') apt_install(pkg) else: yum_install(pkg) install_ceilometer_compute_node(host_string)
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() pkg = ['contrail-openstack-vrouter'] # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms if ostype in ['ubuntu']: dkms_status = get_build('contrail-vrouter-dkms') if dkms_status is not None: contrail_vrouter_pkg = 'contrail-vrouter-dkms' else: vrouter_generic_pkg = sudo("apt-cache pkgnames contrail-vrouter-$(uname -r)") contrail_vrouter_pkg = vrouter_generic_pkg or 'contrail-vrouter-dkms' dpdk = getattr(env, 'dpdk', None) if dpdk: if env.host_string in dpdk: contrail_vrouter_pkg = 'contrail-vrouter-dpdk-init' pkg = [contrail_vrouter_pkg, 'contrail-openstack-vrouter'] if (manage_nova_compute == 'no' and ostype in ['centos', 'redhat']): pkg = ['contrail-vrouter-common', 'openstack-utils', 'contrail-nova-vif', ] elif (manage_nova_compute== 'no' and ostype in ['ubuntu']): pkg = [contrail_vrouter_pkg, 'contrail-vrouter-common' ] if getattr(testbed, 'haproxy', False): pkg.append('haproxy') if (ostype == 'ubuntu' and is_lbaas_enabled()): pkg.append('haproxy') pkg.append('iproute') if ostype == 'ubuntu': sudo('echo "manual" >> /etc/init/supervisor-vrouter.override') if get_hypervisor(host_string) == 'docker': pkg.append('nova-docker') apt_install(pkg) else: yum_install(pkg) install_ceilometer_compute_node(host_string)
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: ostype = detect_ostype() with settings(host_string=host_string): pkg = ['contrail-openstack-vrouter'] if (manage_nova_compute == 'no' and ostype in ['centos']): pkg = ['contrail-vrouter', 'abrt', #'openstack-nova-compute', 'openstack-utils', 'python-thrift', #'librabbitmq', 'contrail-nova-vif', 'contrail-setup', 'contrail-nodemgr', 'contrail-vrouter-init', ] elif (manage_nova_compute== 'no' and ostype in ['ubuntu']): pkg = ['contrail-nodemgr', 'contrail-setup', 'contrail-vrouter-init', #'nova-compute', 'python-iniparse', #'python-novaclient', 'contrail-nova-vif', #'librabbitmq0', 'linux-crashdump', 'contrail-vrouter' ] if getattr(testbed, 'haproxy', False): pkg.append('haproxy') if (ostype == 'ubuntu' and is_lbaas_enabled()): pkg.append('haproxy') pkg.append('iproute') if ostype == 'ubuntu': run('echo "manual" >> /etc/init/supervisor-vrouter.override') apt_install(pkg) else: yum_install(pkg)
def upgrade_vrouter_node(from_rel, pkg, *args): """Upgrades vrouter pkgs in one or list of nodes. USAGE:fab upgrade_vrouter_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): execute('backup_install_repo_node', host_string) execute('install_pkg_node', pkg, host_string) execute('create_install_repo_node', host_string) upgrade(from_rel, 'compute') ostype = detect_ostype() if (ostype == 'Ubuntu' and is_lbaas_enabled()): run("apt-get -o Dpkg::Options::='--force-confold' install -y haproxy iproute") # Populate new params of contrail-vrouter-agent config file conf_file = '/etc/contrail/contrail-vrouter-agent.conf' lbaas_svc_instance_params = {'netns_command' : '/usr/bin/opencontrail-vrouter-netns', } for param, value in lbaas_svc_instance_params.items(): run("openstack-config --set %s SERVICE-INSTANCE %s %s" % (conf_file, param, value)) # If necessary, migrate to new ini format based configuration. if from_rel == '1.05': run("/opt/contrail/contrail_installer/contrail_config_templates/vrouter-agent.conf.sh") if ostype in ['centos']: execute('setup_vrouter_node', host_string)
def upgrade_vrouter_node(from_rel, pkg, *args): """Upgrades vrouter pkgs in one or list of nodes. USAGE:fab upgrade_vrouter_node:[email protected],[email protected]""" for host_string in args: with settings(host_string=host_string): execute('backup_install_repo_node', host_string) execute('install_pkg_node', pkg, host_string) execute('create_install_repo_node', host_string) upgrade(from_rel, 'compute') ostype = detect_ostype() if (ostype == 'ubuntu' and is_lbaas_enabled()): run("apt-get -o Dpkg::Options::='--force-confold' install -y haproxy iproute") # Populate new params of contrail-vrouter-agent config file conf_file = '/etc/contrail/contrail-vrouter-agent.conf' lbaas_svc_instance_params = {'netns_command' : '/usr/bin/opencontrail-vrouter-netns', } for param, value in lbaas_svc_instance_params.items(): run("openstack-config --set %s SERVICE-INSTANCE %s %s" % (conf_file, param, value)) if from_rel in ['1.10', '1.20', '1.30']: run("openstack-config --set %s DEFAULT log_local 1" % conf_file) run("openstack-config --set %s DEFAULT log_level SYS_NOTICE" % conf_file) if ostype in ['centos']: execute('setup_vrouter_node', host_string)
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() pkg = ["contrail-openstack-vrouter"] # For Ubuntu, Install contrail-vrouter-generic package if one available for # node's kernel version or install contrail-vrouter-dkms # If dkms is already installed, continue to upgrade contrail-vrouter-dkms if ostype in ["ubuntu"]: dkms_status = get_build("contrail-vrouter-dkms") if dkms_status is not None: contrail_vrouter_pkg = "contrail-vrouter-dkms" else: vrouter_generic_pkg = run("apt-cache pkgnames contrail-vrouter-$(uname -r)") contrail_vrouter_pkg = vrouter_generic_pkg or "contrail-vrouter-dkms" pkg = [contrail_vrouter_pkg, "contrail-openstack-vrouter"] if manage_nova_compute == "no" and ostype in ["centos", "redhat"]: pkg = ["contrail-vrouter-common", "openstack-utils", "contrail-nova-vif"] elif manage_nova_compute == "no" and ostype in ["ubuntu"]: pkg = [contrail_vrouter_pkg, "contrail-vrouter-common"] if getattr(testbed, "haproxy", False): pkg.append("haproxy") if ostype == "ubuntu" and is_lbaas_enabled(): pkg.append("haproxy") pkg.append("iproute") if ostype == "ubuntu": sudo('echo "manual" >> /etc/init/supervisor-vrouter.override') apt_install(pkg) else: yum_install(pkg)