diff --git a/nova/conf/virt.py b/nova/conf/virt.py index b325a0586cb5..91f92ef5ad92 100644 --- a/nova/conf/virt.py +++ b/nova/conf/virt.py @@ -274,6 +274,35 @@ injected_network_template = cfg.StrOpt( default=paths.basedir_def('nova/virt/interfaces.template'), help='Template file for injected network') +# NOTE(yamahata): ListOpt won't work because the command may include a comma. +# For example: +# +# mkfs.ext4 -O dir_index,extent -E stride=8,stripe-width=16 +# --label %(fs_label)s %(target)s +# +# list arguments are comma separated and there is no way to escape such +# commas. +virt_mkfs = cfg.MultiStrOpt( + 'virt_mkfs', + default=[], + help='Name of the mkfs commands for ephemeral device. ' + 'The format is =') + +resize_fs_using_block_device = cfg.BoolOpt( + 'resize_fs_using_block_device', + default=False, + help='Attempt to resize the filesystem by accessing the ' + 'image over a block device. This is done by the host ' + 'and may not be necessary if the image contains a recent ' + 'version of cloud-init. Possible mechanisms require ' + 'the nbd driver (for qcow and raw), or loop (for raw).') + +timeout_nbd = cfg.IntOpt( + 'timeout_nbd', + default=10, + help='Amount of time, in seconds, to wait for NBD ' + 'device start up.') + ALL_OPTS = [vcpu_pin_set, compute_driver, default_ephemeral_format, @@ -284,7 +313,10 @@ ALL_OPTS = [vcpu_pin_set, firewall_driver, allow_same_net_traffic, force_raw_images, - injected_network_template] + injected_network_template, + virt_mkfs, + resize_fs_using_block_device, + timeout_nbd] def register_opts(conf): diff --git a/nova/virt/disk/api.py b/nova/virt/disk/api.py index acad7c7e7dc2..7f699939c5a2 100644 --- a/nova/virt/disk/api.py +++ b/nova/virt/disk/api.py @@ -31,7 +31,6 @@ if os.name != 'nt': import crypt from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import jsonutils @@ -49,32 +48,7 @@ from nova.virt import images LOG = logging.getLogger(__name__) -disk_opts = [ - # NOTE(yamahata): ListOpt won't work because the command may include a - # comma. For example: - # - # mkfs.ext4 -O dir_index,extent -E stride=8,stripe-width=16 - # --label %(fs_label)s %(target)s - # - # list arguments are comma separated and there is no way to - # escape such commas. - # - cfg.MultiStrOpt('virt_mkfs', - default=[], - help='Name of the mkfs commands for ephemeral device. ' - 'The format is ='), - - cfg.BoolOpt('resize_fs_using_block_device', - default=False, - help='Attempt to resize the filesystem by accessing the ' - 'image over a block device. This is done by the host ' - 'and may not be necessary if the image contains a recent ' - 'version of cloud-init. Possible mechanisms require ' - 'the nbd driver (for qcow and raw), or loop (for raw).'), - ] - CONF = nova.conf.CONF -CONF.register_opts(disk_opts) _MKFS_COMMAND = {} _DEFAULT_MKFS_COMMAND = None diff --git a/nova/virt/disk/mount/nbd.py b/nova/virt/disk/mount/nbd.py index 21b91c9f1591..e368bdee3feb 100644 --- a/nova/virt/disk/mount/nbd.py +++ b/nova/virt/disk/mount/nbd.py @@ -18,24 +18,16 @@ import random import re import time -from oslo_config import cfg from oslo_log import log as logging +import nova.conf from nova.i18n import _, _LE, _LI, _LW from nova import utils from nova.virt.disk.mount import api LOG = logging.getLogger(__name__) -nbd_opts = [ - cfg.IntOpt('timeout_nbd', - default=10, - help='Amount of time, in seconds, to wait for NBD ' - 'device start up.'), - ] - -CONF = cfg.CONF -CONF.register_opts(nbd_opts) +CONF = nova.conf.CONF NBD_DEVICE_RE = re.compile('nbd[0-9]+') diff --git a/nova/virt/opts.py b/nova/virt/opts.py index 0754547c848b..3826863eb1ee 100644 --- a/nova/virt/opts.py +++ b/nova/virt/opts.py @@ -14,8 +14,6 @@ import itertools import nova.conf import nova.virt.configdrive -import nova.virt.disk.api -import nova.virt.disk.mount.nbd import nova.virt.disk.vfs.guestfs import nova.virt.hyperv.pathutils import nova.virt.hyperv.vif @@ -51,8 +49,6 @@ def list_opts(): ('DEFAULT', itertools.chain( nova.virt.configdrive.configdrive_opts, - nova.virt.disk.api.disk_opts, - nova.virt.disk.mount.nbd.nbd_opts, nova.virt.imagecache.imagecache_opts, )), ('guestfs', nova.virt.disk.vfs.guestfs.guestfs_opts),