Merge "Use oslo_config choices support"
This commit is contained in:
commit
a5b5b231f3
|
@ -66,8 +66,9 @@ ec2_opts = [
|
|||
help='The port of the EC2 API server'),
|
||||
cfg.StrOpt('ec2_scheme',
|
||||
default='http',
|
||||
choices=('http', 'https'),
|
||||
help='The protocol to use when connecting to the EC2 API '
|
||||
'server (http, https)'),
|
||||
'server'),
|
||||
cfg.StrOpt('ec2_path',
|
||||
default='/',
|
||||
help='The path prefix used to call the ec2 API server'),
|
||||
|
|
|
@ -44,7 +44,8 @@ cells_opts = [
|
|||
'Affects both memory and disk utilization'),
|
||||
cfg.StrOpt('cell_type',
|
||||
default='compute',
|
||||
help='Type of cell: api or compute'),
|
||||
choices=('api', 'compute'),
|
||||
help='Type of cell'),
|
||||
cfg.IntOpt("mute_child_interval",
|
||||
default=300,
|
||||
help='Number of seconds after which a lack of capability and '
|
||||
|
|
|
@ -218,8 +218,8 @@ timeout_opts = [
|
|||
running_deleted_opts = [
|
||||
cfg.StrOpt("running_deleted_instance_action",
|
||||
default="reap",
|
||||
choices=('noop', 'log', 'shutdown', 'reap'),
|
||||
help="Action to take if a running deleted instance is detected."
|
||||
" Valid options are 'noop', 'log', 'shutdown', or 'reap'. "
|
||||
"Set to 'noop' to take no action."),
|
||||
cfg.IntOpt("running_deleted_instance_poll_interval",
|
||||
default=1800,
|
||||
|
|
|
@ -48,6 +48,7 @@ glance_opts = [
|
|||
help='Default glance port'),
|
||||
cfg.StrOpt('protocol',
|
||||
default='http',
|
||||
choices=('http', 'https'),
|
||||
help='Default protocol to use when connecting to glance. '
|
||||
'Set to https for SSL.'),
|
||||
cfg.ListOpt('api_servers',
|
||||
|
|
|
@ -51,6 +51,7 @@ notify_opts = [
|
|||
'in the API service.'),
|
||||
cfg.StrOpt('default_notification_level',
|
||||
default='INFO',
|
||||
choices=('DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'),
|
||||
help='Default notification level for outgoing notifications'),
|
||||
cfg.StrOpt('default_publisher_id',
|
||||
help='Default publisher_id for outgoing notifications'),
|
||||
|
|
|
@ -6000,27 +6000,6 @@ class ComputeTestCase(BaseTestCase):
|
|||
|
||||
return admin_context, instance1, instance2
|
||||
|
||||
def test_cleanup_running_deleted_instances_unrecognized_value(self):
|
||||
admin_context = context.get_admin_context()
|
||||
deleted_at = (timeutils.utcnow() -
|
||||
datetime.timedelta(hours=1, minutes=5))
|
||||
instance = self._create_fake_instance_obj({"deleted_at": deleted_at,
|
||||
"deleted": True})
|
||||
self.flags(running_deleted_instance_action='foo-action')
|
||||
|
||||
with mock.patch.object(
|
||||
self.compute, '_get_instances_on_driver',
|
||||
return_value=[instance]):
|
||||
try:
|
||||
# We cannot simply use an assertRaises here because the
|
||||
# exception raised is too generally "Exception". To be sure
|
||||
# that the exception raised is the expected one, we check
|
||||
# the message.
|
||||
self.compute._cleanup_running_deleted_instances(admin_context)
|
||||
self.fail("Be sure this will never be executed.")
|
||||
except Exception as e:
|
||||
self.assertIn("Unrecognized value", six.text_type(e))
|
||||
|
||||
def test_cleanup_running_deleted_instances_reap(self):
|
||||
ctxt, inst1, inst2 = self._test_cleanup_running('reap')
|
||||
bdms = block_device_obj.block_device_make_list(ctxt, [])
|
||||
|
|
|
@ -679,11 +679,6 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
|
|||
config_drive_type = blockinfo.get_config_drive_type()
|
||||
self.assertEqual('disk', config_drive_type)
|
||||
|
||||
def test_get_config_drive_type_improper_value(self):
|
||||
self.flags(config_drive_format='test')
|
||||
self.assertRaises(exception.ConfigDriveUnknownFormat,
|
||||
blockinfo.get_config_drive_type)
|
||||
|
||||
def test_get_info_from_bdm(self):
|
||||
bdms = [{'device_name': '/dev/vds', 'device_type': 'disk',
|
||||
'disk_bus': 'usb', 'swap_size': 4},
|
||||
|
|
|
@ -1439,12 +1439,3 @@ class BackendTestCase(test.NoDBTestCase):
|
|||
|
||||
def test_image_default(self):
|
||||
self._test_image('default', imagebackend.Raw, imagebackend.Qcow2)
|
||||
|
||||
|
||||
class UtilTestCase(test.NoDBTestCase):
|
||||
def test_get_hw_disk_discard(self):
|
||||
self.assertEqual('unmap', imagebackend.get_hw_disk_discard("unmap"))
|
||||
self.assertEqual('ignore', imagebackend.get_hw_disk_discard("ignore"))
|
||||
self.assertIsNone(imagebackend.get_hw_disk_discard(None))
|
||||
self.assertRaises(RuntimeError, imagebackend.get_hw_disk_discard,
|
||||
"fake")
|
||||
|
|
|
@ -169,15 +169,6 @@ class LvmTestCase(test.NoDBTestCase):
|
|||
lvm.clear_volume('/dev/vc')
|
||||
self.assertEqual(expected_commands, executes)
|
||||
|
||||
# Test volume_clear=invalid falls back to the default 'zero'
|
||||
CONF.set_override('volume_clear', 'invalid', 'libvirt')
|
||||
lvm_size = 1
|
||||
executes = []
|
||||
expected_commands = [('dd', 'bs=1', 'if=/dev/zero', 'of=/dev/vd',
|
||||
'seek=0', 'count=1', 'conv=fdatasync')]
|
||||
lvm.clear_volume('/dev/vd')
|
||||
self.assertEqual(expected_commands, executes)
|
||||
|
||||
@mock.patch.object(utils, 'execute',
|
||||
side_effect=processutils.ProcessExecutionError(
|
||||
stderr=('blockdev: cannot open /dev/foo: '
|
||||
|
|
|
@ -34,7 +34,8 @@ LOG = logging.getLogger(__name__)
|
|||
configdrive_opts = [
|
||||
cfg.StrOpt('config_drive_format',
|
||||
default='iso9660',
|
||||
help='Config drive format. One of iso9660 (default) or vfat'),
|
||||
choices=('iso9660', 'vfat'),
|
||||
help='Config drive format.'),
|
||||
# force_config_drive is a string option, to allow for future behaviors
|
||||
# (e.g. use config_drive based on image properties)
|
||||
cfg.StrOpt('force_config_drive',
|
||||
|
|
|
@ -41,6 +41,7 @@ driver_opts = [
|
|||
'formatted with on creation.'),
|
||||
cfg.StrOpt('preallocate_images',
|
||||
default='none',
|
||||
choices=('none', 'space'),
|
||||
help='VM image preallocation mode: '
|
||||
'"none" => no storage provisioning is done up front, '
|
||||
'"space" => storage is fully allocated at instance start'),
|
||||
|
|
|
@ -119,8 +119,8 @@ libvirt_opts = [
|
|||
help='Rescue ari image'),
|
||||
cfg.StrOpt('virt_type',
|
||||
default='kvm',
|
||||
help='Libvirt domain type (valid options are: '
|
||||
'kvm, lxc, qemu, uml, xen and parallels)'),
|
||||
choices=('kvm', 'lxc', 'qemu', 'uml', 'xen', 'parallels'),
|
||||
help='Libvirt domain type'),
|
||||
cfg.StrOpt('connection_uri',
|
||||
default='',
|
||||
help='Override the default libvirt URI '
|
||||
|
@ -158,9 +158,8 @@ libvirt_opts = [
|
|||
default=0,
|
||||
help='Maximum bandwidth to be used during migration, in Mbps'),
|
||||
cfg.StrOpt('snapshot_image_format',
|
||||
help='Snapshot image format (valid options are : '
|
||||
'raw, qcow2, vmdk, vdi). '
|
||||
'Defaults to same as source image'),
|
||||
choices=('raw', 'qcow2', 'vmdk', 'vdi'),
|
||||
help='Snapshot image format. Defaults to same as source image'),
|
||||
cfg.StrOpt('disk_prefix',
|
||||
help='Override the default disk prefix for the devices attached'
|
||||
' to a server, which is dependent on virt_type. '
|
||||
|
@ -171,6 +170,7 @@ libvirt_opts = [
|
|||
' soft reboot request is made. We fall back to hard reboot'
|
||||
' if instance does not shutdown within this window.'),
|
||||
cfg.StrOpt('cpu_mode',
|
||||
choices=('host-model', 'host-passthrough', 'custom', 'none'),
|
||||
help='Set to "host-model" to clone the host CPU feature flags; '
|
||||
'to "host-passthrough" to use the host CPU model exactly; '
|
||||
'to "custom" to use a named CPU model; '
|
||||
|
@ -206,10 +206,9 @@ libvirt_opts = [
|
|||
'For example: x86_64=machinetype1,armv7l=machinetype2'),
|
||||
cfg.StrOpt('sysinfo_serial',
|
||||
default='auto',
|
||||
choices=('none', 'os', 'hardware', 'auto'),
|
||||
help='The data source used to the populate the host "serial" '
|
||||
'UUID exposed to guest in the virtual BIOS. Permitted '
|
||||
'options are "hardware", "os", "none" or "auto" '
|
||||
'(default).'),
|
||||
'UUID exposed to guest in the virtual BIOS.'),
|
||||
cfg.IntOpt('mem_stats_period_seconds',
|
||||
default=10,
|
||||
help='A number of seconds to memory usage statistics period. '
|
||||
|
|
|
@ -45,9 +45,9 @@ from nova.virt.libvirt import utils as libvirt_utils
|
|||
__imagebackend_opts = [
|
||||
cfg.StrOpt('images_type',
|
||||
default='default',
|
||||
help='VM Images format. Acceptable values are: raw, qcow2, lvm,'
|
||||
' rbd, default. If default is specified,'
|
||||
' then use_cow_images flag is used instead of this one.'),
|
||||
choices=('raw', 'qcow2', 'lvm', 'rbd', 'ploop', 'default'),
|
||||
help='VM Images format. If default is specified, then'
|
||||
' use_cow_images flag is used instead of this one.'),
|
||||
cfg.StrOpt('images_volume_group',
|
||||
help='LVM Volume Group that is used for VM images, when you'
|
||||
' specify images_type=lvm.'),
|
||||
|
@ -62,9 +62,10 @@ __imagebackend_opts = [
|
|||
default='', # default determined by librados
|
||||
help='Path to the ceph configuration file to use'),
|
||||
cfg.StrOpt('hw_disk_discard',
|
||||
help='Discard option for nova managed disks (valid options '
|
||||
'are: ignore, unmap). Need Libvirt(1.0.6) Qemu1.5 '
|
||||
'(raw format) Qemu1.6(qcow2 format)'),
|
||||
choices=('ignore', 'unmap'),
|
||||
help='Discard option for nova managed disks. Need'
|
||||
' Libvirt(1.0.6) Qemu1.5 (raw format) Qemu1.6(qcow2'
|
||||
' format)'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -104,7 +105,7 @@ class Image(object):
|
|||
|
||||
self.source_type = source_type
|
||||
self.driver_format = driver_format
|
||||
self.discard_mode = get_hw_disk_discard(CONF.libvirt.hw_disk_discard)
|
||||
self.discard_mode = CONF.libvirt.hw_disk_discard
|
||||
self.is_block_dev = is_block_dev
|
||||
self.preallocate = False
|
||||
|
||||
|
@ -655,8 +656,7 @@ class Rbd(Image):
|
|||
' images_rbd_pool'
|
||||
' flag to use rbd images.'))
|
||||
self.pool = CONF.libvirt.images_rbd_pool
|
||||
self.discard_mode = get_hw_disk_discard(
|
||||
CONF.libvirt.hw_disk_discard)
|
||||
self.discard_mode = CONF.libvirt.hw_disk_discard
|
||||
self.rbd_user = CONF.libvirt.rbd_user
|
||||
self.ceph_conf = CONF.libvirt.images_rbd_ceph_conf
|
||||
|
||||
|
@ -863,11 +863,3 @@ class Backend(object):
|
|||
"""
|
||||
backend = self.backend(image_type)
|
||||
return backend(instance=instance, path=disk_path)
|
||||
|
||||
|
||||
def get_hw_disk_discard(hw_disk_discard):
|
||||
"""Check valid and get hw_disk_discard value from Conf.
|
||||
"""
|
||||
if hw_disk_discard and hw_disk_discard not in ('unmap', 'ignore'):
|
||||
raise RuntimeError(_('Unknown hw_disk_discard=%s') % hw_disk_discard)
|
||||
return hw_disk_discard
|
||||
|
|
|
@ -27,7 +27,6 @@ import six
|
|||
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.i18n import _LE
|
||||
from nova.i18n import _LW
|
||||
from nova.virt.libvirt import utils
|
||||
|
||||
|
@ -35,8 +34,8 @@ from nova.virt.libvirt import utils
|
|||
lvm_opts = [
|
||||
cfg.StrOpt('volume_clear',
|
||||
default='zero',
|
||||
help='Method used to wipe old volumes (valid options are: '
|
||||
'none, zero, shred)'),
|
||||
choices=('none', 'zero', 'shred'),
|
||||
help='Method used to wipe old volumes.'),
|
||||
cfg.IntOpt('volume_clear_size',
|
||||
default=0,
|
||||
help='Size in MiB to wipe at start of old volumes. 0 => all'),
|
||||
|
@ -216,11 +215,6 @@ def clear_volume(path):
|
|||
"""
|
||||
volume_clear = CONF.libvirt.volume_clear
|
||||
|
||||
if volume_clear not in ('none', 'shred', 'zero'):
|
||||
LOG.error(_LE("ignoring unrecognized volume_clear='%s' value"),
|
||||
volume_clear)
|
||||
volume_clear = 'zero'
|
||||
|
||||
if volume_clear == 'none':
|
||||
return
|
||||
|
||||
|
|
|
@ -106,11 +106,12 @@ volume_opts = [
|
|||
help='Path to a Quobyte Client configuration file.'),
|
||||
cfg.StrOpt('iscsi_iface',
|
||||
deprecated_name='iscsi_transport',
|
||||
choices=('be2iscsi', 'bnx2i', 'cxgb3i', 'cxgb4i', 'qla4xxx',
|
||||
'ocs'),
|
||||
help='The iSCSI transport iface to use to connect to target in '
|
||||
'case offload support is desired. Supported transports '
|
||||
'are be2iscsi, bnx2i, cxgb3i, cxgb4i, qla4xxx and ocs. '
|
||||
'Default format is transport_name.hwaddress and can be '
|
||||
'generated manually or via iscsiadm -m iface'),
|
||||
'case offload support is desired. Default format is '
|
||||
'transport_name.hwaddress and can be generated manually '
|
||||
'or via iscsiadm -m iface'),
|
||||
# iser is also supported, but use LibvirtISERVolumeDriver
|
||||
# instead
|
||||
]
|
||||
|
|
|
@ -64,6 +64,7 @@ LOG = logging.getLogger(__name__)
|
|||
xenapi_vm_utils_opts = [
|
||||
cfg.StrOpt('cache_images',
|
||||
default='all',
|
||||
choices=('all', 'some', 'none'),
|
||||
help='Cache glance images locally. `all` will cache all'
|
||||
' images, `some` will only cache images that have the'
|
||||
' image_property `cache_in_nova=True`, and `none` turns'
|
||||
|
@ -103,8 +104,8 @@ xenapi_vm_utils_opts = [
|
|||
'should try once and no retry'),
|
||||
cfg.StrOpt('torrent_images',
|
||||
default='none',
|
||||
help='Whether or not to download images via Bit Torrent '
|
||||
'(all|some|none).'),
|
||||
choices=('all', 'some', 'none'),
|
||||
help='Whether or not to download images via Bit Torrent.'),
|
||||
cfg.StrOpt('ipxe_network_name',
|
||||
help='Name of network to use for booting iPXE ISOs'),
|
||||
cfg.StrOpt('ipxe_boot_menu_url',
|
||||
|
|
Loading…
Reference in New Issue