render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Mark McLoughlin 38cf1b
From f1be5a4714e194a84840343e0937fe62463a18dc Mon Sep 17 00:00:00 2001
Mark McLoughlin 7c2073
From: Charles Duffy <Charles_Duffy@dell.com>
Mark McLoughlin 7c2073
Date: Fri, 18 Sep 2009 11:32:35 -0500
Mark McLoughlin 7c2073
Subject: [PATCH] Prevent attempt to call cat -c during virDomainSave to raw
Mark McLoughlin 7c2073
Mark McLoughlin 7c2073
Fedora-patch: libvirt-fix-qemu-raw-format-save.patch
Mark McLoughlin 7c2073
---
Mark McLoughlin 7c2073
 src/qemu_driver.c |   28 ++++++++++++++++++----------
Mark McLoughlin 7c2073
 1 files changed, 18 insertions(+), 10 deletions(-)
Mark McLoughlin 7c2073
Mark McLoughlin 7c2073
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
Mark McLoughlin 7c2073
index 2ddcdc0..7c7b985 100644
Mark McLoughlin 7c2073
--- a/src/qemu_driver.c
Mark McLoughlin 7c2073
+++ b/src/qemu_driver.c
Mark McLoughlin 7c2073
@@ -3905,17 +3905,25 @@ static int qemudDomainSave(virDomainPtr dom,
Mark McLoughlin 7c2073
         goto cleanup;
Mark McLoughlin 7c2073
     }
Mark McLoughlin 7c2073
 
Mark McLoughlin 7c2073
-    const char *prog = qemudSaveCompressionTypeToString(header.compressed);
Mark McLoughlin 7c2073
-    if (prog == NULL) {
Mark McLoughlin 7c2073
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
Mark McLoughlin 7c2073
-                         _("Invalid compress format %d"), header.compressed);
Mark McLoughlin 7c2073
-        goto cleanup;
Mark McLoughlin 7c2073
-    }
Mark McLoughlin 7c2073
+    {
Mark McLoughlin 7c2073
+        const char *prog = qemudSaveCompressionTypeToString(header.compressed);
Mark McLoughlin 7c2073
+        const char *args;
Mark McLoughlin 7c2073
 
Mark McLoughlin 7c2073
-    if (STREQ (prog, "raw"))
Mark McLoughlin 7c2073
-        prog = "cat";
Mark McLoughlin 7c2073
-    internalret = virAsprintf(&command, "migrate \"exec:"
Mark McLoughlin 7c2073
-                              "%s -c >> '%s' 2>/dev/null\"", prog, safe_path);
Mark McLoughlin 7c2073
+        if (prog == NULL) {
Mark McLoughlin 7c2073
+            qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
Mark McLoughlin 7c2073
+                             _("Invalid compress format %d"), header.compressed);
Mark McLoughlin 7c2073
+            goto cleanup;
Mark McLoughlin 7c2073
+        }
Mark McLoughlin 7c2073
+
Mark McLoughlin 7c2073
+        if (STREQ (prog, "raw")) {
Mark McLoughlin 7c2073
+            prog = "cat";
Mark McLoughlin 7c2073
+            args = "";
Mark McLoughlin 7c2073
+        } else {
Mark McLoughlin 7c2073
+            args = "-c";
Mark McLoughlin 7c2073
+        }
Mark McLoughlin 7c2073
+        internalret = virAsprintf(&command, "migrate \"exec:"
Mark McLoughlin 7c2073
+                                  "%s %s >> '%s' 2>/dev/null\"", prog, args, safe_path);
Mark McLoughlin 7c2073
+    }
Mark McLoughlin 7c2073
 
Mark McLoughlin 7c2073
     if (internalret < 0) {
Mark McLoughlin 7c2073
         virReportOOMError(dom->conn);
Mark McLoughlin 7c2073
-- 
Mark McLoughlin 7c2073
1.6.2.5
Mark McLoughlin 7c2073