mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: block: Add support for 'pr-manager' in qemuBlockStorageSourceGetFileProps
To keep feature parity, we need to be able to format the PR manager alias when using blockdev. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
d766021c60
commit
f18771d41c
@ -998,6 +998,7 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
|
|||||||
{
|
{
|
||||||
const char *driver = "file";
|
const char *driver = "file";
|
||||||
const char *iomode = NULL;
|
const char *iomode = NULL;
|
||||||
|
const char *prManagerAlias = NULL;
|
||||||
virJSONValuePtr ret = NULL;
|
virJSONValuePtr ret = NULL;
|
||||||
|
|
||||||
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
|
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
|
||||||
@ -1010,10 +1011,14 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
|
|||||||
driver = "host_device";
|
driver = "host_device";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->pr)
|
||||||
|
prManagerAlias = src->pr->mgralias;
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectCreate(&ret,
|
||||||
"s:driver", driver,
|
"s:driver", driver,
|
||||||
"s:filename", src->path,
|
"s:filename", src->path,
|
||||||
"S:aio", iomode,
|
"S:aio", iomode,
|
||||||
|
"S:pr-manager", prManagerAlias,
|
||||||
NULL) < 0);
|
NULL) < 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -488,6 +488,7 @@ mymain(void)
|
|||||||
TEST_DISK_TO_JSON("dir-fat-cache");
|
TEST_DISK_TO_JSON("dir-fat-cache");
|
||||||
|
|
||||||
TEST_DISK_TO_JSON("block-raw-noopts");
|
TEST_DISK_TO_JSON("block-raw-noopts");
|
||||||
|
TEST_DISK_TO_JSON("block-raw-reservations");
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virHashFree(diskxmljsondata.schema);
|
virHashFree(diskxmljsondata.schema);
|
||||||
|
14
tests/qemublocktestdata/xml2json/block-raw-reservations.json
Normal file
14
tests/qemublocktestdata/xml2json/block-raw-reservations.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"node-name": "node-a-fo",
|
||||||
|
"read-only": false,
|
||||||
|
"driver": "raw",
|
||||||
|
"file": "node-a-st"
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"driver": "host_device",
|
||||||
|
"filename": "/dev/blah",
|
||||||
|
"pr-manager": "node-a-st-pr-alias",
|
||||||
|
"node-name": "node-a-st",
|
||||||
|
"read-only": false,
|
||||||
|
"discard": "unmap"
|
||||||
|
}
|
14
tests/qemublocktestdata/xml2json/block-raw-reservations.xml
Normal file
14
tests/qemublocktestdata/xml2json/block-raw-reservations.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<disk device='disk' type='block'>
|
||||||
|
<driver name='qemu' type='raw'/>
|
||||||
|
<source dev='/dev/blah'>
|
||||||
|
<reservations enabled='yes' managed='yes'/>
|
||||||
|
<privateData>
|
||||||
|
<nodenames>
|
||||||
|
<nodename type='storage' name='node-a-st'/>
|
||||||
|
<nodename type='format' name='node-a-fo'/>
|
||||||
|
</nodenames>
|
||||||
|
<reservations mgralias='node-a-st-pr-alias'/>
|
||||||
|
</privateData>
|
||||||
|
</source>
|
||||||
|
<target dev='vda'/>
|
||||||
|
</disk>
|
Loading…
x
Reference in New Issue
Block a user