mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
qemu: domain: Prepare qemuDomainDiskGetBackendAlias for -blockdev
Pass in the node name as the backend alias when -blockdev is used. As copy-on-read is expressed by a separate -blockdev backing chain member we need to decide which node name to use here. For empty cdroms when using -blockdev there is no backend at all so NULL is returned. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9843f22c2a
commit
f79f0e1e91
@ -8691,12 +8691,29 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
||||
*/
|
||||
int
|
||||
qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
|
||||
virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
char **backendAlias)
|
||||
{
|
||||
qemuDomainDiskPrivatePtr priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
const char *nodename = NULL;
|
||||
*backendAlias = NULL;
|
||||
|
||||
if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
|
||||
if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk)))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (virStorageSourceIsEmpty(disk->src))
|
||||
return 0;
|
||||
|
||||
if (disk->copy_on_read == VIR_TRISTATE_SWITCH_ON)
|
||||
nodename = priv->nodeCopyOnRead;
|
||||
else
|
||||
nodename = disk->src->nodeformat;
|
||||
|
||||
if (VIR_STRDUP(*backendAlias, nodename) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user