def createcomputemanifest(config): dirty = controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(",") hostlist = [i.strip() for i in dirty if i.strip()] for host in hostlist: controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if controller.CONF["CONFIG_CINDER_INSTALL"] == "y" and controller.CONF["CONFIG_CINDER_BACKEND"] == "gluster": manifestdata += getManifestTemplate("nova_gluster.pp") if controller.CONF["CONFIG_CINDER_INSTALL"] == "y" and controller.CONF["CONFIG_CINDER_BACKEND"] == "nfs": manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if controller.CONF["CONFIG_NEUTRON_INSTALL"] != "y": if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption("DEFAULT/flat_interface", controller.CONF["CONFIG_NOVA_COMPUTE_PRIVIF"]) check_ifcfg(host, controller.CONF["CONFIG_NOVA_COMPUTE_PRIVIF"]) try: bring_up_ifcfg(host, controller.CONF["CONFIG_NOVA_COMPUTE_PRIVIF"]) except ScriptRuntimeError as ex: # just warn user to do it by himself controller.MESSAGES.append(str(ex)) if controller.CONF["CONFIG_CEILOMETER_INSTALL"] == "y": manifestdata += getManifestTemplate("nova_ceilometer.pp") appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(config): dirty = controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(",") hostlist = [i.strip() for i in dirty if i.strip()] for host in hostlist: controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y' and controller.CONF[ 'CONFIG_CINDER_BACKEND'] == 'gluster': manifestdata += getManifestTemplate("nova_gluster.pp") if controller.CONF['CONFIG_CINDER_INSTALL'] == 'y' and controller.CONF[ 'CONFIG_CINDER_BACKEND'] == 'nfs': manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if controller.CONF['CONFIG_NEUTRON_INSTALL'] != 'y': if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption( "DEFAULT/flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError, ex: # just warn user to do it by himself controller.MESSAGES.append(str(ScriptRuntimeError)) appendManifestFile( manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(): for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption("flat_interface", controller.CONF["CONFIG_NOVA_COMPUTE_PRIVIF"]) check_ifcfg(host, controller.CONF["CONFIG_NOVA_COMPUTE_PRIVIF"]) appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(): for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp"%host server = utils.ScriptRunner(host) nova_config_options = NovaConfig() if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption("flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) validate.r_validateIF(server, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) server.execute() appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(): for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp"%host nova_config_options = NovaConfig() if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption("DEFAULT/flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError, ex: # just warn user to do it by himself controller.MESSAGES.append(str(ScriptRuntimeError)) appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(config): global compute_hosts, network_hosts for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption("DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself controller.MESSAGES.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer")) # According to the docs the only element that connects directly to nova compute # is nova scheduler # http://docs.openstack.org/developer/nova/nova.concepts.html#concept-system-architecture # config['FIREWALL_ALLOWED'] = "'%s'" % (config['CONFIG_NOVA_SCHED_HOST'].strip()) # config['FIREWALL_SERVICE_NAME'] = "nova compute" # config['FIREWALL_SERVICE_ID'] = "nova_compute" # config['FIREWALL_PORTS'] = "'5900-5999'" # config['FIREWALL_CHAIN'] = "INPUT" # manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() appendManifestFile(manifestfile, manifestdata)
def createcomputemanifest(config): global compute_hosts, network_hosts for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption("DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself controller.MESSAGES.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer")) # According to the docs the only element that connects directly to nova compute # is nova scheduler # http://docs.openstack.org/developer/nova/nova.concepts.html#concept-system-architecture config['FIREWALL_ALLOWED'] = "'%s'" % (config['CONFIG_NOVA_SCHED_HOST'].strip()) config['FIREWALL_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_PORTS'] = "'5900-5999'" config['FIREWALL_CHAIN'] = "INPUT" manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() appendManifestFile(manifestfile, manifestdata)
def createcomputemanifest(): for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption( "DEFAULT/flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError, ex: # just warn user to do it by himself controller.MESSAGES.append(str(ScriptRuntimeError)) appendManifestFile( manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(): for host in controller.CONF["CONFIG_NOVA_COMPUTE_HOSTS"].split(","): controller.CONF["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") manifestfile = "%s_nova.pp"%host server = utils.ScriptRunner(host) nova_config_options = NovaConfig() if host != controller.CONF["CONFIG_NOVA_NETWORK_HOST"]: nova_config_options.addOption("flat_interface", controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) validate.r_validateIF(server, controller.CONF['CONFIG_NOVA_COMPUTE_PRIVIF']) # if on a vm we need to set libvirt_cpu_mode to "none" # see https://bugzilla.redhat.com/show_bug.cgi?id=858311 if controller.CONF["CONFIG_LIBVIRT_TYPE"] == "qemu": nova_config_options.addOption("libvirt_cpu_mode", "none") server.execute() appendManifestFile(manifestfile, manifestdata + "\n" + nova_config_options.getManifestEntry())
def createcomputemanifest(config): global compute_hosts, network_hosts ssh_hostkeys = '' for host in compute_hosts: try: host_name, host_aliases, host_addrs = socket.gethostbyaddr(host) except socket.herror: host_name, host_aliases, host_addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' %host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() config['SSH_HOST_NAME'] = host_name config['SSH_HOST_ALIASES'] = ','.join('"%s"' % addr for addr in host_aliases + host_addrs) config['SSH_HOST_KEY'] = host_key_data config['SSH_HOST_KEY_TYPE'] = host_key_type ssh_hostkeys += getManifestTemplate("sshkey.pp") for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption("DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself controller.MESSAGES.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': manifestdata += getManifestTemplate(get_mq(config, "nova_ceilometer")) # According to the docs the only element that connects directly to nova compute # is nova scheduler # http://docs.openstack.org/developer/nova/nova.concepts.html#concept-system-architecture config['FIREWALL_ALLOWED'] = "'%s'" % (config['CONFIG_NOVA_SCHED_HOST'].strip()) config['FIREWALL_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_PORTS'] = "'5900-5999'" config['FIREWALL_CHAIN'] = "INPUT" manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages): global compute_hosts, network_hosts migrate_protocol = config['CONFIG_NOVA_COMPUTE_MIGRATE_PROTOCOL'] if migrate_protocol == 'ssh': config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+ssh://nova@%s/system?no_verify=1&' 'keyfile=/etc/nova/ssh/nova_migration_key') else: config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+tcp://nova@%s/system') ssh_hostkeys = '' ssh_keys_details = {} for host in compute_hosts: try: hostname, aliases, addrs = socket.gethostbyaddr(host) except socket.herror: hostname, aliases, addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' % host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() key = "%s.%s" % (host_key_type, hostname) ssh_keys_details.setdefault(key, {}) ssh_keys_details[key]['ensure'] = 'present' ssh_keys_details[key]['host_aliases'] = aliases + addrs ssh_keys_details[key]['key'] = host_key_data ssh_keys_details[key]['type'] = host_key_type config['SSH_KEYS'] = ssh_keys_details ssh_hostkeys += getManifestTemplate("sshkey") for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute") fw_details = dict() cf_fw_qemu_mig_key = "FIREWALL_NOVA_QEMU_MIG_RULES_%s" % host for c_host in compute_hosts: key = "nova_qemu_migration_%s_%s" % (host, c_host) fw_details.setdefault(key, {}) fw_details[key]['host'] = "%s" % c_host fw_details[key]['service_name'] = "nova qemu migration" fw_details[key]['chain'] = "INPUT" fw_details[key]['ports'] = ['16509', '49152-49215'] fw_details[key]['proto'] = "tcp" config[cf_fw_qemu_mig_key] = fw_details manifestdata += createFirewallResources(cf_fw_qemu_mig_key) if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware") else: manifestdata += getManifestTemplate("nova_compute_libvirt") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and 'gluster' in config['CONFIG_CINDER_BACKEND']): manifestdata += getManifestTemplate("nova_gluster") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and 'nfs' in config['CONFIG_CINDER_BACKEND']): manifestdata += getManifestTemplate("nova_nfs") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption( "DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself messages.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': mq_template = get_mq(config, "nova_ceilometer") manifestdata += getManifestTemplate(mq_template) manifestdata += getManifestTemplate("nova_ceilometer") fw_details = dict() key = "nova_compute" fw_details.setdefault(key, {}) fw_details[key]['host'] = "%s" % config['CONFIG_CONTROLLER_HOST'] fw_details[key]['service_name'] = "nova compute" fw_details[key]['chain'] = "INPUT" fw_details[key]['ports'] = ['5900-5999'] fw_details[key]['proto'] = "tcp" config['FIREWALL_NOVA_COMPUTE_RULES'] = fw_details manifestdata += "\n" + createFirewallResources( 'FIREWALL_NOVA_COMPUTE_RULES') manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages): global compute_hosts, network_hosts migrate_protocol = config['CONFIG_NOVA_COMPUTE_MIGRATE_PROTOCOL'] if migrate_protocol == 'ssh': config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+ssh://nova@%s/system?no_verify=1&' 'keyfile=/etc/nova/ssh/nova_migration_key' ) else: config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+tcp://nova@%s/system' ) ssh_hostkeys = '' ssh_keys_details = {} for host in compute_hosts: try: hostname, aliases, addrs = socket.gethostbyaddr(host) except socket.herror: hostname, aliases, addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' % host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() key = "%s.%s" % (host_key_type, hostname) ssh_keys_details.setdefault(key, {}) ssh_keys_details[key]['ensure'] = 'present' ssh_keys_details[key]['host_aliases'] = aliases + addrs ssh_keys_details[key]['key'] = host_key_data ssh_keys_details[key]['type'] = host_key_type config['SSH_KEYS'] = ssh_keys_details ssh_hostkeys += getManifestTemplate("sshkey") for host in compute_hosts: if config['CONFIG_IRONIC_INSTALL'] == 'y': cm = 'ironic.nova.compute.manager.ClusteredComputeManager' config['CONFIG_NOVA_COMPUTE_MANAGER'] = cm manifestdata = getManifestTemplate("nova_compute") fw_details = dict() cf_fw_qemu_mig_key = "FIREWALL_NOVA_QEMU_MIG_RULES_%s" % host for c_host in compute_hosts: key = "nova_qemu_migration_%s_%s" % (host, c_host) fw_details.setdefault(key, {}) fw_details[key]['host'] = "%s" % c_host fw_details[key]['service_name'] = "nova qemu migration" fw_details[key]['chain'] = "INPUT" fw_details[key]['ports'] = ['16509', '49152-49215'] fw_details[key]['proto'] = "tcp" config[cf_fw_qemu_mig_key] = fw_details manifestdata += createFirewallResources(cf_fw_qemu_mig_key) if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") elif config['CONFIG_IRONIC_INSTALL'] == 'y': manifestdata += getManifestTemplate("nova_compute_ironic.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and 'gluster' in config['CONFIG_CINDER_BACKEND']): manifestdata += getManifestTemplate("nova_gluster") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and 'nfs' in config['CONFIG_CINDER_BACKEND']): manifestdata += getManifestTemplate("nova_nfs") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption( "DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF'] ) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself messages.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': mq_template = get_mq(config, "nova_ceilometer") manifestdata += getManifestTemplate(mq_template) manifestdata += getManifestTemplate("nova_ceilometer") fw_details = dict() key = "nova_compute" fw_details.setdefault(key, {}) fw_details[key]['host'] = "%s" % config['CONFIG_CONTROLLER_HOST'] fw_details[key]['service_name'] = "nova compute" fw_details[key]['chain'] = "INPUT" fw_details[key]['ports'] = ['5900-5999'] fw_details[key]['proto'] = "tcp" config['FIREWALL_NOVA_COMPUTE_RULES'] = fw_details manifestdata += "\n" + createFirewallResources( 'FIREWALL_NOVA_COMPUTE_RULES' ) manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages): global compute_hosts, network_hosts ssh_hostkeys = '' for host in compute_hosts: try: host_name, host_aliases, host_addrs = socket.gethostbyaddr(host) except socket.herror: host_name, host_aliases, host_addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' % host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() config['SSH_HOST_NAME'] = host_name config['SSH_HOST_ALIASES'] = ','.join( '"%s"' % addr for addr in host_aliases + host_addrs) config['SSH_HOST_KEY'] = host_key_data config['SSH_HOST_KEY_TYPE'] = host_key_type ssh_hostkeys += getManifestTemplate("sshkey.pp") for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption( "DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF']) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself messages.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': mq_template = get_mq(config, "nova_ceilometer") manifestdata += getManifestTemplate(mq_template) manifestdata += getManifestTemplate("nova_ceilometer.pp") config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST'] config['FIREWALL_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_PORTS'] = "'5900-5999'" config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_PROTOCOL'] = 'tcp' manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages): global compute_hosts, network_hosts ssh_hostkeys = '' for host in compute_hosts: try: host_name, host_aliases, host_addrs = socket.gethostbyaddr(host) except socket.herror: host_name, host_aliases, host_addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' % host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() config['SSH_HOST_NAME'] = host_name config['SSH_HOST_ALIASES'] = ','.join( '"%s"' % addr for addr in host_aliases + host_addrs ) config['SSH_HOST_KEY'] = host_key_data config['SSH_HOST_KEY_TYPE'] = host_key_type ssh_hostkeys += getManifestTemplate("sshkey.pp") for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption( "DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF'] ) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself messages.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': mq_template = get_mq(config, "nova_ceilometer") manifestdata += getManifestTemplate(mq_template) manifestdata += getManifestTemplate("nova_ceilometer.pp") config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST'] config['FIREWALL_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_PORTS'] = "'5900-5999'" config['FIREWALL_CHAIN'] = "INPUT" manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)
def create_compute_manifest(config, messages): global compute_hosts, network_hosts migrate_protocol = config['CONFIG_NOVA_COMPUTE_MIGRATE_PROTOCOL'] if migrate_protocol == 'ssh': config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+ssh://nova@%s/system?no_verify=1&' 'keyfile=/etc/nova/ssh/nova_migration_key' ) else: config['CONFIG_NOVA_COMPUTE_MIGRATE_URL'] = ( 'qemu+tcp://nova@%s/system' ) ssh_hostkeys = '' for host in compute_hosts: try: hostname, aliases, addrs = socket.gethostbyaddr(host) except socket.herror: hostname, aliases, addrs = (host, [], []) for hostkey in config['HOST_KEYS_%s' % host].split('\n'): hostkey = hostkey.strip() if not hostkey: continue _, host_key_type, host_key_data = hostkey.split() config['SSH_HOST_NAME'] = hostname config['SSH_HOST_ALIASES'] = ','.join( '"%s"' % addr for addr in aliases + addrs ) config['SSH_HOST_KEY'] = host_key_data config['SSH_HOST_KEY_TYPE'] = host_key_type ssh_hostkeys += getManifestTemplate("sshkey.pp") for host in compute_hosts: config["CONFIG_NOVA_COMPUTE_HOST"] = host manifestdata = getManifestTemplate("nova_compute.pp") if migrate_protocol == 'ssh' or migrate_protocol == 'tcp': for c_host in compute_hosts: config['FIREWALL_SERVICE_NAME'] = "nova qemu migration" config['FIREWALL_PORTS'] = ['16509'] config['FIREWALL_PORTS'].append('49152-49215') config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_PROTOCOL'] = 'tcp' config['FIREWALL_ALLOWED'] = "'%s'" % c_host config['FIREWALL_SERVICE_ID'] = ("nova_qemu_migration_%s_%s" % (host, c_host)) manifestdata += getManifestTemplate("firewall.pp") if config['CONFIG_VMWARE_BACKEND'] == 'y': manifestdata += getManifestTemplate("nova_compute_vmware.pp") else: manifestdata += getManifestTemplate("nova_compute_libvirt.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster'): manifestdata += getManifestTemplate("nova_gluster.pp") if (config['CONFIG_VMWARE_BACKEND'] != 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs'): manifestdata += getManifestTemplate("nova_nfs.pp") manifestfile = "%s_nova.pp" % host nova_config_options = NovaConfig() if config['CONFIG_NEUTRON_INSTALL'] != 'y': if host not in network_hosts: nova_config_options.addOption( "DEFAULT/flat_interface", config['CONFIG_NOVA_COMPUTE_PRIVIF'] ) check_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) try: bring_up_ifcfg(host, config['CONFIG_NOVA_COMPUTE_PRIVIF']) except ScriptRuntimeError as ex: # just warn user to do it by himself messages.append(str(ex)) if config['CONFIG_CEILOMETER_INSTALL'] == 'y': mq_template = get_mq(config, "nova_ceilometer") manifestdata += getManifestTemplate(mq_template) manifestdata += getManifestTemplate("nova_ceilometer.pp") config['FIREWALL_PORTS'] = ['5900-5999'] if migrate_protocol == 'tcp': config['FIREWALL_PORTS'].append('16509') config['FIREWALL_ALLOWED'] = "'%s'" % config['CONFIG_CONTROLLER_HOST'] config['FIREWALL_SERVICE_NAME'] = "nova compute" config['FIREWALL_SERVICE_ID'] = "nova_compute" config['FIREWALL_CHAIN'] = "INPUT" config['FIREWALL_PROTOCOL'] = 'tcp' manifestdata += getManifestTemplate("firewall.pp") manifestdata += "\n" + nova_config_options.getManifestEntry() manifestdata += "\n" + ssh_hostkeys appendManifestFile(manifestfile, manifestdata)