提交 9ba804a1 编写于 作者: P Peter Krempa

qemu: blockjob: Store 'jobflags' with block job data

Add a variable which will store the contents of the 'flags' variable as
passed in by the individual block jobs. Since the flags may influence
behaviour of the jobs it's important to preserve them to the
finalization steps.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 509ddcfd
...@@ -129,6 +129,9 @@ struct _qemuBlockJobData { ...@@ -129,6 +129,9 @@ struct _qemuBlockJobData {
virStorageSourcePtr chain; /* Reference to the chain the job operates on. */ virStorageSourcePtr chain; /* Reference to the chain the job operates on. */
virStorageSourcePtr mirrorChain; /* reference to 'mirror' part of the job */ virStorageSourcePtr mirrorChain; /* reference to 'mirror' part of the job */
unsigned int jobflags; /* per job flags */
bool jobflagsmissing; /* job flags were not stored */
union { union {
qemuBlockJobPullData pull; qemuBlockJobPullData pull;
qemuBlockJobCommitData commit; qemuBlockJobCommitData commit;
......
...@@ -2546,6 +2546,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, ...@@ -2546,6 +2546,8 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload,
virBufferEscapeString(&attrBuf, " newstate='%s'", newstate); virBufferEscapeString(&attrBuf, " newstate='%s'", newstate);
if (job->brokentype != QEMU_BLOCKJOB_TYPE_NONE) if (job->brokentype != QEMU_BLOCKJOB_TYPE_NONE)
virBufferEscapeString(&attrBuf, " brokentype='%s'", qemuBlockjobTypeToString(job->brokentype)); virBufferEscapeString(&attrBuf, " brokentype='%s'", qemuBlockjobTypeToString(job->brokentype));
if (!job->jobflagsmissing)
virBufferAsprintf(&attrBuf, " jobflags='0x%x'", job->jobflags);
virBufferEscapeString(&childBuf, "<errmsg>%s</errmsg>", job->errmsg); virBufferEscapeString(&childBuf, "<errmsg>%s</errmsg>", job->errmsg);
if (job->disk) { if (job->disk) {
...@@ -3244,6 +3246,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, ...@@ -3244,6 +3246,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm,
int newstate = -1; int newstate = -1;
bool invalidData = false; bool invalidData = false;
xmlNodePtr tmp; xmlNodePtr tmp;
unsigned long jobflags = 0;
ctxt->node = node; ctxt->node = node;
...@@ -3283,6 +3286,9 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, ...@@ -3283,6 +3286,9 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm,
STRNEQ(mirror, "yes")) STRNEQ(mirror, "yes"))
invalidData = true; invalidData = true;
if (virXPathULongHex("string(./@jobflags)", ctxt, &jobflags) != 0)
job->jobflagsmissing = true;
if (!disk && !invalidData) { if (!disk && !invalidData) {
if ((tmp = virXPathNode("./chains/disk", ctxt)) && if ((tmp = virXPathNode("./chains/disk", ctxt)) &&
!(job->chain = qemuDomainObjPrivateXMLParseBlockjobChain(tmp, ctxt, xmlopt))) !(job->chain = qemuDomainObjPrivateXMLParseBlockjobChain(tmp, ctxt, xmlopt)))
...@@ -3302,6 +3308,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm, ...@@ -3302,6 +3308,7 @@ qemuDomainObjPrivateXMLParseBlockjobData(virDomainObjPtr vm,
job->state = state; job->state = state;
job->newstate = newstate; job->newstate = newstate;
job->jobflags = jobflags;
job->errmsg = virXPathString("string(./errmsg)", ctxt); job->errmsg = virXPathString("string(./errmsg)", ctxt);
job->invalidData = invalidData; job->invalidData = invalidData;
job->disk = disk; job->disk = disk;
......
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<allowReboot value='yes'/> <allowReboot value='yes'/>
<nodename index='0'/> <nodename index='0'/>
<blockjobs active='yes'> <blockjobs active='yes'>
<blockjob name='backup-vda-libvirt-3-format' type='backup' state='running'> <blockjob name='backup-vda-libvirt-3-format' type='backup' state='running' jobflags='0x0'>
<disk dst='vda'/> <disk dst='vda'/>
<bitmap name='bitmapname'/> <bitmap name='bitmapname'/>
<store type='file' format='qcow2'> <store type='file' format='qcow2'>
......
...@@ -261,19 +261,19 @@ ...@@ -261,19 +261,19 @@
</source> </source>
</src> </src>
</blockjob> </blockjob>
<blockjob name='copy-vdd-libvirt-4321-format' type='copy' state='ready' shallownew='yes'> <blockjob name='copy-vdd-libvirt-4321-format' type='copy' state='ready' jobflags='0x0' shallownew='yes'>
<disk dst='vdd'/> <disk dst='vdd'/>
</blockjob> </blockjob>
<blockjob name='commit-vdc-libvirt-9-format' type='commit' state='running'> <blockjob name='commit-vdc-libvirt-9-format' type='commit' state='running' jobflags='0x0'>
<disk dst='vdc'/> <disk dst='vdc'/>
<base node='libvirt-11-format'/> <base node='libvirt-11-format'/>
<top node='libvirt-9-format'/> <top node='libvirt-9-format'/>
<topparent node='libvirt-2-format'/> <topparent node='libvirt-2-format'/>
</blockjob> </blockjob>
<blockjob name='drive-virtio-disk0' type='copy' state='ready'> <blockjob name='drive-virtio-disk0' type='copy' state='ready' jobflags='0x0'>
<disk dst='vda' mirror='yes'/> <disk dst='vda' mirror='yes'/>
</blockjob> </blockjob>
<blockjob name='create-libvirt-1338-format' type='create' state='running'> <blockjob name='create-libvirt-1338-format' type='create' state='running' jobflags='0xabcd'>
<chains> <chains>
<disk type='file' format='qcow2'> <disk type='file' format='qcow2'>
<source file='/create/src1.qcow2' index='1339'> <source file='/create/src1.qcow2' index='1339'>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册