def _setup_db(self): dbhelper.drop_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self))) dbhelper.create_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))
def setup_db(self): dbhelper.drop_db( distro=self.installer.distro, dbtype=self.installer.get_option("db", "type"), dbname=self.DB_NAME, **utils.merge_dicts(self.installer.get_option("db"), dbhelper.get_shared_passwords(self.installer)) ) dbhelper.create_db( distro=self.installer.distro, dbtype=self.installer.get_option("db", "type"), dbname=self.DB_NAME, **utils.merge_dicts(self.installer.get_option("db"), dbhelper.get_shared_passwords(self.installer)) )
def _setup_db(self): dbhelper.drop_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self))) # Explicitly use latin1: to avoid lp#829209, nova expects the database to # use latin1 by default, and then upgrades the database to utf8 (see the # 082_essex.py in nova) dbhelper.create_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, charset='latin1', **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))
def _config_adjust_root(self, contents, fn): params = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self))) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set('DEFAULT', 'admin_token', params['service_token']) config.set('DEFAULT', 'admin_port', params['endpoints']['admin']['port']) config.set('DEFAULT', 'public_port', params['endpoints']['public']['port']) config.set('DEFAULT', 'verbose', True) config.set('DEFAULT', 'debug', True) if self.get_bool_option('enable-pki'): config.set('signing', 'token_format', 'PKI') for (k, v) in PKI_FILES.items(): path = sh.joinpths(self.link_dir, v) config.set('signing', k, path) else: config.set('signing', 'token_format', 'UUID') config.set('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog') config.remove_option('DEFAULT', 'log_config') config.set('sql', 'connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.set('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2") contents = config.stringify(fn) return contents
def _config_adjust_root(self, contents, fn): params = khelper.get_shared_params(**utils.merge_dicts( self.options, khelper.get_shared_passwords(self))) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set('DEFAULT', 'admin_token', params['service_token']) config.set('DEFAULT', 'admin_port', params['endpoints']['admin']['port']) config.set('DEFAULT', 'public_port', params['endpoints']['public']['port']) config.set('DEFAULT', 'verbose', True) config.set('DEFAULT', 'debug', True) if self.get_bool_option('enable-pki'): config.set('signing', 'token_format', 'PKI') for (k, v) in PKI_FILES.items(): path = sh.joinpths(self.link_dir, v) config.set('signing', k, path) else: config.set('signing', 'token_format', 'UUID') config.set('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog') config.remove_option('DEFAULT', 'log_config') config.set( 'sql', 'connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.set('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2") contents = config.stringify(fn) return contents
def pre_uninstall(self): dbtype = self.get_option("type") dbactions = self.distro.get_command_config(dbtype, quiet=True) try: if dbactions: LOG.info(("Attempting to reset your db password to %s so" " that we can set it the next time you install."), colorizer.quote(RESET_BASE_PW)) pwd_cmd = self.distro.get_command(dbtype, 'set_pwd') if pwd_cmd: LOG.info( "Ensuring your database is started before we operate on it." ) self.runtime.start() self.runtime.wait_active() params = { 'OLD_PASSWORD': dbhelper.get_shared_passwords(self)['pw'], 'NEW_PASSWORD': RESET_BASE_PW, 'USER': self.get_option("user", default_value='root'), } cmds = [{'cmd': pwd_cmd}] utils.execute_template(*cmds, params=params) except IOError: LOG.warn(( "Could not reset the database password. You might have to manually " "reset the password to %s before the next install"), colorizer.quote(RESET_BASE_PW))
def pre_uninstall(self): dbtype = self.get_option("type") dbactions = self.distro.get_command_config(dbtype, quiet=True) try: if dbactions: LOG.info( ("Attempting to reset your db password to %s so" " that we can set it the next time you install."), colorizer.quote(RESET_BASE_PW), ) pwd_cmd = self.distro.get_command(dbtype, "set_pwd") if pwd_cmd: LOG.info("Ensuring your database is started before we operate on it.") self.runtime.start() self.runtime.wait_active() params = { "OLD_PASSWORD": dbhelper.get_shared_passwords(self)["pw"], "NEW_PASSWORD": RESET_BASE_PW, "USER": self.get_option("user", default_value="root"), } cmds = [{"cmd": pwd_cmd}] utils.execute_template(*cmds, params=params) except IOError: LOG.warn( ( "Could not reset the database password. You might have to manually " "reset the password to %s before the next install" ), colorizer.quote(RESET_BASE_PW), )
def fetch_dbdsn(self): return dbhelper.fetch_dbdsn( dbname=self.DB_NAME, utf8=True, dbtype=self.installer.get_option('db', 'type'), **utils.merge_dicts(self.installer.get_option('db'), dbhelper.get_shared_passwords(self.installer)))
def _config_adjust_root(self, contents, fn): params = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self))) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set("DEFAULT", "admin_token", params["service_token"]) config.set("DEFAULT", "admin_port", params["endpoints"]["admin"]["port"]) config.set("DEFAULT", "public_port", params["endpoints"]["public"]["port"]) config.set("DEFAULT", "verbose", True) config.set("DEFAULT", "debug", True) config.set("catalog", "driver", "keystone.catalog.backends.sql.Catalog") config.remove_option("DEFAULT", "log_config") config.set( "sql", "connection", dbhelper.fetch_dbdsn( dbname=DB_NAME, utf8=True, dbtype=self.get_option("db", "type"), **utils.merge_dicts(self.get_option("db"), dbhelper.get_shared_passwords(self)) ), ) config.set("ec2", "driver", "keystone.contrib.ec2.backends.sql.Ec2") contents = config.stringify(fn) return contents
def _config_adjust_api(self, contents, fn): params = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images') config.set('DEFAULT', 'debug', self.get_bool_option('verbose', )) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) config.set('DEFAULT', 'default_store', 'file') config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir) config.set('DEFAULT', 'bind_port', params['endpoints']['public']['port']) config.set( 'DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) LOG.debug( "Ensuring file system store directory %r exists and is empty." % (img_store_dir)) sh.deldir(img_store_dir) self.tracewriter.dirs_made(*sh.mkdirslist(img_store_dir)) return config.stringify(fn)
def _setup_db(self): dbhelper.drop_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self))) # Explicitly use latin1: to avoid lp#829209, nova expects the database to # use latin1 by default, and then upgrades the database to utf8 (see the # 082_essex.py in nova) dbhelper.create_db(distro=self.distro, dbtype=self.get_option('db', 'type'), dbname=DB_NAME, charset='latin1', **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self)))
def post_install(self): comp.PkgInstallComponent.post_install(self) # Fix up the db configs self._configure_db_confs() # Extra actions to ensure we are granted access dbtype = self.get_option("type") dbactions = self.distro.get_command_config(dbtype, quiet=True) # Set your password try: if dbactions: pwd_cmd = self.distro.get_command(dbtype, 'set_pwd') if pwd_cmd: LOG.info(("Attempting to set your db password" " just incase it wasn't set previously.")) LOG.info( "Ensuring your database is started before we operate on it." ) self.runtime.start() self.runtime.wait_active() params = { 'NEW_PASSWORD': dbhelper.get_shared_passwords(self)['pw'], 'USER': self.get_option("user", default_value='root'), 'OLD_PASSWORD': RESET_BASE_PW, } cmds = [{'cmd': pwd_cmd}] utils.execute_template(*cmds, params=params) except IOError: LOG.warn( ("Couldn't set your db password. It might have already been " "set by a previous process.")) # Ensure access granted dbhelper.grant_permissions(dbtype, distro=self.distro, user=self.get_option("user", default_value='root'), restart_func=self.runtime.restart, **dbhelper.get_shared_passwords(self))
def config_params(self, config_fn): # This dictionary will be used for parameter replacement # In pre-install and post-install sections mp = comp.PkgInstallComponent.config_params(self, config_fn) mp.update({ 'PASSWORD': dbhelper.get_shared_passwords(self)['pw'], 'BOOT_START': "true", 'USER': self.get_option("user", default_value='root'), 'SERVICE_HOST': self.get_option('ip'), 'HOST_IP': self.get_option('ip'), }) return mp
def config_params(self, config_fn): # This dictionary will be used for parameter replacement # In pre-install and post-install sections mp = binstall.PkgInstallComponent.config_params(self, config_fn) mp.update( { "PASSWORD": dbhelper.get_shared_passwords(self)["pw"], "BOOT_START": "true", "USER": self.get_option("user", default_value="root"), "SERVICE_HOST": self.get_option("ip"), "HOST_IP": self.get_option("ip"), } ) return mp
def post_install(self): binstall.PkgInstallComponent.post_install(self) # Fix up the db configs self._configure_db_confs() # Extra actions to ensure we are granted access dbtype = self.get_option("type") dbactions = self.distro.get_command_config(dbtype, quiet=True) # Set your password try: if dbactions: pwd_cmd = self.distro.get_command(dbtype, "set_pwd") if pwd_cmd: LOG.info(("Attempting to set your db password" " just incase it wasn't set previously.")) LOG.info("Ensuring your database is started before we operate on it.") self.runtime.start() self.runtime.wait_active() params = { "NEW_PASSWORD": dbhelper.get_shared_passwords(self)["pw"], "USER": self.get_option("user", default_value="root"), "OLD_PASSWORD": RESET_BASE_PW, } cmds = [{"cmd": pwd_cmd}] utils.execute_template(*cmds, params=params) except IOError: LOG.warn(("Couldn't set your db password. It might have already been " "set by a previous process.")) # Ensure access granted dbhelper.grant_permissions( dbtype, distro=self.distro, user=self.get_option("user", default_value="root"), restart_func=self.runtime.restart, **dbhelper.get_shared_passwords(self) )
def _config_adjust_api_reg(self, contents, fn): gparams = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set('DEFAULT', 'debug', self.get_bool_option('verbose')) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) if fn in [REG_CONF]: config.set('DEFAULT', 'bind_port', gparams['endpoints']['registry']['port']) else: config.set('DEFAULT', 'bind_port', gparams['endpoints']['public']['port']) config.set( 'DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) for (k, v) in self._fetch_keystone_params().items(): config.set('keystone_authtoken', k, v) if fn in [API_CONF]: config.set('DEFAULT', 'default_store', 'file') img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images') config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir) LOG.debug( "Ensuring file system store directory %r exists and is empty." % (img_store_dir)) if sh.isdir(img_store_dir): sh.deldir(img_store_dir) sh.mkdirslist(img_store_dir, tracewriter=self.tracewriter, adjust_suids=True) return config.stringify(fn)
def _config_adjust_root(self, contents, fn): params = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self))) with io.BytesIO(contents) as stream: config = cfg.RewritableConfigParser() config.readfp(stream) config.set('DEFAULT', 'admin_token', params['service_token']) config.set('DEFAULT', 'admin_port', params['endpoints']['admin']['port']) config.set('DEFAULT', 'public_port', params['endpoints']['public']['port']) config.set('DEFAULT', 'verbose', True) config.set('DEFAULT', 'debug', True) config.set('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog') config.remove_option('DEFAULT', 'log_config') config.set('sql', 'connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.set('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2") contents = config.stringify(fn) return contents
def config_params(self, config_fn): # This dict will be used to fill in the configuration # params with actual values mp = comp.PythonInstallComponent.config_params(self, config_fn) if config_fn == HORIZON_APACHE_CONF: (user, group) = self._get_apache_user_group() mp['GROUP'] = group mp['USER'] = user mp['HORIZON_DIR'] = self.get_option('app_dir') mp['HORIZON_PORT'] = self.get_int_option('port', default_value=80) mp['APACHE_NAME'] = self.distro.get_command_config('apache', 'name') mp['ERROR_LOG'] = self.error_log mp['ACCESS_LOG'] = self.access_log mp['BLACK_HOLE_DIR'] = self.blackhole_dir else: mp['OPENSTACK_HOST'] = self.get_option('ip') mp['DB_NAME'] = DB_NAME mp['DB_USER'] = self.get_option('db', 'user') mp['DB_PASSWORD'] = dbhelper.get_shared_passwords(self)['pw'] mp['DB_HOST'] = self.get_option("db", "host") mp['DB_PORT'] = self.get_option("db", "port") return mp
def _config_adjust_registry(self, contents, fn): params = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set('DEFAULT', 'debug', self.get_bool_option('verbose')) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) config.set('DEFAULT', 'bind_port', params['endpoints']['registry']['port']) config.set( 'DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts( self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) return config.stringify(fn) return contents
def config_params(self, config_fn): # This dict will be used to fill in the configuration # params with actual values mp = comp.PythonInstallComponent.config_params(self, config_fn) if config_fn == HORIZON_APACHE_CONF: (user, group) = self._get_apache_user_group() mp['GROUP'] = group mp['USER'] = user mp['HORIZON_DIR'] = self.get_option('app_dir') mp['HORIZON_PORT'] = self.get_int_option('port', default_value=80) mp['APACHE_NAME'] = self.distro.get_command_config( 'apache', 'name') mp['ERROR_LOG'] = self.error_log mp['ACCESS_LOG'] = self.access_log mp['BLACK_HOLE_DIR'] = self.blackhole_dir else: mp['OPENSTACK_HOST'] = self.get_option('ip') mp['DB_NAME'] = DB_NAME mp['DB_USER'] = self.get_option('db', 'user') mp['DB_PASSWORD'] = dbhelper.get_shared_passwords(self)['pw'] mp['DB_HOST'] = self.get_option("db", "host") mp['DB_PORT'] = self.get_option("db", "port") return mp
def _config_adjust_api_reg(self, contents, fn): gparams = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.create_parser(cfg.RewritableConfigParser, self) config.readfp(stream) config.set('DEFAULT', 'debug', self.get_bool_option('verbose')) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) if fn in [REG_CONF]: config.set('DEFAULT', 'bind_port', gparams['endpoints']['registry']['port']) else: config.set('DEFAULT', 'bind_port', gparams['endpoints']['public']['port']) config.set('DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) for (k, v) in self._fetch_keystone_params().items(): config.set('keystone_authtoken', k, v) if fn in [API_CONF]: config.set('DEFAULT', 'default_store', 'file') img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images') config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir) LOG.debug("Ensuring file system store directory %r exists and is empty." % (img_store_dir)) if sh.isdir(img_store_dir): sh.deldir(img_store_dir) sh.mkdirslist(img_store_dir, tracewriter=self.tracewriter, adjust_suids=True) return config.stringify(fn)
def _config_adjust_registry(self, contents, fn): params = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.RewritableConfigParser() config.readfp(stream) config.set('DEFAULT', 'debug', self.get_bool_option('verbose')) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) config.set('DEFAULT', 'bind_port', params['endpoints']['registry']['port']) config.set('DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) return config.stringify(fn) return contents
def _config_adjust_api(self, contents, fn): params = ghelper.get_shared_params(**self.options) with io.BytesIO(contents) as stream: config = cfg.RewritableConfigParser() config.readfp(stream) img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images') config.set('DEFAULT', 'debug', self.get_bool_option('verbose',)) config.set('DEFAULT', 'verbose', self.get_bool_option('verbose')) config.set('DEFAULT', 'default_store', 'file') config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir) config.set('DEFAULT', 'bind_port', params['endpoints']['public']['port']) config.set('DEFAULT', 'sql_connection', dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.get_option('db', 'type'), **utils.merge_dicts(self.get_option('db'), dbhelper.get_shared_passwords(self)))) config.remove_option('DEFAULT', 'log_file') config.set('paste_deploy', 'flavor', self.get_option('paste_flavor')) LOG.debug("Ensuring file system store directory %r exists and is empty." % (img_store_dir)) sh.deldir(img_store_dir) self.tracewriter.dirs_made(*sh.mkdirslist(img_store_dir)) return config.stringify(fn)
def warm_configs(self): dbhelper.get_shared_passwords(self)
def generate(self, fn): # Everything built goes in here nova_conf = Conf(fn, self.installer) # Used more than once so we calculate it ahead of time hostip = self.installer.get_option('ip') nova_conf.add('verbose', self.installer.get_bool_option('log_verbose')) # Allow destination machine to match source for resize. nova_conf.add('allow_resize_to_same_host', True) # Which scheduler do u want? nova_conf.add('compute_scheduler_driver', self.installer.get_option('scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler')) # Rate limit the api?? nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit')) # Ensure the policy.json is referenced correctly nova_conf.add('policy_file', '/etc/nova/policy.json') # Setup nova network/settings self._configure_network_settings(nova_conf) # Setup nova volume/settings if self.installer.get_option('volumes'): self._configure_vols(nova_conf) # The ip of where we are running nova_conf.add('my_ip', hostip) # Setup your sql connection dbdsn = dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.installer.get_option('db', 'type'), **utils.merge_dicts(self.installer.get_option('db'), dbhelper.get_shared_passwords(self.installer))) nova_conf.add('sql_connection', dbdsn) # Configure anything libvirt related? virt_driver = canon_virt_driver(self.installer.get_option('virt_driver')) if virt_driver == 'libvirt': self._configure_libvirt(lv.canon_libvirt_type(self.installer.get_option('libvirt_type')), nova_conf) # How instances will be presented instance_template = "%s%s" % (self.installer.get_option('instance_name_prefix'), self.installer.get_option('instance_name_postfix')) if not instance_template: instance_template = 'instance-%08x' nova_conf.add('instance_name_template', instance_template) # Enable the standard extensions nova_conf.add('osapi_compute_extension', 'nova.api.openstack.compute.contrib.standard_extensions') # Auth will be using keystone nova_conf.add('auth_strategy', 'keystone') # Is config drive being forced on? if self.installer.get_bool_option('force_cfg_drive'): nova_conf.add('force_config_drive', 'always') # Don't always force images to raw, which makes things take time to get to raw... nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images')) # Add a checksum for images fetched for each hypervisor? # This check absorbs cpu cycles, warning.... nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images')) # Setup the interprocess locking directory (don't put me on shared storage) lock_path = self.installer.get_option('lock_path') if not lock_path: lock_path = sh.joinpths(self.installer.get_option('component_dir'), 'locks') sh.mkdirslist(lock_path, tracewriter=self.tracewriter) nova_conf.add('lock_path', lock_path) # Vnc settings setup self._configure_vnc(nova_conf) # Where our paste config is nova_conf.add('api_paste_config', self.installer.target_config(PASTE_CONF)) # What our imaging service will be self._configure_image_service(nova_conf, hostip) # Configs for ec2 / s3 stuff nova_conf.add('ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip)) nova_conf.add('s3_host', hostip) # How is your message queue setup? mq_type = canon_mq_type(self.installer.get_option('mq-type')) if mq_type == 'rabbit': nova_conf.add('rabbit_host', self.installer.get_option('rabbit', 'host', default_value=hostip)) nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw']) nova_conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id')) nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu') # The USB tablet device is meant to improve mouse behavior in # the VNC console, but it has the side effect of increasing # the CPU usage of an idle VM tenfold. nova_conf.add('use_usb_tablet', False) # Where instances will be stored instances_path = self.installer.get_option('instances_path') if not instances_path: instances_path = sh.joinpths(self.installer.get_option('component_dir'), 'instances') self._configure_instances_path(instances_path, nova_conf) # Is this a multihost setup? self._configure_multihost(nova_conf) # Handle any virt driver specifics self._configure_virt_driver(nova_conf) # Handle configuring the conductor service self._configure_conductor(nova_conf) # Annnnnd extract to finish return self._get_content(nova_conf)
def generate(self, fn): # Everything built goes in here nova_conf = Conf(fn) # Used more than once so we calculate it ahead of time hostip = self.installer.get_option('ip') nova_conf.add('verbose', self.installer.get_bool_option('verbose')) # Allow destination machine to match source for resize. nova_conf.add('allow_resize_to_same_host', True) # Which scheduler do u want? nova_conf.add('compute_scheduler_driver', self.installer.get_option('scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler')) # Rate limit the api?? nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit')) # Setup nova network/settings self._configure_network_settings(nova_conf) # Setup nova volume/settings if self.installer.get_option('volumes'): self._configure_vols(nova_conf) # The ip of where we are running nova_conf.add('my_ip', hostip) # Setup your sql connection dbdsn = dbhelper.fetch_dbdsn(dbname=DB_NAME, utf8=True, dbtype=self.installer.get_option('db', 'type'), **utils.merge_dicts(self.installer.get_option('db'), dbhelper.get_shared_passwords(self.installer))) nova_conf.add('sql_connection', dbdsn) # Configure anything libvirt related? virt_driver = canon_virt_driver(self.installer.get_option('virt_driver')) if virt_driver == 'libvirt': self._configure_libvirt(lv.canon_libvirt_type(self.installer.get_option('libvirt_type')), nova_conf) # How instances will be presented instance_template = "%s%s" % (self.installer.get_option('instance_name_prefix'), self.installer.get_option('instance_name_postfix')) if not instance_template: instance_template = 'instance-%08x' nova_conf.add('instance_name_template', instance_template) # Enable the standard extensions nova_conf.add('osapi_compute_extension', 'nova.api.openstack.compute.contrib.standard_extensions') # Auth will be using keystone nova_conf.add('auth_strategy', 'keystone') # Don't always force images to raw nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images')) # Add a checksum for images fetched to a hypervisor nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images')) # Vnc settings setup self._configure_vnc(nova_conf) # Where our paste config is nova_conf.add('api_paste_config', self.installer.target_config(PASTE_CONF)) # What our imaging service will be self._configure_image_service(nova_conf, hostip) # Configs for ec2 / s3 stuff nova_conf.add('ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip)) nova_conf.add('s3_host', hostip) # How is your message queue setup? mq_type = canon_mq_type(self.installer.get_option('mq-type')) if mq_type == 'rabbit': nova_conf.add('rabbit_host', self.installer.get_option('rabbit', 'host', default_value=hostip)) nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw']) nova_conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id')) nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu') # Where instances will be stored instances_path = self.installer.get_option('instances_path') if not instances_path: instances_path = sh.joinpths(self.installer.get_option('component_dir'), 'instances') self._configure_instances_path(instances_path, nova_conf) # Is this a multihost setup? self._configure_multihost(nova_conf) # Handle any virt driver specifics self._configure_virt_driver(nova_conf) # Annnnnd extract to finish return self._get_content(nova_conf)
def generate(self, fn): # Everything built goes in here nova_conf = Conf(fn, self.installer) # Used more than once so we calculate it ahead of time hostip = self.installer.get_option('ip') nova_conf.add('verbose', self.installer.get_bool_option('verbose')) # Allow destination machine to match source for resize. nova_conf.add('allow_resize_to_same_host', True) # Which scheduler do u want? nova_conf.add( 'compute_scheduler_driver', self.installer.get_option( 'scheduler', default_value='nova.scheduler.filter_scheduler.FilterScheduler' )) # Rate limit the api?? nova_conf.add('api_rate_limit', self.installer.get_bool_option('api_rate_limit')) # Setup nova network/settings self._configure_network_settings(nova_conf) # Setup nova volume/settings if self.installer.get_option('volumes'): self._configure_vols(nova_conf) # The ip of where we are running nova_conf.add('my_ip', hostip) # Setup your sql connection dbdsn = dbhelper.fetch_dbdsn( dbname=DB_NAME, utf8=True, dbtype=self.installer.get_option('db', 'type'), **utils.merge_dicts(self.installer.get_option('db'), dbhelper.get_shared_passwords(self.installer))) nova_conf.add('sql_connection', dbdsn) # Configure anything libvirt related? virt_driver = canon_virt_driver( self.installer.get_option('virt_driver')) if virt_driver == 'libvirt': self._configure_libvirt( lv.canon_libvirt_type( self.installer.get_option('libvirt_type')), nova_conf) # How instances will be presented instance_template = "%s%s" % ( self.installer.get_option('instance_name_prefix'), self.installer.get_option('instance_name_postfix')) if not instance_template: instance_template = 'instance-%08x' nova_conf.add('instance_name_template', instance_template) # Enable the standard extensions nova_conf.add( 'osapi_compute_extension', 'nova.api.openstack.compute.contrib.standard_extensions') # Auth will be using keystone nova_conf.add('auth_strategy', 'keystone') # Is config drive being forced? if self.installer.get_bool_option('force_cfg_drive'): nova_conf.add('force_config_drive', 'always') # Don't always force images to raw nova_conf.add('force_raw_images', self.installer.get_bool_option('force_raw_images')) # Add a checksum for images fetched to a hypervisor nova_conf.add('checksum_base_images', self.installer.get_bool_option('checksum_base_images')) # Vnc settings setup self._configure_vnc(nova_conf) # Where our paste config is nova_conf.add('api_paste_config', self.installer.target_config(PASTE_CONF)) # What our imaging service will be self._configure_image_service(nova_conf, hostip) # Configs for ec2 / s3 stuff nova_conf.add( 'ec2_dmz_host', self.installer.get_option('ec2_dmz_host', default_value=hostip)) nova_conf.add('s3_host', hostip) # How is your message queue setup? mq_type = canon_mq_type(self.installer.get_option('mq-type')) if mq_type == 'rabbit': nova_conf.add( 'rabbit_host', self.installer.get_option('rabbit', 'host', default_value=hostip)) nova_conf.add('rabbit_password', rbhelper.get_shared_passwords(self.installer)['pw']) nova_conf.add('rabbit_userid', self.installer.get_option('rabbit', 'user_id')) nova_conf.add('rpc_backend', 'nova.rpc.impl_kombu') # The USB tablet device is meant to improve mouse behavior in # the VNC console, but it has the side effect of increasing # the CPU usage of an idle VM tenfold. nova_conf.add('use_usb_tablet', False) # Where instances will be stored instances_path = self.installer.get_option('instances_path') if not instances_path: instances_path = sh.joinpths( self.installer.get_option('component_dir'), 'instances') self._configure_instances_path(instances_path, nova_conf) # Is this a multihost setup? self._configure_multihost(nova_conf) # Handle any virt driver specifics self._configure_virt_driver(nova_conf) # Annnnnd extract to finish return self._get_content(nova_conf)