def create_common_manifest(config, messages): global compute_hosts, network_hosts network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and 'neutron' or 'nova') network_multi = len(network_hosts) > 1 dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')]) dbacces_hosts |= network_hosts for manifestfile, marker in manifestfiles.getFiles(): pw_in_sqlconn = False if manifestfile.endswith("_nova.pp"): host, manifest = manifestfile.split('_', 1) host = host.strip() if host in compute_hosts and host not in dbacces_hosts: # we should omit password in case we are installing only # nova-compute to the host perms = "nova" pw_in_sqlconn = False else: perms = "nova:%s" % config['CONFIG_NOVA_DB_PW'] pw_in_sqlconn = True mariadb_host_url = config['CONFIG_MARIADB_HOST_URL'] sqlconn = "mysql+pymysql://%s@%s/nova" % (perms, mariadb_host_url) if pw_in_sqlconn: config['CONFIG_NOVA_SQL_CONN_PW'] = sqlconn else: config['CONFIG_NOVA_SQL_CONN_NOPW'] = sqlconn # for nova-network in multihost mode each compute host is metadata # host otherwise we use api host if (network_type == 'nova' and network_multi and host in compute_hosts): metadata = host else: metadata = config['CONFIG_CONTROLLER_HOST'] config['CONFIG_NOVA_METADATA_HOST'] = metadata data = getManifestTemplate(get_mq(config, "nova_common")) if pw_in_sqlconn: data += getManifestTemplate("nova_common_pw") else: data += getManifestTemplate("nova_common_nopw") # We need to have class nova before class nova::api, so prepend # instead of append prependManifestFile(os.path.split(manifestfile)[1], data) if config['CONFIG_AMQP_ENABLE_SSL'] == 'y': nova_hosts = compute_hosts nova_hosts |= set([config.get('CONFIG_CONTROLLER_HOST')]) ssl_cert_file = config['CONFIG_NOVA_SSL_CERT'] = ( '/etc/pki/tls/certs/ssl_amqp_nova.crt') ssl_key_file = config['CONFIG_NOVA_SSL_KEY'] = ( '/etc/pki/tls/private/ssl_amqp_nova.key') service = 'nova' for host in nova_hosts: generate_ssl_cert(config, host, service, ssl_key_file, ssl_cert_file)
def create_common_manifest(config, messages): global compute_hosts, network_hosts network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and 'neutron' or 'nova') network_multi = len(network_hosts) > 1 dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')]) dbacces_hosts |= network_hosts for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): host, manifest = manifestfile.split('_', 1) host = host.strip() if host in compute_hosts and host not in dbacces_hosts: # we should omit password in case we are installing only # nova-compute to the host perms = "nova" else: perms = "nova:%(CONFIG_NOVA_DB_PW)s" sqlconn = "mysql://%s@%%(CONFIG_MYSQL_HOST)s/nova" % perms config['CONFIG_NOVA_SQL_CONN'] = sqlconn % config # for nova-network in multihost mode each compute host is metadata # host otherwise we use api host if (network_type == 'nova' and network_multi and host in compute_hosts): metadata = host else: metadata = config['CONFIG_CONTROLLER_HOST'] config['CONFIG_NOVA_METADATA_HOST'] = metadata data = getManifestTemplate(get_mq(config, "nova_common")) data += getManifestTemplate("nova_common.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def createcommonmanifest(config): dbhost = config['CONFIG_MYSQL_HOST'] dirty = controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(",") nopass_nodes = [i.strip() for i in dirty if i.strip()] dirty = [ config.get('CONFIG_NOVA_CONDUCTOR_HOST'), config.get('CONFIG_NOVA_API_HOST'), config.get('CONFIG_NOVA_CERT_HOST'), config.get('CONFIG_NOVA_VNCPROXY_HOST'), config.get('CONFIG_NOVA_SCHED_HOST'), config.get('CONFIG_NOVA_NETWORK_HOST') ] dbpass_nodes = [i.strip() for i in dirty if i and i.strip()] for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): host, manifest = manifestfile.split('_', 1) host = host.strip() if host in nopass_nodes and host not in dbpass_nodes: # we should omit password in case we are installing only # nova-compute to the host perms = "nova" else: perms = "nova:%(CONFIG_NOVA_DB_PW)s" % config config['CONFIG_NOVA_SQL_CONN'] = ("mysql://%s@%s/nova" % (perms, dbhost)) data = getManifestTemplate("nova_common.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def applyPuppetManifest(): print currently_running = [] lastmarker = None for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in gethostlist(controller.CONF): if "/%s_" % hostname not in manifest: continue print "Applying " + manifest server = utils.ScriptRunner(hostname) running_logfile = "%s.running" % manifest finished_logfile = "%s.finished" % manifest currently_running.append((hostname, finished_logfile)) command = "( flock %s/ps.lock puppet apply --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (basedefs.VAR_DIR, basedefs.VAR_DIR, manifest, running_logfile, running_logfile, finished_logfile) if not manifest.endswith('_horizon.pp'): server.append("export FACTERLIB=$FACTERLIB:%s/facts" % basedefs.VAR_DIR) server.append(command) server.execute() # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def createcommonmanifest(config): dbhost = config['CONFIG_MYSQL_HOST'] dirty = controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(",") nopass_nodes = [i.strip() for i in dirty if i.strip()] dirty = [config.get('CONFIG_NOVA_CONDUCTOR_HOST'), config.get('CONFIG_NOVA_API_HOST'), config.get('CONFIG_NOVA_CERT_HOST'), config.get('CONFIG_NOVA_VNCPROXY_HOST'), config.get('CONFIG_NOVA_SCHED_HOST'), config.get('CONFIG_NOVA_NETWORK_HOST')] dbpass_nodes = [i.strip() for i in dirty if i and i.strip()] for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): host, manifest = manifestfile.split('_', 1) host = host.strip() if host in nopass_nodes and host not in dbpass_nodes: # we should omit password in case we are installing only # nova-compute to the host perms = "nova" else: perms = "nova:%(CONFIG_NOVA_DB_PW)s" % config config['CONFIG_NOVA_SQL_CONN'] = ("mysql://%s@%s/nova" % (perms, dbhost)) data = getManifestTemplate("nova_common.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def applyPuppetManifest(): print currently_running = [] lastmarker = None for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in gethostlist(controller.CONF): if "/%s_"%hostname not in manifest: continue print "Applying "+ manifest server = utils.ScriptRunner(hostname) logfile = "%s.log"%manifest currently_running.append((hostname, logfile)) command = "( flock %s/ps.lock puppet apply --modulepath %s/modules %s > %s_ 2>&1 < /dev/null ; mv %s_ %s ) > /dev/null 2>&1 < /dev/null &"%(basedefs.VAR_DIR, basedefs.VAR_DIR, manifest, logfile, logfile, logfile) server.append(command) server.execute() # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def create_common_manifest(config, messages): global compute_hosts, network_hosts network_type = (config['CONFIG_NEUTRON_INSTALL'] == "y" and 'neutron' or 'nova') network_multi = len(network_hosts) > 1 dbacces_hosts = set([config.get('CONFIG_CONTROLLER_HOST')]) dbacces_hosts |= network_hosts for manifestfile, marker in manifestfiles.getFiles(): pw_in_sqlconn = False if manifestfile.endswith("_nova.pp"): host, manifest = manifestfile.split('_', 1) host = host.strip() if host in compute_hosts and host not in dbacces_hosts: # we should omit password in case we are installing only # nova-compute to the host perms = "nova" pw_in_sqlconn = False else: perms = "nova:%s" % config['CONFIG_NOVA_DB_PW'] pw_in_sqlconn = True mariadb_host_url = config['CONFIG_MARIADB_HOST_URL'] sqlconn = "mysql://%s@%s/nova" % (perms, mariadb_host_url) if pw_in_sqlconn: config['CONFIG_NOVA_SQL_CONN_PW'] = sqlconn else: config['CONFIG_NOVA_SQL_CONN_NOPW'] = sqlconn # for nova-network in multihost mode each compute host is metadata # host otherwise we use api host if (network_type == 'nova' and network_multi and host in compute_hosts): metadata = host else: metadata = config['CONFIG_CONTROLLER_HOST'] config['CONFIG_NOVA_METADATA_HOST'] = metadata data = getManifestTemplate(get_mq(config, "nova_common")) if pw_in_sqlconn: data += getManifestTemplate("nova_common_pw") else: data += getManifestTemplate("nova_common_nopw") appendManifestFile(os.path.split(manifestfile)[1], data) if config['CONFIG_AMQP_ENABLE_SSL'] == 'y': nova_hosts = compute_hosts nova_hosts |= set([config.get('CONFIG_CONTROLLER_HOST')]) ssl_cert_file = config['CONFIG_NOVA_SSL_CERT'] = ( '/etc/pki/tls/certs/ssl_amqp_nova.crt' ) ssl_key_file = config['CONFIG_NOVA_SSL_KEY'] = ( '/etc/pki/tls/private/ssl_amqp_nova.key' ) service = 'nova' for host in nova_hosts: generate_ssl_cert(config, host, service, ssl_key_file, ssl_cert_file)
def createquantummanifest(config): if controller.CONF['CONFIG_QUANTUM_INSTALL'] != "y": return for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_quantum.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def createneutronmanifest(config): if controller.CONF['CONFIG_NEUTRON_INSTALL'] != "y": return controller.CONF['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_neutron.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def applyPuppetManifest(config): if config.get("DRY_RUN"): return currently_running = [] lastmarker = None loglevel = '' logcmd = False if logging.root.level <= logging.DEBUG: loglevel = '--debug' logcmd = True for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in filtered_hosts(config): if "%s_" % hostname not in manifest: continue host_dir = config['HOST_DETAILS'][hostname]['tmpdir'] print "Applying %s" % manifest server = utils.ScriptRunner(hostname) man_path = os.path.join(config['HOST_DETAILS'][hostname]['tmpdir'], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) # The apache puppet module doesn't work if we set FACTERLIB # https://github.com/puppetlabs/puppetlabs-apache/pull/138 if not (manifest.endswith('_horizon.pp') or manifest.endswith('_nagios.pp')): server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) # cylee : Apply patch should run with sudo command = ("( flock %s/ps.lock sudo puppet apply" " --profile --debug --verbose " "%s --modulepath %s/modules %s > %s 2>&1 < /dev/null ;" " mv %s %s ) > /dev/null 2>&1 < /dev/null &")\ % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile) server.append(command) server.execute(log=logcmd) # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def createneutronmanifest(config): if controller.CONF["CONFIG_NEUTRON_INSTALL"] != "y": return if controller.CONF["CONFIG_NEUTRON_L2_PLUGIN"] == "openvswitch": controller.CONF["CONFIG_NOVA_LIBVIRT_VIF_DRIVER"] = "nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver" else: controller.CONF["CONFIG_NOVA_LIBVIRT_VIF_DRIVER"] = "nova.virt.libvirt.vif.LibvirtGenericVIFDriver" for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_neutron.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def createquantummanifest(config): if controller.CONF['CONFIG_QUANTUM_INSTALL'] != "y": return if controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'openvswitch': controller.CONF['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver' else: controller.CONF['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_quantum.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def applyPuppetManifest(config): if config.get("DRY_RUN"): return currently_running = [] lastmarker = None loglevel = '' logcmd = False if logging.root.level <= logging.DEBUG: loglevel = '--debug' logcmd = True for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in filtered_hosts(config): if "%s_" % hostname not in manifest: continue host_dir = config['HOST_DETAILS'][hostname]['tmpdir'] print "Applying %s" % manifest server = utils.ScriptRunner(hostname) man_path = os.path.join(config['HOST_DETAILS'][hostname]['tmpdir'], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) # The apache puppet module doesn't work if we set FACTERLIB # https://github.com/puppetlabs/puppetlabs-apache/pull/138 if not (manifest.endswith('_horizon.pp') or manifest.endswith('_nagios.pp')): server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) command = "( flock %s/ps.lock puppet apply %s --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % ( host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile) server.append(command) server.execute(log=logcmd) # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def createquantummanifest(config): if controller.CONF['CONFIG_QUANTUM_INSTALL'] != "y": return if controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'openvswitch': controller.CONF[ 'CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver' else: controller.CONF[ 'CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_quantum.pp") appendManifestFile(os.path.split(manifestfile)[1], data)
def create_neutron_manifest(config, messages): if config['CONFIG_NEUTRON_INSTALL'] != "y": return if config['CONFIG_IRONIC_INSTALL'] == 'y': virt_driver = 'nova.virt.firewall.NoopFirewallDriver' config['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = virt_driver else: virt_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver' config['CONFIG_NOVA_LIBVIRT_VIF_DRIVER'] = virt_driver for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_neutron") appendManifestFile(os.path.split(manifestfile)[1], data)
def apply_puppet_manifest(config, messages): if config.get("DRY_RUN"): return currently_running = [] lastmarker = None loglevel = '' logcmd = False if logging.root.level <= logging.DEBUG: loglevel = '--debug' logcmd = True for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker is not None and lastmarker != marker: wait_for_puppet(currently_running, messages) lastmarker = marker for hostname in filtered_hosts(config): if "%s_" % hostname not in manifest: continue host_dir = config['HOST_DETAILS'][hostname]['tmpdir'] print "Applying %s" % manifest server = utils.ScriptRunner(hostname) man_path = os.path.join(config['HOST_DETAILS'][hostname]['tmpdir'], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) cmd = ("( flock %s/ps.lock " "puppet apply %s --modulepath %s/modules %s > %s " "2>&1 < /dev/null ; " "mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile)) server.append(cmd) server.execute(log=logcmd) # wait for outstanding puppet runs befor exiting wait_for_puppet(currently_running, messages)
def apply_puppet_manifest(config, messages): if config.get("DRY_RUN"): return currently_running = [] lastmarker = None loglevel = '' logcmd = False if logging.root.level <= logging.DEBUG: loglevel = '--debug' logcmd = True for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker is not None and lastmarker != marker: wait_for_puppet(currently_running, messages) lastmarker = marker for hostname in filtered_hosts(config): if "%s_" % hostname not in manifest: continue host_dir = config['HOST_DETAILS'][hostname]['tmpdir'] print("Applying %s" % manifest) server = utils.ScriptRunner(hostname) man_path = os.path.join(config['HOST_DETAILS'][hostname]['tmpdir'], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) cmd = ("( flock %s/ps.lock " "puppet apply %s --modulepath %s/modules %s > %s " "2>&1 < /dev/null ; " "mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile)) server.append(cmd) server.execute(log=logcmd) # wait for outstanding puppet runs before exiting wait_for_puppet(currently_running, messages)
def applyPuppetManifest(config): print currently_running = [] lastmarker = None for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in filtered_hosts(config): if "%s_" % hostname not in manifest: continue host_dir = controller.temp_map[hostname] print "Applying " + manifest server = utils.ScriptRunner(hostname) man_path = os.path.join(controller.temp_map[hostname], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) # The apache puppet module doesn't work if we set FACTERLIB # https://github.com/puppetlabs/puppetlabs-apache/pull/138 if not (manifest.endswith("_horizon.pp") or manifest.endswith("_nagios.pp")): server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) server.append("export PACKSTACK_VAR_DIR=%s" % host_dir) loglevel = "" if logging.root.level <= logging.DEBUG: loglevel = "--debug" command = ( "( flock %s/ps.lock puppet apply %s --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, loglevel, host_dir, man_path, running_logfile, running_logfile, finished_logfile) ) server.append(command) server.execute() # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def applyPuppetManifest(): print currently_running = [] lastmarker = None for manifest, marker in manifestfiles.getFiles(): # if the marker has changed then we don't want to proceed until # all of the previous puppet runs have finished if lastmarker != None and lastmarker != marker: waitforpuppet(currently_running) lastmarker = marker for hostname in gethostlist(controller.CONF): if "%s_" % hostname not in manifest: continue host_dir = controller.temp_map[hostname] print "Applying " + manifest server = utils.ScriptRunner(hostname) man_path = os.path.join(controller.temp_map[hostname], basedefs.PUPPET_MANIFEST_RELATIVE, manifest) running_logfile = "%s.running" % man_path finished_logfile = "%s.finished" % man_path currently_running.append((hostname, finished_logfile)) if not manifest.endswith('_horizon.pp'): server.append("export FACTERLIB=$FACTERLIB:%s/facts" % host_dir) server.append("touch %s" % running_logfile) server.append("chmod 600 %s" % running_logfile) command = "( flock %s/ps.lock puppet apply --modulepath %s/modules %s > %s 2>&1 < /dev/null ; mv %s %s ) > /dev/null 2>&1 < /dev/null &" % (host_dir, host_dir, man_path, running_logfile, running_logfile, finished_logfile) server.append(command) server.execute() # wait for outstanding puppet runs befor exiting waitforpuppet(currently_running)
def createcommonmanifest(config): for manifestfile, marker in manifestfiles.getFiles(): if manifestfile.endswith("_swift.pp"): data = getManifestTemplate("swift_common.pp") appendManifestFile(os.path.split(manifestfile)[1], data)