]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Report error if per-VM directory cannot be created
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 8 Sep 2015 17:12:58 +0000 (19:12 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 9 Sep 2015 11:38:18 +0000 (13:38 +0200)
Commit f1f68ca33433 did not report an error if virFileMakePath()
returned -1.  Well, who would've guessed function with name starting
with 'vir' sets an errno instead of reporting an error the libvirt way.
Anyway, let's fix it, so the output changes from:

  $ virsh start arm
  error: Failed to start domain arm
  error: An error occurred, but the cause is unknown

to:

  $ virsh start arm
  error: Failed to start domain arm
  error: Cannot create directory '/var/lib/libvirt/qemu/domain-arm': Not
  a directory

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146886

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_process.c

index f7eb2b609437cc9ca4822accfddd7158e17fd82d..d9a0942c4dfd9b1419f25688cc2db8ede73de1ae 100644 (file)
@@ -4734,8 +4734,10 @@ int qemuProcessStart(virConnectPtr conn,
     if (virAsprintf(&tmppath, "%s/domain-%s", cfg->libDir, vm->def->name) < 0)
         goto cleanup;
 
-    if (virFileMakePath(tmppath) < 0)
+    if (virFileMakePath(tmppath) < 0) {
+        virReportSystemError(errno, _("Cannot create directory '%s'"), tmppath);
         goto cleanup;
+    }
 
     if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
                                             vm->def, tmppath) < 0)
@@ -4747,8 +4749,10 @@ int qemuProcessStart(virConnectPtr conn,
                     cfg->channelTargetDir, vm->def->name) < 0)
         goto cleanup;
 
-    if (virFileMakePath(tmppath) < 0)
+    if (virFileMakePath(tmppath) < 0) {
+        virReportSystemError(errno, _("Cannot create directory '%s'"), tmppath);
         goto cleanup;
+    }
 
     if (virSecurityManagerDomainSetDirLabel(driver->securityManager,
                                             vm->def, tmppath) < 0)