提交 82f349a3 编写于 作者: P Peter Krempa

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.
上级 df936185
...@@ -3290,6 +3290,10 @@ qemuGetDriveSourceString(virStorageSourcePtr src, ...@@ -3290,6 +3290,10 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
*source = NULL; *source = NULL;
/* return 1 for empty sources */
if (virStorageSourceIsEmpty(src))
return 1;
if (conn) { if (conn) {
if (actualType == VIR_STORAGE_TYPE_NETWORK && if (actualType == VIR_STORAGE_TYPE_NETWORK &&
src->auth && src->auth &&
...@@ -3319,11 +3323,6 @@ qemuGetDriveSourceString(virStorageSourcePtr src, ...@@ -3319,11 +3323,6 @@ qemuGetDriveSourceString(virStorageSourcePtr src,
case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_FILE:
case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_DIR:
if (!src->path) {
ret = 1;
goto cleanup;
}
if (VIR_STRDUP(*source, src->path) < 0) if (VIR_STRDUP(*source, src->path) < 0)
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册