From f7b8805c3aed5b5cef01176cc1d9136bd31125fb Mon Sep 17 00:00:00 2001 From: Greg Retkowski Date: Fri, 5 Aug 2016 17:18:14 -0700 Subject: [PATCH] guest_id missing err, switch config_drive default This changes the default setting for use_nova_server_config_drive from False to True. By default, nova does not use a config drive for launched instances. Therefore trove must implicitly request the config drive be used so that it can inject guest_info.conf into the guest VM. This commit also adds an error to guestagent when guest_id is missing. If the guest_id configuration parameter is not set at guestagent startup it will throw a RuntimeError. This case typically occurs because guest_info.conf was not injected into the guest, or was not included in the set of configs that guestagent reads at startup. And finally, this commit adds a section in the 'building guest images' documentation describing how configuration is injected into the guest agent. Change-Id: I084c841472183893a63ca7b70d560f44a2f08901 Partial-Bug: 1609915 --- doc/source/dev/building_guest_images.rst | 14 ++++++++++++++ etc/trove/trove-taskmanager.conf.sample | 2 +- trove/cmd/guest.py | 7 ++++++- trove/common/cfg.py | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/source/dev/building_guest_images.rst b/doc/source/dev/building_guest_images.rst index 0c76e9675e..4e617050c8 100644 --- a/doc/source/dev/building_guest_images.rst +++ b/doc/source/dev/building_guest_images.rst @@ -79,6 +79,20 @@ API for the specific database. The Trove Guest Agent runs on the Trove Guest Instance. +------------------------------------------ +Injected Configuration for the Guest Agent +------------------------------------------ + +When TaskManager launches the guest VM it injects the specific settings +for the guest into the VM, into the file /etc/trove/conf.d/guest_info.conf. +The file is injected one of three ways. If use_heat=True, it is injected +during the heat launch process. If use_nova_server_config_drive=True +it is injected via ConfigDrive. Otherwise it is passed to the nova +create call as the 'files' parameter and will be injected based on +the configuration of Nova; the Nova default is to discard the files. +If the settings in guest_info.conf are not present on the guest +Guest Agent will fail to start up. + ------------------------------ Persistent Storage, Networking ------------------------------ diff --git a/etc/trove/trove-taskmanager.conf.sample b/etc/trove/trove-taskmanager.conf.sample index 135fd8e634..69a64ff22b 100644 --- a/etc/trove/trove-taskmanager.conf.sample +++ b/etc/trove/trove-taskmanager.conf.sample @@ -61,7 +61,7 @@ server_delete_time_out=480 # Nova server boot options # sets the --config-drive argument when doing a nova boot # (controls how file injection is handled by nova) -use_nova_server_config_drive = False +use_nova_server_config_drive = True # Configuration options for talking to nova via the novaclient. # These options are for an admin user in your keystone config. diff --git a/trove/cmd/guest.py b/trove/cmd/guest.py index 5d4c34dd23..36a9f017c0 100644 --- a/trove/cmd/guest.py +++ b/trove/cmd/guest.py @@ -40,10 +40,15 @@ def main(): from trove.guestagent import dbaas manager = dbaas.datastore_registry().get(CONF.datastore_manager) if not manager: - msg = ("Manager class not registered for datastore manager %s" % + msg = (_LE("Manager class not registered for datastore manager %s") % CONF.datastore_manager) raise RuntimeError(msg) + if not CONF.guest_id: + msg = (_LE("The guest_id parameter is not set. guest_info.conf " + "was not injected into the guest or not read by guestagent")) + raise RuntimeError(msg) + # rpc module must be loaded after decision about thread monkeypatching # because if thread module is not monkeypatched we can't use eventlet # executor from oslo_messaging library. diff --git a/trove/common/cfg.py b/trove/common/cfg.py index 201aa83c1d..6a32a4103b 100644 --- a/trove/common/cfg.py +++ b/trove/common/cfg.py @@ -191,7 +191,7 @@ common_opts = [ cfg.IntOpt('trove_conductor_workers', help='Number of workers for the Conductor service. The default ' 'will be the number of CPUs available.'), - cfg.BoolOpt('use_nova_server_config_drive', default=False, + cfg.BoolOpt('use_nova_server_config_drive', default=True, help='Use config drive for file injection when booting ' 'instance.'), cfg.BoolOpt('use_nova_server_volume', default=False,