def start_cfgm_node(*args): openstack_services = get_openstack_services() for host_string in args: with settings(host_string=host_string, warn_only=True): sudo('service %s start' % openstack_services['rabbitmq-server']) sudo('service supervisor-config start') sudo('service neutron-server start')
def start_cfgm(): """starts the contrail config services.""" openstack_services = get_openstack_services() with settings(warn_only=True): sudo('service %s start' % openstack_services['rabbitmq-server']) sudo('service supervisor-config start') sudo('service neutron-server start')
def start_cfgm_node(*args): openstack_services = get_openstack_services() for host_string in args: with settings(host_string=host_string,warn_only=True): sudo('service %s start' % openstack_services['rabbitmq-server']) sudo('service supervisor-config start') sudo('service neutron-server start')
def start_rabbitmq_node(*args): for host_string in args: with settings(host_string=host_string, warn_only=True): openstack_services = get_openstack_services() if openstack_services['initsystem'] == 'systemd': sudo('systemctl daemon-reload') sudo('systemctl enable rabbitmq-server') sudo("service rabbitmq-server restart")
def restart_cfgm_node(*args): """Restarts the contrail config services in once cfgm node. USAGE:fab restart_cfgm_node:[email protected],[email protected]""" openstack_services = get_openstack_services() for host_string in args: with settings(host_string=host_string): sudo('service %s restart' % openstack_services['rabbitmq-server']) sudo('service supervisor-config restart') if get_orchestrator() == 'openstack': sudo('service neutron-server restart')
def copy_certs_for_heat_node(*nodes): for node in nodes: with settings(host_string=node, password=get_env_passwords(node)): if node in env.roledefs['cfgm']: sudo("usermod -a -G contrail heat") else: execute('copy_apiserver_ssl_certs_to_node', node) execute('copy_vnc_api_lib_ini_to_node', node) sudo("chown -R heat:heat /etc/contrail") for svc_key in ['heat-api', 'heat-engine', 'heat-api-cfn']: sudo("service %s restart" % get_openstack_services()[svc_key])
def restart_openstack_node(*args): """Restarts the contrail openstack services in once openstack node. USAGE:fab restart_openstack_node:[email protected],[email protected]""" openstack_services = get_openstack_services() if detect_ostype() in ['ubuntu']: openstack_services['services'] += ['memcached'] else: openstack_services['services'] += ['httpd', 'memcached'] for host_string in args: with settings(host_string=host_string): for svc in openstack_services['services']: sudo('service %s restart' % svc)
def copy_certs_for_heat_node(*nodes): for node in nodes: with settings(host_string=node, password=get_env_passwords(node)): if node in env.roledefs['cfgm']: sudo("usermod -a -G contrail heat") else: execute('copy_apiserver_ssl_certs_to_node', node) execute('copy_keystone_ssl_certs_to_node', node) execute('copy_vnc_api_lib_ini_to_node', node) sudo("chown -R heat:heat /etc/contrail") for svc_key in ['heat-api', 'heat-engine', 'heat-api-cfn']: sudo("service %s restart" % get_openstack_services()[svc_key])
def verify_openstack(): openstack_services = get_openstack_services() verify_service(openstack_services["keystone"]) insecure_flag = '' if keystone_ssl_enabled() and get_keystone_insecure_flag(): insecure_flag = '--insecure' for x in xrange(10): with settings(warn_only=True): output = sudo("source /etc/contrail/openstackrc; keystone %s tenant-list" % insecure_flag) if output.failed: sleep(10) else: return raise OpenStackSetupError(output)
def verify_openstack(): openstack_services = get_openstack_services() if not is_xenial_or_above(): verify_service(openstack_services["keystone"]) insecure_flag = '' if keystone_ssl_enabled() and get_keystone_insecure_flag(): insecure_flag = '--insecure' for x in xrange(10): with settings(warn_only=True): if is_xenial_or_above(): output = sudo("source /etc/contrail/openstackrc; openstack %s project list" % insecure_flag) else: output = sudo("source /etc/contrail/openstackrc; keystone %s tenant-list" % insecure_flag) if output.failed: sleep(10) else: return raise OpenStackSetupError(output)
def restart_rabbitmq(): openstack_services = get_openstack_services() sudo('service %s restart' % openstack_services['rabbitmq-server'])
def stop_rabbitmq(): openstack_services = get_openstack_services() with settings(warn_only=True): sudo('service supervisor-support-service stop') sudo('service %s stop' % openstack_services['rabbitmq-server'])