mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Add field to store QOM path of a disk in private data
When using -blockdev you need to use the qom path to refer to the disk fronends. Add means for storing the path and getting it after restart. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4ceecd3a6f
commit
716c46178a
@ -1065,6 +1065,7 @@ qemuDomainDiskPrivateDispose(void *obj)
|
|||||||
|
|
||||||
VIR_FREE(priv->blockJobError);
|
VIR_FREE(priv->blockJobError);
|
||||||
virStorageSourceFree(priv->migrSource);
|
virStorageSourceFree(priv->migrSource);
|
||||||
|
VIR_FREE(priv->qomName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static virClassPtr qemuDomainStorageSourcePrivateClass;
|
static virClassPtr qemuDomainStorageSourcePrivateClass;
|
||||||
@ -2123,6 +2124,30 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainDiskPrivateParse(xmlXPathContextPtr ctxt,
|
||||||
|
virDomainDiskDefPtr disk)
|
||||||
|
{
|
||||||
|
qemuDomainDiskPrivatePtr priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
|
|
||||||
|
priv->qomName = virXPathString("string(./qom/@name)", ctxt);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
qemuDomainDiskPrivateFormat(virDomainDiskDefPtr disk,
|
||||||
|
virBufferPtr buf)
|
||||||
|
{
|
||||||
|
qemuDomainDiskPrivatePtr priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
|
|
||||||
|
virBufferEscapeString(buf, "<qom name='%s'/>\n", priv->qomName);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuDomainObjPrivateXMLFormatVcpus(virBufferPtr buf,
|
qemuDomainObjPrivateXMLFormatVcpus(virBufferPtr buf,
|
||||||
virDomainDefPtr def)
|
virDomainDefPtr def)
|
||||||
@ -2973,6 +2998,8 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks = {
|
|||||||
.alloc = qemuDomainObjPrivateAlloc,
|
.alloc = qemuDomainObjPrivateAlloc,
|
||||||
.free = qemuDomainObjPrivateFree,
|
.free = qemuDomainObjPrivateFree,
|
||||||
.diskNew = qemuDomainDiskPrivateNew,
|
.diskNew = qemuDomainDiskPrivateNew,
|
||||||
|
.diskParse = qemuDomainDiskPrivateParse,
|
||||||
|
.diskFormat = qemuDomainDiskPrivateFormat,
|
||||||
.vcpuNew = qemuDomainVcpuPrivateNew,
|
.vcpuNew = qemuDomainVcpuPrivateNew,
|
||||||
.chrSourceNew = qemuDomainChrSourcePrivateNew,
|
.chrSourceNew = qemuDomainChrSourcePrivateNew,
|
||||||
.vsockNew = qemuDomainVsockPrivateNew,
|
.vsockNew = qemuDomainVsockPrivateNew,
|
||||||
|
@ -396,6 +396,8 @@ struct _qemuDomainDiskPrivate {
|
|||||||
/* information about the device */
|
/* information about the device */
|
||||||
bool tray; /* device has tray */
|
bool tray; /* device has tray */
|
||||||
bool removable; /* device media can be removed/changed */
|
bool removable; /* device media can be removed/changed */
|
||||||
|
|
||||||
|
char *qomName; /* QOM path of the disk (also refers to the block backend) */
|
||||||
};
|
};
|
||||||
|
|
||||||
# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
|
# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
|
||||||
|
@ -333,6 +333,9 @@
|
|||||||
<target dev='vdb' bus='virtio'/>
|
<target dev='vdb' bus='virtio'/>
|
||||||
<alias name='virtio-disk1'/>
|
<alias name='virtio-disk1'/>
|
||||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
|
||||||
|
<privateData>
|
||||||
|
<qom name='virtio-disk1/virtio-backend'/>
|
||||||
|
</privateData>
|
||||||
</disk>
|
</disk>
|
||||||
<disk type='file' device='cdrom'>
|
<disk type='file' device='cdrom'>
|
||||||
<driver name='qemu' type='raw'/>
|
<driver name='qemu' type='raw'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user