On 08/26/2014 09:41 AM, Peter Krempa wrote:
On 08/26/14 13:21, Eric Blake wrote:
> The new blockcopy API wants to reuse only a subset of the disk
> hotplug parser - namely, we only care about the embedded
> virStorageSourcePtr inside a <disk> XML. Strange as it may
> seem, it was easier to just parse an entire disk definition,
> then throw away everything but the embedded source, than it
> was to disentangle the source parsing code from the rest of
> the overall disk parsing function. All that I needed was a
> couple of tweaks and a new internal flag that determines
> whether the normally-mandatory target element can be
> gracefully skipped.
>
> While adding the new flag, I noticed we had a verify() that
> was incomplete after several recent internal flag additions;
> move that up higher in the code to make it harder to forget
> to modify on the next flag addition.
"While adding" should have been my clue...
> +verify(((VIR_DOMAIN_XML_INTERNAL_STATUS |
> + VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
> + VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
> + VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM |
> + VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT |
> + VIR_DOMAIN_XML_INTERNAL_CLOCK_ADJUST |
> + VIR_DOMAIN_XML_INTERNAL_DISK_SOURCE)
> + & DUMPXML_FLAGS) == 0);
> +
Again, code tweaks and unrelated fixes ...
to split the cleanup.
I'd really prefer the unrelated tweaks posted separately.
You're absolutely right about splitting it.
Again, what you have works so ACK to this patch even if you decide
against splitting it up.
I'll push the cleanups now, but save the meat for v3 (I'm rebasing the
series on top of my change to support type='block' in the older API).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org