mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
qemu: domain: Add field for storing node name for copy-on-read
The copy-on-read feature is expressed by adding a new node layer in qemu when using -blockdev. Since we will keep these per-disk (as opposed to per storage source) we need to store the appropriate node names in the disk definition. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
94e4530992
commit
d451575bb1
@ -1066,6 +1066,7 @@ qemuDomainDiskPrivateDispose(void *obj)
|
||||
VIR_FREE(priv->blockJobError);
|
||||
virStorageSourceFree(priv->migrSource);
|
||||
VIR_FREE(priv->qomName);
|
||||
VIR_FREE(priv->nodeCopyOnRead);
|
||||
}
|
||||
|
||||
static virClassPtr qemuDomainStorageSourcePrivateClass;
|
||||
@ -2131,6 +2132,7 @@ qemuDomainDiskPrivateParse(xmlXPathContextPtr ctxt,
|
||||
qemuDomainDiskPrivatePtr priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
|
||||
priv->qomName = virXPathString("string(./qom/@name)", ctxt);
|
||||
priv->nodeCopyOnRead = virXPathString("string(./nodenames/nodename[@type='copyOnRead']/@name)", ctxt);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2144,6 +2146,15 @@ qemuDomainDiskPrivateFormat(virDomainDiskDefPtr disk,
|
||||
|
||||
virBufferEscapeString(buf, "<qom name='%s'/>\n", priv->qomName);
|
||||
|
||||
if (priv->nodeCopyOnRead) {
|
||||
virBufferAddLit(buf, "<nodenames>\n");
|
||||
virBufferAdjustIndent(buf, 2);
|
||||
virBufferEscapeString(buf, "<nodename type='copyOnRead' name='%s'/>\n",
|
||||
priv->nodeCopyOnRead);
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</nodenames>\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -398,6 +398,7 @@ struct _qemuDomainDiskPrivate {
|
||||
bool removable; /* device media can be removed/changed */
|
||||
|
||||
char *qomName; /* QOM path of the disk (also refers to the block backend) */
|
||||
char *nodeCopyOnRead; /* nodename of the disk-wide copy-on-read blockdev layer */
|
||||
};
|
||||
|
||||
# define QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src) \
|
||||
|
@ -335,6 +335,9 @@
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
|
||||
<privateData>
|
||||
<qom name='virtio-disk1/virtio-backend'/>
|
||||
<nodenames>
|
||||
<nodename type='copyOnRead' name='cor-node'/>
|
||||
</nodenames>
|
||||
</privateData>
|
||||
</disk>
|
||||
<disk type='file' device='cdrom'>
|
||||
|
Loading…
x
Reference in New Issue
Block a user