On Wed, Feb 21, 2007 at 11:54:13AM +0000, Mark McLoughlin wrote:
On Sat, 2007-02-17 at 14:12 +0800, Daniel Veillard wrote:
> Agreed let's not mix policies and data. However I assume the API would allow
> to define directories for autostarted configs. I guess having predefined dirs for
> such data is a common concept. And trying to hard code it like /etc/xen is
> really not the best. IIRC we already have a config file now for some daemons,
> can we have such directories entries in the config file ? I guess it would give
> the flexibility required for most uses while keeping a relatively sane API and
> avoiding putting the policy in the data themselve.
I don't think this is specific to the autostart support - i.e. we
already define /etc/libvirt/qemu as the location for qemud domain
definitions and don't have a configurable way of allowing other
directories.
I think it is fine to hardcode at build time - simply allow use of a flag to
configure to change the default, or let the user override the default with a
flag to the libvirt_qemud process
I've no objection to allowing multiple locations and making that
configurable, but there is a few things to bear in mind:
I think allowing multiple directories is complete overkill and unnneccessarily
complicates the code, as you point out below... We're not really expecting
admins to manage these config files directly in any case, so I can't really
see any benefit to using many dirs.
- The common idiom for this is a stack of directories where
definitions in later dirs higher in the stack override definitions
in lower dirs
- When a definition is saved, should it be saved in the highest dir
in the stack, or where it was originally defined, or the later if
it's writable but fall back to the former?
- What about the mismatch between filenames and domain names?
1) Identical filenames with different domain names - if you have
domain Foo in /etc/libvirt/qemud/foo.xml and domain Bar in
/mydomains/foo.xml, should both domains be loaded or just the
highest foo.xml in the stack?
(If the former - think about saving. If e.g. you save Foo, it
may be saved to /mydomains/foo.xml, overwriting the definition
for Bar)
We should assume filename == domain name - all the files we save have
that property and we should either complain about files which don't
match, or 'fix them up' as we load them.
2) Identical domain names with different file names - if you
have
domain Foo defined in /etc/libvirt/qemud/foo.xml and another
definition of domain Foo from /mydomains/bar.xml, should the
highest definition win?
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|