提交 d451575b 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 94e45309
......@@ -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'>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册