On 02/15/13 18:30, Laine Stump wrote:
On 02/15/2013 06:56 AM, Peter Krempa wrote:
> On 02/15/13 09:53, Michal Privoznik wrote:
>> The other possibility is to generate path during XML parse phase,
>> however this
>> expose something we are lacking for years - callbacks to fill in
>> default values
>
> Yep, that is missing. Without that you will fill the path only when
> the machine is started. This isn't ideal. I have the same issue with
> recording the default network model in the XML.
There are many things with defaults filled in by the parser (either
blindly, or after checking for the type of domain) that IMO really
should be determined by the hypervisor. The biggest example of this is
pretty much everything added by virDomainDefAddImplicitControllers().
Ideally, *nothing* should be added by a call to virDomainDefParseXML();
it should simply build an exact representation of the XML document in
the form of C objects. Since any defaults/implicit devices/whatever
depend not only on the target hypervisor, but often also on the
machinetype, all of that should be done after return from the parse (is
there an instance where it's necessary to add the extra complexity of a
callback?)
The callback is a idea that me, Michal and Jiri were discussing earlier.
It's meant as a abstraction of what you said. The XML is parsed on many
places and the callback would eliminate the need to add the filling
function after every call of the parser.
I agree that the parser shouldn't fill any defaults as it will sooner or
later bite us somewhere else. As of the machine type and controllers:
q35 is biting you, isn't it? :)
As of adding the callback: it might be better to just add a filler
function after every call of the parser, but I was thinking of something
more lazy :)
Peter