From 82f349a3a85c54acd15791b3cf7c22d0de779bb4 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 24 Mar 2015 16:16:29 +0100 Subject: [PATCH] qemu: command: Check for empty network source when formatting drive cmd 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 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c467092bcc..b2df8b0570 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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; -- GitLab