[PATCH 6/6] conf: Isolate virDomainLiveConfigHelperMethod to libxl only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 bbc9903..d6ab93a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2982,35 +2982,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 91ebf83..de3ce5d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2556,13 +2556,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 4617f5d..df2b2e8 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 3189f1c..2661168 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)
-- 
2.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]