[libvirt RFC v3 08/19] qemu: add a stub for virDomainRestoreParametersFlags API

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

 



Signed-off-by: Claudio Fontana <cfontana@xxxxxxx>
---
 src/qemu/qemu_driver.c | 53 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 46 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c702376a4a..9f5ae687e8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5811,12 +5811,12 @@ static int qemuNodeGetSecurityModel(virConnectPtr conn,
     return 0;
 }
 
-
 static int
-qemuDomainRestoreFlags(virConnectPtr conn,
-                       const char *path,
-                       const char *dxml,
-                       unsigned int flags)
+qemuDomainRestoreInternal(virConnectPtr conn,
+                          const char *path,
+                          const char *dxml,
+                          int nchannels,
+                          unsigned int flags)
 {
     virQEMUDriver *driver = conn->privateData;
     qemuDomainObjPrivate *priv = NULL;
@@ -5834,7 +5834,8 @@ qemuDomainRestoreFlags(virConnectPtr conn,
     virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE |
                   VIR_DOMAIN_SAVE_RUNNING |
                   VIR_DOMAIN_SAVE_PAUSED |
-                  VIR_DOMAIN_SAVE_RESET_NVRAM, -1);
+                  VIR_DOMAIN_SAVE_RESET_NVRAM |
+                  VIR_DOMAIN_SAVE_PARALLEL, -1);
 
     if (flags & VIR_DOMAIN_SAVE_RESET_NVRAM)
         reset_nvram = true;
@@ -5913,11 +5914,48 @@ qemuDomainRestoreFlags(virConnectPtr conn,
     return ret;
 }
 
+static int
+qemuDomainRestoreFlags(virConnectPtr conn,
+                       const char *path,
+                       const char *dxml,
+                       unsigned int flags)
+{
+    return qemuDomainRestoreInternal(conn, path, dxml, -1, flags);
+}
+
 static int
 qemuDomainRestore(virConnectPtr conn,
                   const char *path)
 {
-    return qemuDomainRestoreFlags(conn, path, NULL, 0);
+    return qemuDomainRestoreInternal(conn, path, NULL, -1, 0);
+}
+
+static int
+qemuDomainRestoreParametersFlags(virConnectPtr conn,
+                                 virTypedParameterPtr params, int nparams,
+                                 unsigned int flags)
+{
+    const char *path = NULL;
+    const char *dxml = NULL;
+    int ret = -1;
+    int nchannels = 2;
+
+    if (virTypedParamsValidate(params, nparams,
+                               VIR_SAVE_PARAM_FILE, VIR_TYPED_PARAM_STRING,
+                               VIR_SAVE_PARAM_DXML, VIR_TYPED_PARAM_STRING,
+                               VIR_SAVE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT,
+                               NULL) < 0)
+        return -1;
+
+    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_FILE, &path) < 0)
+        return -1;
+    if (virTypedParamsGetString(params, nparams, VIR_SAVE_PARAM_DXML, &dxml) < 0)
+        return -1;
+    if (virTypedParamsGetInt(params, nparams, VIR_SAVE_PARAM_PARALLEL_CONNECTIONS, &nchannels) < 0)
+        return -1;
+
+    ret = qemuDomainRestoreInternal(conn, path, dxml, nchannels, flags);
+    return ret;
 }
 
 static char *
@@ -20884,6 +20922,7 @@ static virHypervisorDriver qemuHypervisorDriver = {
     .domainSaveParametersFlags = qemuDomainSaveParametersFlags, /* 8.3.0 */
     .domainRestore = qemuDomainRestore, /* 0.2.0 */
     .domainRestoreFlags = qemuDomainRestoreFlags, /* 0.9.4 */
+    .domainRestoreParametersFlags = qemuDomainRestoreParametersFlags, /* 8.3.0 */
     .domainSaveImageGetXMLDesc = qemuDomainSaveImageGetXMLDesc, /* 0.9.4 */
     .domainSaveImageDefineXML = qemuDomainSaveImageDefineXML, /* 0.9.4 */
     .domainCoreDump = qemuDomainCoreDump, /* 0.7.0 */
-- 
2.34.1





[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]

  Powered by Linux