From f3d3be3d48e6d8036de7ac44d8c77f469f6c6b60 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 1 Jul 2016 16:27:31 +0200 Subject: [PATCH] conf: Isolate virDomainLiveConfigHelperMethod to libxl only Libxl is the last user and I don't have the toolchain prepared to compile the libxl driver. Move it to the libxl driver to avoid having to refactor the code. --- src/conf/domain_conf.c | 29 ----------------------------- src/conf/domain_conf.h | 7 ------- src/libvirt_private.syms | 1 - src/libxl/libxl_driver.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f6ab45cd2f..f5e405defe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2983,35 +2983,6 @@ virDomainObjUpdateModificationImpact(virDomainObjPtr vm, } -/* - * Helper method for --current, --live, and --config options, and check - * whether domain is active or can get persistent domain configuration. - * - * Return 0 if success, also change the flags and get the persistent - * domain configuration if needed. Return -1 on error. - */ -int -virDomainLiveConfigHelperMethod(virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - virDomainObjPtr dom, - unsigned int *flags, - virDomainDefPtr *persistentDef) -{ - if (virDomainObjUpdateModificationImpact(dom, flags) < 0) - return -1; - - if (*flags & VIR_DOMAIN_AFFECT_CONFIG) { - if (!(*persistentDef = virDomainObjGetPersistentDef(caps, xmlopt, dom))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Get persistent config failed")); - return -1; - } - } - - return 0; -} - - /** * virDomainObjGetDefs: * diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4ebafbe93b..a1acebe9d4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2557,13 +2557,6 @@ int virDomainObjGetDefs(virDomainObjPtr vm, virDomainDefPtr *persDef); virDomainDefPtr virDomainObjGetOneDef(virDomainObjPtr vm, unsigned int flags); -int -virDomainLiveConfigHelperMethod(virCapsPtr caps, - virDomainXMLOptionPtr xmlopt, - virDomainObjPtr dom, - unsigned int *flags, - virDomainDefPtr *persistentDef); - virDomainDefPtr virDomainDefCopy(virDomainDefPtr src, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ccb4c5e855..ad0af76a7b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -358,7 +358,6 @@ virDomainLifecycleCrashTypeFromString; virDomainLifecycleCrashTypeToString; virDomainLifecycleTypeFromString; virDomainLifecycleTypeToString; -virDomainLiveConfigHelperMethod; virDomainLoaderDefFree; virDomainLoaderTypeFromString; virDomainLoaderTypeToString; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 3189f1c598..266116859a 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1431,6 +1431,36 @@ libxlDomainGetMaxMemory(virDomainPtr dom) return ret; } + +/* + * Helper method for --current, --live, and --config options, and check + * whether domain is active or can get persistent domain configuration. + * + * Return 0 if success, also change the flags and get the persistent + * domain configuration if needed. Return -1 on error. + */ +static int +virDomainLiveConfigHelperMethod(virCapsPtr caps, + virDomainXMLOptionPtr xmlopt, + virDomainObjPtr dom, + unsigned int *flags, + virDomainDefPtr *persistentDef) +{ + if (virDomainObjUpdateModificationImpact(dom, flags) < 0) + return -1; + + if (*flags & VIR_DOMAIN_AFFECT_CONFIG) { + if (!(*persistentDef = virDomainObjGetPersistentDef(caps, xmlopt, dom))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Get persistent config failed")); + return -1; + } + } + + return 0; +} + + static int libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, unsigned int flags) -- GitLab