Config options: centralize "configdrive" options

This change moves all of the configuration options previously defined in
nova/virt/configdrive.py to the new centralized nova/conf directory.

A subsequent patch will then improve the help texts.

Implements blueprint centralize-config-options-newton
Change-Id: Ic3a0f68cb1608ec9c379cf2b9419d5e681777d3f
This commit is contained in:
Esra Celik 2015-12-09 11:23:15 +02:00
parent 74572c7d0c
commit eaeab5e935
4 changed files with 50 additions and 24 deletions

View File

@ -31,7 +31,7 @@ from nova.conf import cert
from nova.conf import cloudpipe
from nova.conf import compute
from nova.conf import conductor
# from nova.conf import configdrive
from nova.conf import configdrive
# from nova.conf import console
from nova.conf import consoleauth
# from nova.conf import cors
@ -96,7 +96,7 @@ cert.register_opts(CONF)
cloudpipe.register_opts(CONF)
compute.register_opts(CONF)
conductor.register_opts(CONF)
# configdrive.register_opts(CONF)
configdrive.register_opts(CONF)
# console.register_opts(CONF)
consoleauth.register_opts(CONF)
# cors.register_opts(CONF)

46
nova/conf/configdrive.py Normal file
View File

@ -0,0 +1,46 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
config_drive_format_opt = cfg.StrOpt('config_drive_format',
default='iso9660',
choices=('iso9660', 'vfat'),
help="""
Configuration drive format
""")
force_config_drive_opt = cfg.BoolOpt('force_config_drive',
default=False,
help="""
Force injection to take place on a config drive
""")
mkisofs_cmd_opt = cfg.StrOpt('mkisofs_cmd',
default='genisoimage',
help="""
Name and optionally path of the tool used for ISO image creation
""")
ALL_OPTS = [config_drive_format_opt,
force_config_drive_opt,
mkisofs_cmd_opt]
def register_opts(conf):
conf.register_opts(ALL_OPTS)
def list_opts():
return {"DEFAULT": ALL_OPTS}

View File

@ -18,31 +18,16 @@
import os
import shutil
from oslo_config import cfg
from oslo_utils import fileutils
from oslo_utils import units
import nova.conf
from nova import exception
from nova.objects import fields
from nova import utils
from nova import version
configdrive_opts = [
cfg.StrOpt('config_drive_format',
default='iso9660',
choices=('iso9660', 'vfat'),
help='Config drive format.'),
cfg.BoolOpt('force_config_drive',
help='Force injection to take place on a config drive',
default=False),
cfg.StrOpt('mkisofs_cmd',
default='genisoimage',
help='Name and optionally path of the tool used for '
'ISO image creation')
]
CONF = cfg.CONF
CONF.register_opts(configdrive_opts)
CONF = nova.conf.CONF
# Config drives are 64mb, if we can't size to the exact size of the data
CONFIGDRIVESIZE_BYTES = 64 * units.Mi

View File

@ -13,7 +13,6 @@
import itertools
import nova.conf
import nova.virt.configdrive
import nova.virt.libvirt.driver
import nova.virt.libvirt.imagebackend
import nova.virt.libvirt.imagecache
@ -49,10 +48,6 @@ import nova.virt.xenapi.volume_utils
def list_opts():
return [
('DEFAULT',
itertools.chain(
nova.virt.configdrive.configdrive_opts,
)),
('libvirt',
itertools.chain(
nova.virt.libvirt.driver.libvirt_opts,