[Libvir] [PATCH][RFC] libvirt ldoms support

Daniel P. Berrange berrange at redhat.com
Thu Apr 10 04:11:28 UTC 2008

On Thu, Apr 10, 2008 at 12:40:02AM +0100, John Levon wrote:
> On Wed, Apr 09, 2008 at 02:38:34PM -0500, Eunice Moon wrote:
> > >> static vshCmdDef commands[] = {
> > >>     {"help", cmdHelp, opts_help, info_help},
> > >>+#ifndef WITH_LDOMS
> > >>     {"attach-device", cmdAttachDevice, opts_attach_device, 
> > >>     info_attach_device},
> > >You shouldn't need to comment out unsupported commands.  They will
> > >return an error if they aren't supported.  In fact, QEMU, KVM and
> > >OpenVZ only support a subset of the available operations.
> > >
> > OK.  I will remove all these #ifdef WITH_LDOMS here.
> I'd personally strongly prefer:
> > >However if you want to propose a more general patch which allows virsh
> > >to determine which operations are supported on the current connection,
> > >then I'm all for it.  Some of the infrastructure is in place to do
> > >this already.
> It's particularly unfriendly to the user to have a whole bunch of
> apparent commands that actually don't work.

A complete solution to this is pretty much an intractable problem though
because there are many levels at which a certain capability may be missing.
Individual libvirt drivers may or may implement a particular API, eg  QEMU
driver does not yet implement device hotplug. We could add an API to let
tools like virsh probe to see if each API is implemented by a driver.

Then consider though that the underlying HV impl you talk to may or may
not implement the API. ie, PCI hotplug only got added to Xen in Xen version
3.2.0. So now you can't simply probe the indiivdual libvirt driver, you 
need to figure out whether the underlying HV supports that - and often
it won't tell you / provide a way to find out - you just have to try the
call and watch it fail

Then further consider that different types of VM support different ops,
eg Xen PV supports disk notplug, but Xen HVm does not. Except when you
have installed PV drivers inside the guest, but libvirt has no idea whether
the guest admin has installed PV drivers or not. So we cannot tel whether
disk hotplug is supported or not. Even if we try to run the hotplug API
in Xen, it'll succeeed from the Dom0 pov -ie we add all the bits to 
xenstore to register the device, but we've no idea if the frontend has
connected to it.

So I don't think it is practical to figure out whether each individual
command from virsh works without actually trying them, so you can't 
hide them from the user. Removing commands at compile time with #ifdef 
is basically guarenteed wrong in.

|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

More information about the libvir-list mailing list