config options: Centralise 'virt.imagecache' options

Add options from 'virt.imagecache'. These options are part of the
'DEFAULT' group but are included in the "nova.conf.virt" file in hope
that they can eventually be moved to their own group.

Change-Id: I0e683c08b0479e41487c6b05de7d588f5d88ad0e
Implements: bp centralize-config-options-newton
This commit is contained in:
Stephen Finucane 2016-01-14 10:44:05 +00:00
parent 281ed64d1a
commit 1154923f8e
12 changed files with 42 additions and 47 deletions

View File

@ -267,7 +267,6 @@ CONF.register_opts(instance_cleaning_opts)
CONF.import_opt('console_topic', 'nova.console.rpcapi')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('enabled', 'nova.spice', group='spice')
CONF.import_opt('image_cache_manager_interval', 'nova.virt.imagecache')
CONF.import_opt('enabled', 'nova.mks', group='mks')
CONF.import_opt('mksproxy_base_url', 'nova.mks', group='mks')
CONF.import_opt('destroy_after_evacuate', 'nova.utils', group='workarounds')

View File

@ -299,6 +299,31 @@ timeout_nbd = cfg.IntOpt(
help='Amount of time, in seconds, to wait for NBD '
'device start up.')
image_cache_manager_interval = cfg.IntOpt(
'image_cache_manager_interval',
default=2400,
help='Number of seconds to wait between runs of the image '
'cache manager. Set to -1 to disable. '
'Setting this to 0 will run at the default rate.')
image_cache_subdirectory_name = cfg.StrOpt(
'image_cache_subdirectory_name',
default='_base',
help='Where cached images are stored under $instances_path. '
'This is NOT the full path - just a folder name. '
'For per-compute-host cached images, set to _base_$my_ip')
remove_unused_base_images = cfg.BoolOpt(
'remove_unused_base_images',
default=True,
help='Should unused base images be removed?')
remove_unused_original_minimum_age_seconds = cfg.IntOpt(
'remove_unused_original_minimum_age_seconds',
default=(24 * 3600),
help='Unused unresized base images younger than this will not '
'be removed')
ALL_OPTS = [vcpu_pin_set,
compute_driver,
default_ephemeral_format,
@ -312,7 +337,11 @@ ALL_OPTS = [vcpu_pin_set,
injected_network_template,
virt_mkfs,
resize_fs_using_block_device,
timeout_nbd]
timeout_nbd,
image_cache_manager_interval,
image_cache_subdirectory_name,
remove_unused_base_images,
remove_unused_original_minimum_age_seconds]
def register_opts(conf):

View File

@ -58,6 +58,7 @@ from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
from nova.compute import vm_states
import nova.conf
from nova import context
from nova import db
from nova import exception
@ -106,11 +107,10 @@ host.libvirt = fakelibvirt
libvirt_guest.libvirt = fakelibvirt
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('my_ip', 'nova.netconf')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
CONF.import_opt('instances_path', 'nova.compute.manager')
_fake_network_info = fake_network.fake_get_instance_nw_info

View File

@ -22,7 +22,6 @@ import time
import mock
from oslo_concurrency import lockutils
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import formatters
from oslo_log import log as logging
from oslo_serialization import jsonutils
@ -30,6 +29,7 @@ from oslo_utils import importutils
from six.moves import cStringIO
from nova import conductor
import nova.conf
from nova import context
from nova import objects
from nova import test
@ -38,7 +38,7 @@ from nova import utils
from nova.virt.libvirt import imagecache
from nova.virt.libvirt import utils as libvirt_utils
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova import block_device
from nova.compute import vm_states
import nova.conf
from nova import context
from nova import objects
from nova.objects import block_device as block_device_obj
@ -23,7 +22,7 @@ from nova import test
from nova.tests.unit import fake_instance
from nova.virt import imagecache
CONF = cfg.CONF
CONF = nova.conf.CONF
swap_bdm_128 = [block_device.BlockDeviceDict(
{'id': 1, 'instance_uuid': 'fake-instance',

View File

@ -25,7 +25,6 @@ import datetime
from eventlet import greenthread
import mock
from mox3 import mox
from oslo_config import cfg
from oslo_utils import fixture as utils_fixture
from oslo_utils import units
from oslo_utils import uuidutils
@ -39,6 +38,7 @@ from nova.compute import api as compute_api
from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_states
import nova.conf
from nova import context
from nova import exception
from nova.image import glance
@ -66,10 +66,8 @@ from nova.virt.vmwareapi import vm_util
from nova.virt.vmwareapi import vmops
from nova.virt.vmwareapi import volumeops
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('remove_unused_original_minimum_age_seconds',
'nova.virt.imagecache')
def _fake_create_session(inst):

View File

@ -13,35 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova.compute import task_states
from nova.compute import vm_states
import nova.conf
from nova import objects
from nova.virt import block_device as driver_block_device
imagecache_opts = [
cfg.IntOpt('image_cache_manager_interval',
default=2400,
help='Number of seconds to wait between runs of the image '
'cache manager. Set to -1 to disable. '
'Setting this to 0 will run at the default rate.'),
cfg.StrOpt('image_cache_subdirectory_name',
default='_base',
help='Where cached images are stored under $instances_path. '
'This is NOT the full path - just a folder name. '
'For per-compute-host cached images, set to _base_$my_ip'),
cfg.BoolOpt('remove_unused_base_images',
default=True,
help='Should unused base images be removed?'),
cfg.IntOpt('remove_unused_original_minimum_age_seconds',
default=(24 * 3600),
help='Unused unresized base images younger than this will not '
'be removed'),
]
CONF = cfg.CONF
CONF.register_opts(imagecache_opts)
CONF = nova.conf.CONF
CONF.import_opt('host', 'nova.netconf')

View File

@ -73,7 +73,6 @@ __imagebackend_opts = [
CONF = nova.conf.CONF
CONF.register_opts(__imagebackend_opts, 'libvirt')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
CONF.import_opt('rbd_user', 'nova.virt.libvirt.volume.net', group='libvirt')
CONF.import_opt('rbd_secret_uuid', 'nova.virt.libvirt.volume.net',
group='libvirt')

View File

@ -32,6 +32,7 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import fileutils
import nova.conf
from nova.i18n import _LE
from nova.i18n import _LI
from nova.i18n import _LW
@ -67,10 +68,9 @@ imagecache_opts = [
help='How frequently to checksum base images'),
]
CONF = cfg.CONF
CONF = nova.conf.CONF
CONF.register_opts(imagecache_opts, 'libvirt')
CONF.import_opt('instances_path', 'nova.compute.manager')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
def get_cache_fname(images, key):

View File

@ -15,7 +15,6 @@ import itertools
import nova.conf
import nova.virt.configdrive
import nova.virt.disk.vfs.guestfs
import nova.virt.imagecache
import nova.virt.libvirt.driver
import nova.virt.libvirt.imagebackend
import nova.virt.libvirt.imagecache
@ -55,7 +54,6 @@ def list_opts():
('DEFAULT',
itertools.chain(
nova.virt.configdrive.configdrive_opts,
nova.virt.imagecache.imagecache_opts,
)),
('guestfs', nova.virt.disk.vfs.guestfs.guestfs_opts),
('libvirt',

View File

@ -49,8 +49,6 @@ from nova.virt.vmwareapi import ds_util
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('remove_unused_original_minimum_age_seconds',
'nova.virt.imagecache')
TIMESTAMP_PREFIX = 'ts-'
TIMESTAMP_FORMAT = '%Y-%m-%d-%H-%M-%S'

View File

@ -74,9 +74,6 @@ vmops_opts = [
CONF = nova.conf.CONF
CONF.register_opts(vmops_opts, 'vmware')
CONF.import_opt('image_cache_subdirectory_name', 'nova.virt.imagecache')
CONF.import_opt('remove_unused_base_images', 'nova.virt.imagecache')
CONF.import_opt('my_ip', 'nova.netconf')
LOG = logging.getLogger(__name__)