提交 0304e675 编写于 作者: P Peter Krempa

qemu: block: Extract formatting of props for 'file' backend

'file' backend in qemu supports few more options than the current
implementation. Extract it so that changes don't pollute the code.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 8a78f88a
......@@ -974,6 +974,18 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr src)
}
static virJSONValuePtr
qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
{
virJSONValuePtr ret = NULL;
ignore_value(virJSONValueObjectCreate(&ret,
"s:driver", "file",
"s:filename", src->path, NULL) < 0);
return ret;
}
/**
* qemuBlockStorageSourceGetBackendProps:
* @src: disk source
......@@ -991,9 +1003,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
case VIR_STORAGE_TYPE_BLOCK:
case VIR_STORAGE_TYPE_FILE:
case VIR_STORAGE_TYPE_DIR:
if (virJSONValueObjectCreate(&fileprops,
"s:driver", "file",
"s:filename", src->path, NULL) < 0)
if (!(fileprops = qemuBlockStorageSourceGetFileProps(src)))
return NULL;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册