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
(cherry picked from commit f7b8805c3a)
This commit is contained in:
Greg Retkowski 2016-08-05 17:18:14 -07:00 committed by Amrith Kumar
parent c741175026
commit 48fe09a1b3
4 changed files with 22 additions and 3 deletions

View File

@ -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
------------------------------

View File

@ -64,7 +64,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.

View File

@ -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.

View File

@ -190,7 +190,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,