From 7ee004646bd93aed6f3529402212f1bbed5b67da Mon Sep 17 00:00:00 2001 From: Hieu LE Date: Fri, 22 Apr 2016 19:25:06 +0700 Subject: [PATCH] Config options: centralize remotefs libvirt options (end) The config options of the "nova.conf" section "libvirt" got moved to the new central location "nova/conf/libvirt.py". This is the last patch in a long-chain patchs. The next chain of patch-set will focus on improve libvirt help texts. Change-Id: Ieaa9092dcb53c405b60ff4f4c9ea68f8d90e8435 Co-Authored-by: Markus Zoeller Implements: blueprint centralize-config-options-newton --- etc/nova/nova-config-generator.conf | 1 - nova/conf/libvirt.py | 14 ++++++++++---- nova/virt/libvirt/volume/remotefs.py | 13 ++----------- nova/virt/opts.py | 26 -------------------------- 4 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 nova/virt/opts.py diff --git a/etc/nova/nova-config-generator.conf b/etc/nova/nova-config-generator.conf index d6acda41363e..e51e18ba6d34 100644 --- a/etc/nova/nova-config-generator.conf +++ b/etc/nova/nova-config-generator.conf @@ -8,7 +8,6 @@ namespace = nova.cache_utils namespace = nova.cells namespace = nova.compute namespace = nova.network -namespace = nova.virt namespace = oslo.cache namespace = oslo.log namespace = oslo.messaging diff --git a/nova/conf/libvirt.py b/nova/conf/libvirt.py index ca063781deab..f910c54aec54 100644 --- a/nova/conf/libvirt.py +++ b/nova/conf/libvirt.py @@ -390,6 +390,14 @@ libvirt_volume_smbfs_opts = [ 'libvirt-qemu uid and gid must be specified.'), ] +libvirt_remotefs_opts = [ + cfg.StrOpt('remote_filesystem_transport', + default='ssh', + choices=('ssh', 'rsync'), + help='Use ssh or rsync transport for creating, copying, ' + 'removing files on the remote host.'), +] + ALL_OPTS = list(itertools.chain( libvirt_general_opts, libvirt_imagebackend_opts, @@ -407,6 +415,7 @@ ALL_OPTS = list(itertools.chain( libvirt_volume_quobyte_opts, libvirt_volume_scality_opts, libvirt_volume_smbfs_opts, + libvirt_remotefs_opts )) @@ -415,8 +424,5 @@ def register_opts(conf): conf.register_opts(ALL_OPTS, group=libvirt_group) -# TODO(hieulq): if not using group name, oslo config will generate duplicate -# config section. This need to be remove when completely move all libvirt -# options to this place. def list_opts(): - return {libvirt_group.name: ALL_OPTS} + return {libvirt_group: ALL_OPTS} diff --git a/nova/virt/libvirt/volume/remotefs.py b/nova/virt/libvirt/volume/remotefs.py index 254e5cc22258..eafb56565a35 100644 --- a/nova/virt/libvirt/volume/remotefs.py +++ b/nova/virt/libvirt/volume/remotefs.py @@ -19,26 +19,17 @@ import os import tempfile from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils import six +import nova.conf from nova.i18n import _LE, _LW from nova import utils LOG = logging.getLogger(__name__) -libvirt_opts = [ - cfg.StrOpt('remote_filesystem_transport', - default='ssh', - choices=('ssh', 'rsync'), - help='Use ssh or rsync transport for creating, copying, ' - 'removing files on the remote host.'), - ] - -CONF = cfg.CONF -CONF.register_opts(libvirt_opts, 'libvirt') +CONF = nova.conf.CONF def mount_share(mount_path, export_path, diff --git a/nova/virt/opts.py b/nova/virt/opts.py deleted file mode 100644 index 01c0ab47d2ac..000000000000 --- a/nova/virt/opts.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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. - -import itertools - -import nova.virt.libvirt.volume.remotefs -import nova.virt.xenapi.agent -import nova.virt.xenapi.vmops - - -def list_opts(): - return [ - ('libvirt', - itertools.chain( - nova.virt.libvirt.volume.remotefs.libvirt_opts, - )), - ]