[libvirt] [RFC] new preferences requirement

Daniel P. Berrange berrange at redhat.com
Wed Dec 1 10:26:35 UTC 2010


On Wed, Dec 01, 2010 at 05:35:38PM +0800, Osier Yang wrote:
> Hi, all
> 
>    We have some new requirements of preferences, I listed
> which of them I known, and think is useful as follows:
> 
> 1) for the path of x509 certificate and keys of client
> 
>    The path of x509 certificate and keys of client is hard
> coded in remote driver. e.g.
> 
>    /* Defaults for PKI directory. */
>    # define LIBVIRT_PKI_DIR SYSCONFDIR "/pki"
>    # define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem"
>    # define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private
> /clientkey.pem"
>    # define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem"

We can't assume one set of certs/keys is suitable for all
URIs, so making this a preference setting doesn't help. There
needs to be a parameter in the URI to specify a cert/key name
to override the defaults on a per-connection basis

> 2) for default default driver and subdriver for disk image
> 
>    Another requirement of new preference is default driver and subdriver
> for disk images, currently we use "phy" for "driver" in virsh, and
> "raw" for "subdriver" in qemu driver by default if user doesn't specify
> them, it causes bugs, though we could say to user "you should use
> options --driver and --subdriver", but these two options are optional.
> 
>    IMHO, the best solution for those bugs is to provide new preferences.

virsh is broken here. It shouldn't be setting the driver if the
user doesn't specify it. The libvirt hypervisor specific drivers
know the correct defaults if omitted, so virsh shouldn't try to
guess this (wrongly) itself.

> 3) for default NIC and storage type
> 
>    "Chris Phillips" raised up the requirement not long ago:
> 
>    http://www.redhat.com/archives/libvirt-users/2010-November/msg00033.html

This doesn't belong in libvirt. See my reply in that thread.

> ====================
> 
>    Should we add these new preferences(if they are really neccessary)
> in qemu.conf? or create new config file, e.g. The approch Justin
> raised up an approch before:
> http://www.redhat.com/archives/libvir-list/2010-November/msg00651.html
> 
>    Though for Justin's approch, IMHO we'd better also to provide a
> default config file, e.g. "/etc/libvirt/client.conf".

Library APIs like libvirt shouldn't really rely on preference files,
because such a file would silently change behaviour in ways that
applications using the API may not expect. ie the preference
may work nicely for one app/user of libvirt, but not for another
app. Environment variables would cause similar problems too. Anything
that needs to be configured should be configurable via the APIs or
XML.

Regards,
Daniel




More information about the libvir-list mailing list