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:
Peter Krempa 2018-05-30 15:47:13 +02:00
parent d766021c60
commit f18771d41c
4 changed files with 34 additions and 0 deletions

View File

@ -998,6 +998,7 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
{
const char *driver = "file";
const char *iomode = NULL;
const char *prManagerAlias = NULL;
virJSONValuePtr ret = NULL;
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
@ -1010,10 +1011,14 @@ qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
driver = "host_device";
}
if (src->pr)
prManagerAlias = src->pr->mgralias;
ignore_value(virJSONValueObjectCreate(&ret,
"s:driver", driver,
"s:filename", src->path,
"S:aio", iomode,
"S:pr-manager", prManagerAlias,
NULL) < 0);
return ret;
}

View File

@ -488,6 +488,7 @@ mymain(void)
TEST_DISK_TO_JSON("dir-fat-cache");
TEST_DISK_TO_JSON("block-raw-noopts");
TEST_DISK_TO_JSON("block-raw-reservations");
cleanup:
virHashFree(diskxmljsondata.schema);

View 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"
}

View 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>