未验证 提交 f543716d 编写于 作者: D dzhengfy 提交者: GitHub

Merge pull request #2671 from Yingshun/customize_libvirt_config

Update customize_libvirt_config to set configurations for more daemons
......@@ -313,6 +313,19 @@ class LibvirtConfigCommon(SectionlessConfig):
raise LibvirtConfigUnknownKeyError(key)
class LibvirtConfig(LibvirtConfigCommon):
"""
Class for libvirt config file.
"""
conf_path = '/etc/libvirt/libvirt.conf'
__option_types__ = {
'uri_aliases': 'list',
'uri_default': 'string',
'remote_mode': 'string'
}
class LibvirtdConfig(LibvirtConfigCommon):
"""
......@@ -676,3 +689,27 @@ class VirtProxydConfig(VirtQemudConfig):
'ovs_timeout': 'int',
}
def get_conf_obj(config_type):
"""
Wrapper method to get the object from the given configuration type
:param config_type: The configuration type to get
For example, "libvirtd" or "virtqemud"
:return: utils_config.LibvirtConfigCommon object
"""
return {
'libvirt': LibvirtConfig(),
'libvirtd': LibvirtdConfig(),
'qemu': LibvirtQemuConfig(),
'sysconfig': LibvirtdSysConfig(),
'guestconfig': LibvirtGuestsConfig(),
'virtqemud': VirtQemudConfig(),
'virtproxyd': VirtProxydConfig(),
'virtnetworkd': VirtNetworkdConfig(),
'virtstoraged': VirtStoragedConfig(),
'virtinterfaced': VirtInterfacedConfig(),
'virtnodedevd': VirtNodedevdConfig(),
'virtnwfilterd': VirtNwfilterdConfig(),
}.get(config_type)
......@@ -3562,7 +3562,10 @@ def customize_libvirt_config(params,
:return: utils_config.LibvirtConfigCommon object
"""
config_list_support = ["libvirtd", "qemu", "sysconfig", "guestconfig"]
config_list_support = ["libvirtd", "qemu", "sysconfig", "guestconfig",
"virtqemud", "virtproxyd", "virtnetworkd",
"virtstoraged", "virtinterfaced", "virtnodedevd",
"virtnwfilterd", "libvirt"]
if config_type not in config_list_support:
logging.debug("'%s' is not in the support list '%s'",
config_type, config_list_support)
......@@ -3573,16 +3576,8 @@ def customize_libvirt_config(params,
# Handle local
if not params or not isinstance(params, dict):
return None
target_conf = utils_config.get_conf_obj(config_type)
#if params and isinstance(params, dict):
if config_type == "libvirtd":
target_conf = utils_config.LibvirtdConfig()
elif config_type == "qemu":
target_conf = utils_config.LibvirtQemuConfig()
elif config_type == "sysconfig":
target_conf = utils_config.LibvirtdSysConfig()
else:
target_conf = utils_config.LibvirtGuestsConfig()
for key, value in params.items():
target_conf[key] = value
logging.debug("The '%s' config file is updated with:\n %s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册