Re: virsh version problem with remote connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 31, 2011 at 11:52:12PM +0200, Matthias Bolte wrote:
> virsh version does basically this
> 
> hvType = virConnectGetType(...)
> virGetVersion(..., hvType, ...)
> [...]
> 
> Assuming a remote connection virConnectGetType calls the remote driver
> that returns the type of the underlying driver on the server side, for
> example QEMU. Then virGetVersion compares hvType to a set of strings
> that depend on configure options and returns LIBVIR_VERSION_NUMBER in
> most cases. Now this fails in case libvirt on the client side is just
> compiled with the remote driver enabled and the server side has the
> actual driver such as the QEMU driver. It just happens to work when
> the actual driver is compiled in on client and server side. But that's
> not the case here.
> 
> freebsd# ./tools/virsh -c qemu+tcp://192.168.178.22/system version
> Compiled against library: libvir 0.9.2
> error: failed to get the library version
> error: this function is not supported by the connection driver: virGetVersion
> 
> This is not FreeBSD specific, happens on Windows as well due to the
> similar drivers configuration. The problem is that virConnectGetType
> returns QEMU, but virGetVersion on the client side only accepts Remote
> as hvType due to all other drivers being disabled on the client side.
> 
> I'm not sure how to fix this properly, does anyone have some idea?

The virGetVersion method is just broken by design. The only parameter that
is useful is the 'libVer' parameter, 'type' and 'typeVer' should both be
left to NULL and ignored. Even the impl of that method shows how braindead
it is, since every conditional line there just returns the hardcoded value
LIBVIR_VERSION_NUMBER, except the remote driver which for inexpicable
reasons returns  REMOTE_PROTOCOL_VERSION, or Xen which returns HV_VERSION.
I say remove all that conditional stuff, ignore 'type' and always set
'typeVer' to LIBVIR_VERSION_NUMBER

To get the hypervisor version the virConnectGetVersion method should be
used instead if wanting the HV version. 


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]