def _configure_neutron(self, nova_conf): params = self.get_keystone_params('nova') params['neutron'] = net_helper.get_shared_params( ip=self.installer.get_option('ip'), **self.installer.get_option('neutron')) nova_conf.add("network_api_class", "nova.network.neutronv2.api.API") nova_conf.add("neutron_admin_username", params['service_user']) nova_conf.add("neutron_admin_password", params['service_password']) nova_conf.add("neutron_admin_auth_url", params['endpoints']['admin']['uri']) nova_conf.add("neutron_auth_strategy", "keystone") nova_conf.add("neutron_admin_tenant_name", params['service_tenant']) nova_conf.add("neutron_url", params['neutron']['endpoints']['admin']['uri']) libvirt_vif_drivers = { "linuxbridge": "nova.virt.libvirt.vif.NeutronLinuxBridgeVIFDriver", "openvswitch": "nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver", } # FIXME(aababilov): error on KeyError nova_conf.add( "libvirt_vif_driver", libvirt_vif_drivers[self.installer.get_option('neutron-core-plugin')]) # FIXME(aababilov): add for linuxbridge: nova_conf.add("libvirt_vif_type", "ethernet") nova_conf.add("connection_type", "libvirt") nova_conf.add("neutron_use_dhcp", self.installer.get_bool_option('neutron-use-dhcp'))
def post_start(self): if not sh.isfile(self.init_fn) and self.get_bool_option('do-init'): self.wait_active() LOG.info("Running commands to initialize keystone.") (fn, contents) = utils.load_template(self.name, INIT_WHAT_FN) LOG.debug("Initializing with contents of %s", fn) params = {} params['keystone'] = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self))) params['glance'] = ghelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('glance')) params['nova'] = nhelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('nova')) params['neutron'] = net_helper.get_shared_params(ip=self.get_option('ip'), **self.get_option('neutron')) params['cinder'] = chelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('cinder')) wait_urls = [ params['keystone']['endpoints']['admin']['uri'], params['keystone']['endpoints']['public']['uri'], ] for url in wait_urls: utils.wait_for_url(url) init_what = utils.load_yaml_text(contents) init_what = utils.expand_template_deep(init_what, params) try: init_how = khelper.Initializer(params['keystone']['service_token'], params['keystone']['endpoints']['admin']['uri']) init_how.initialize(**init_what) except RuntimeError: LOG.exception("Failed to initialize keystone, is the keystone client library available?") else: # Writing this makes sure that we don't init again sh.write_file(self.init_fn, utils.prettify_yaml(init_what)) LOG.info("If you wish to re-run initialization, delete %s", colorizer.quote(self.init_fn))
def _configure_neutron(self, nova_conf): params = self.get_keystone_params('nova') params['neutron'] = net_helper.get_shared_params( ip=self.installer.get_option('ip'), **self.installer.get_option('neutron')) nova_conf.add("network_api_class", "nova.network.neutronv2.api.API") nova_conf.add("neutron_admin_username", params['service_user']) nova_conf.add("neutron_admin_password", params['service_password']) nova_conf.add("neutron_admin_auth_url", params['endpoints']['admin']['uri']) nova_conf.add("neutron_auth_strategy", "keystone") nova_conf.add("neutron_admin_tenant_name", params['service_tenant']) nova_conf.add("neutron_url", params['neutron']['endpoints']['admin']['uri']) nova_conf.add("libvirt_vif_driver", "nova.virt.libvirt.vif.LibvirtGenericVIFDriver")