render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From 573518f61bbdffc5ee7fb4f55a145f19e7edc65f Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <573518f61bbdffc5ee7fb4f55a145f19e7edc65f@dist-git>
7a3408
From: Martin Kletzander <mkletzan@redhat.com>
7a3408
Date: Mon, 14 Sep 2015 10:15:25 +0200
7a3408
Subject: [PATCH] qemu: Report error if per-VM directory cannot be created
7a3408
7a3408
Commit f1f68ca33433 did not report an error if virFileMakePath()
7a3408
returned -1.  Well, who would've guessed function with name starting
7a3408
with 'vir' sets an errno instead of reporting an error the libvirt way.
7a3408
Anyway, let's fix it, so the output changes from:
7a3408
7a3408
  $ virsh start arm
7a3408
  error: Failed to start domain arm
7a3408
  error: An error occurred, but the cause is unknown
7a3408
7a3408
to:
7a3408
7a3408
  $ virsh start arm
7a3408
  error: Failed to start domain arm
7a3408
  error: Cannot create directory '/var/lib/libvirt/qemu/domain-arm': Not
7a3408
  a directory
7a3408
7a3408
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146886
7a3408
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
(cherry picked from commit 8370023730220fcf48f9b1fa0914b60c66452569)
7a3408
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_process.c | 8 ++++++--
7a3408
 1 file changed, 6 insertions(+), 2 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
7a3408
index 317ef78..d5b0fc0 100644
7a3408
--- a/src/qemu/qemu_process.c
7a3408
+++ b/src/qemu/qemu_process.c
7a3408
@@ -4737,8 +4737,10 @@ int qemuProcessStart(virConnectPtr conn,
7a3408
     if (virAsprintf(&tmppath, "%s/domain-%s", cfg->libDir, vm->def->name) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
-    if (virFileMakePath(tmppath) < 0)
7a3408
+    if (virFileMakePath(tmppath) < 0) {
7a3408
+        virReportSystemError(errno, _("Cannot create directory '%s'"), tmppath);
7a3408
         goto cleanup;
7a3408
+    }
7a3408
 
7a3408
     if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
7a3408
                                             vm->def, tmppath) < 0)
7a3408
@@ -4750,8 +4752,10 @@ int qemuProcessStart(virConnectPtr conn,
7a3408
                     cfg->channelTargetDir, vm->def->name) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
-    if (virFileMakePath(tmppath) < 0)
7a3408
+    if (virFileMakePath(tmppath) < 0) {
7a3408
+        virReportSystemError(errno, _("Cannot create directory '%s'"), tmppath);
7a3408
         goto cleanup;
7a3408
+    }
7a3408
 
7a3408
     if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
7a3408
                                             vm->def, tmppath) < 0)
7a3408
-- 
7a3408
2.5.2
7a3408