]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Check for empty network source when formatting drive cmd
authorPeter Krempa <pkrempa@redhat.com>
Tue, 24 Mar 2015 15:16:29 +0000 (16:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 26 Mar 2015 07:24:46 +0000 (08:24 +0100)
Use the virStorageSourceIsEmpty helper to determine whether the drive
source is empty rather than checking for src->path. This will fix start
of VM with empty network cdrom that would not report any error.

src/qemu/qemu_command.c

index c467092bcc4fb4a57a0d5c29f3d5804fbb9ba8ec..b2df8b0570d5ebbbc586bc3ff2a3a77b9822c211 100644 (file)
@@ -3290,6 +3290,10 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
 
     *source = NULL;
 
+    /* return 1 for empty sources */
+    if (virStorageSourceIsEmpty(src))
+        return 1;
+
     if (conn) {
         if (actualType == VIR_STORAGE_TYPE_NETWORK &&
             src->auth &&
@@ -3319,11 +3323,6 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_FILE:
     case VIR_STORAGE_TYPE_DIR:
-        if (!src->path) {
-            ret = 1;
-            goto cleanup;
-        }
-
         if (VIR_STRDUP(*source, src->path) < 0)
             goto cleanup;