mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
8a78f88a1a
commit
0304e675c0
@ -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:
|
* qemuBlockStorageSourceGetBackendProps:
|
||||||
* @src: disk source
|
* @src: disk source
|
||||||
@ -991,9 +1003,7 @@ qemuBlockStorageSourceGetBackendProps(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 (virJSONValueObjectCreate(&fileprops,
|
if (!(fileprops = qemuBlockStorageSourceGetFileProps(src)))
|
||||||
"s:driver", "file",
|
|
||||||
"s:filename", src->path, NULL) < 0)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user