Merge "Enable usage of config-drive for file injection"
This commit is contained in:
commit
cc6a281bd6
|
@ -84,6 +84,11 @@ mount_point = /var/lib/mysql
|
||||||
volume_time_out=30
|
volume_time_out=30
|
||||||
server_delete_time_out=480
|
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
|
||||||
|
|
||||||
# Configuration options for talking to nova via the novaclient.
|
# Configuration options for talking to nova via the novaclient.
|
||||||
# These options are for an admin user in your keystone config.
|
# These options are for an admin user in your keystone config.
|
||||||
# It proxy's the token received from the user to send to nova via this admin users creds,
|
# It proxy's the token received from the user to send to nova via this admin users creds,
|
||||||
|
|
|
@ -124,6 +124,9 @@ common_opts = [
|
||||||
cfg.IntOpt('trove_conductor_workers',
|
cfg.IntOpt('trove_conductor_workers',
|
||||||
help="Number of workers for the Conductor service. The default "
|
help="Number of workers for the Conductor service. The default "
|
||||||
"will be the number of CPUs available."),
|
"will be the number of CPUs available."),
|
||||||
|
cfg.BoolOpt('use_nova_server_config_drive', default=False,
|
||||||
|
help="Use config drive for file injection when booting "
|
||||||
|
"instance."),
|
||||||
cfg.BoolOpt('use_nova_server_volume', default=False),
|
cfg.BoolOpt('use_nova_server_volume', default=False),
|
||||||
cfg.BoolOpt('use_heat', default=False),
|
cfg.BoolOpt('use_heat', default=False),
|
||||||
cfg.StrOpt('device_path', default='/dev/vdb'),
|
cfg.StrOpt('device_path', default='/dev/vdb'),
|
||||||
|
|
|
@ -584,10 +584,13 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
|
||||||
userdata = f.read()
|
userdata = f.read()
|
||||||
name = self.hostname or self.name
|
name = self.hostname or self.name
|
||||||
bdmap = block_device_mapping
|
bdmap = block_device_mapping
|
||||||
|
config_drive = CONF.use_nova_server_config_drive
|
||||||
|
|
||||||
server = self.nova_client.servers.create(
|
server = self.nova_client.servers.create(
|
||||||
name, image_id, flavor_id, files=files, userdata=userdata,
|
name, image_id, flavor_id, files=files, userdata=userdata,
|
||||||
security_groups=security_groups, block_device_mapping=bdmap,
|
security_groups=security_groups, block_device_mapping=bdmap,
|
||||||
availability_zone=availability_zone, nics=nics)
|
availability_zone=availability_zone, nics=nics,
|
||||||
|
config_drive=config_drive)
|
||||||
LOG.debug("Created new compute instance %(server_id)s "
|
LOG.debug("Created new compute instance %(server_id)s "
|
||||||
"for id: %(id)s" %
|
"for id: %(id)s" %
|
||||||
{'server_id': server.id, 'id': self.id})
|
{'server_id': server.id, 'id': self.id})
|
||||||
|
|
|
@ -259,7 +259,7 @@ class FakeServers(object):
|
||||||
|
|
||||||
def create(self, name, image_id, flavor_ref, files=None, userdata=None,
|
def create(self, name, image_id, flavor_ref, files=None, userdata=None,
|
||||||
block_device_mapping=None, volume=None, security_groups=None,
|
block_device_mapping=None, volume=None, security_groups=None,
|
||||||
availability_zone=None, nics=None):
|
availability_zone=None, nics=None, config_drive=False):
|
||||||
id = "FAKE_%s" % uuid.uuid4()
|
id = "FAKE_%s" % uuid.uuid4()
|
||||||
if volume:
|
if volume:
|
||||||
volume = self.volumes.create(volume['size'], volume['name'],
|
volume = self.volumes.create(volume['size'], volume['name'],
|
||||||
|
|
|
@ -76,7 +76,7 @@ class fake_Server:
|
||||||
class fake_ServerManager:
|
class fake_ServerManager:
|
||||||
def create(self, name, image_id, flavor_id, files, userdata,
|
def create(self, name, image_id, flavor_id, files, userdata,
|
||||||
security_groups, block_device_mapping, availability_zone=None,
|
security_groups, block_device_mapping, availability_zone=None,
|
||||||
nics=None):
|
nics=None, config_drive=False):
|
||||||
server = fake_Server()
|
server = fake_Server()
|
||||||
server.id = "server_id"
|
server.id = "server_id"
|
||||||
server.name = name
|
server.name = name
|
||||||
|
|
Loading…
Reference in New Issue