[libvirt] qemuParseCommandLine and virDomainDefPostParse (and virDomaniDefAddImplicitControllers)

Laine Stump laine at laine.org
Thu Nov 19 15:15:25 UTC 2015


On 11/19/2015 07:50 AM, Peter Krempa wrote:
> On Thu, Nov 19, 2015 at 11:12:29 +0100, Michal Privoznik wrote:
>> On 18.11.2015 21:19, Laine Stump wrote:
> [...]
>
>>> Does anyone else have an opinion about this?
>>>
>> I believe there's not much gain in calling post parse callbacks during
>> cmd line parsing.
> Well, then you have to extract all the code that is setting the
> hypervisor-specific defaults that can be omitted on the commandline but
> need to be present in the definition (e.g. default network card model)
> into the command line parser, otherwise certain parts of the code will
> crash (e.g. network card model formatter).

Ugh. Right - once you've got the XML out it will get all the defaults 
when it is fed back in to the parser with a virDomainDefine. But the 
very first time it is formatted, right at the end of the argv-to-xml, 
that could cause a problem.

I would say though that, rather than fixing up the object created from 
parsing a qemu commandline by calling functions that are supposed to be 
called to post-process the results of parsing XML to get it ready for 
turning into a qemu commandline, we should instead make the formatter 
more robust, so that it is able to format whatever it is fed without a 
crash (I know that's a tall order!).

What a can of worms...




More information about the libvir-list mailing list