On Thu, Oct 12, 2017 at 15:34:28 -0500, Eric Blake wrote:
On 10/12/2017 02:07 PM, Peter Krempa wrote:
> Express a properly terminated backing chain by putting a
> virStorageSource of type VIR_STORAGE_TYPE_NONE in the chain. The newly
> used helpers simplify this greatly.
>
> The change fixes a bug as formatting an incomplete backing chain and
> parsing it back would end up in expressing a terminated chain since
> src->backingStoreRaw was not populated. By relying on the terminator
> object this can be now processed appropriately.
> +++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
> @@ -22,7 +22,6 @@
> <disk type='file' device='disk'>
> <driver name='qemu' type='raw' cache='none'/>
> <source file='/dev/null'/>
> - <backingStore/>
This gets rid of a lot of terminator markers in the test XML; the code
looks like we will still generate a terminator marker when we know the
full chain, and that lack of a terminator marker is not fatal, but
merely means that we haven't specified a full chain. It feels like a
lot of fallout, but the code with the special terminator does look
nicer, so I can live with the testsuite churn that results.
Actually this was only a quirk of the tests since they parsed backing
chains from XML rather than detecting them from the disk.
When detecting them from disk storage we fill src->backingStoreRaw which
was used to determine when to fill the terminator. Unfortunately the
terminator is filled in when the variable is NULL, which is always in
tests but not always in real use cases.