I need to get libvirt version. Using function
virConnecGetLibVersion(), I've return message like
errore: unknown error
My system settings are:
Kernel: 2.6.33
Hypervisor: QEMU 0.12.3
Libvirt: 0.7.6 (cloned from git)
The code that fails is in src/libvirt.c:1656
=========================================================
if (conn->driver->libvirtVersion) {
ret = conn->driver->libvirtVersion(conn, libVer);
if (ret < 0)
goto error;
return ret;
}
*libVer = LIBVIR_VERSION_NUMBER;
ret = 0;
error:
virDispatchError(conn);
return ret;
}
=========================================================
I noticed that conn->driver->libvirtVersion is NULL for all the
hypervisors except the remote one (src/remote/remote_driver.c), hence
it always dispatch an unknown error. I checked the current libvirt
code (always cloned from git), and the bug is also present.
Is this a bug, or this is a well known behavior?
If this is a bug, a possible solution could be to add the code line
return ret;
before "error:" label. This is my debugged code
=========================================================
if (conn->driver->libvirtVersion) {
ret = conn->driver->libvirtVersion(conn, libVer);
if (ret < 0)
goto error;
return ret;
}
*libVer = LIBVIR_VERSION_NUMBER;
ret = 0;
return ret; /* POSSIBLE BUG SOLUTION */
error:
virDispatchError(conn);
return ret;
}
=========================================================
Have a good day!
--
PAOLO SMIRAGLIA
Via Avigliana 13/5
10138 Torino (TO)
Tel: 0039 333 52 73 593
E-Mail: paolo.smiraglia(a)gmail.com
- - - - -
MSN: mastronano(a)hotmail.com
Jabber: mastronano(a)jabber.linux.it
Skype: paolo.smiraglia