qemu: blockjob: Track orphaned backing chains in blockjob status XML

When the guest unplugs the disk frontend libvirt is responsible for
deleting the backend. Since a blockjob may still have a reference to the
backing chain when it is running we'll have to store the metadata for
the unplugged disk for future reference.

This patch adds 'chain' and 'mirrorChain' fields to 'qemuBlockJobData'
to keep them around with the job along with status XML machinery and
tests. Later patches will then add code to change the ownership of the
chain when unplugging the disk backend.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa
2019-03-19 07:54:12 +01:00
parent 7a264536a6
commit b3f8ad07dd
4 changed files with 162 additions and 10 deletions

View File

@@ -237,6 +237,43 @@
<blockjob name='drive-virtio-disk0' type='copy' state='ready'>
<disk dst='vda'/>
</blockjob>
<blockjob name='test-orphan-job0' type='copy' state='ready'>
<chains>
<disk type='file' format='qcow2'>
<source file='/orphan/source/top.qcow2' index='123'>
<privateData>
<nodenames>
<nodename type='storage' name='orphan-source-top-storage'/>
<nodename type='format' name='orphan-source-top-format'/>
</nodenames>
</privateData>
</source>
<backingStore type='file' index='321'>
<format type='qcow2'/>
<source file='/orphan/source/base.qcow2'>
<privateData>
<nodenames>
<nodename type='storage' name='orphan-source-base-storage'/>
<nodename type='format' name='orphan-source-base-format'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</backingStore>
</disk>
<mirror type='file' format='raw'>
<source file='/orphan/mirror/raw' index='42'>
<privateData>
<nodenames>
<nodename type='storage' name='orphan-mirror-raw-storage'/>
<nodename type='format' name='orphan-mirror-raw-format'/>
</nodenames>
</privateData>
</source>
<backingStore/>
</mirror>
</chains>
</blockjob>
</blockjobs>
<domain type='kvm' id='4'>
<name>copy</name>