return 0;
}
+static int
+remoteDispatchGetLibVersion (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_get_lib_version_ret *ret)
+{
+ unsigned long libVer;
+
+ if (virConnectGetLibVersion (conn, &libVer) == -1) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ ret->lib_ver = libVer;
+ return 0;
+}
+
static int
remoteDispatchGetHostname (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
remote_error *err,
void *args,
remote_get_hostname_ret *ret);
+static int remoteDispatchGetLibVersion(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ void *args,
+ remote_get_lib_version_ret *ret);
static int remoteDispatchGetMaxVcpus(
struct qemud_server *server,
struct qemud_client *client,
remote_storage_pool_is_active_ret val_remote_storage_pool_is_active_ret;
remote_storage_pool_is_persistent_ret val_remote_storage_pool_is_persistent_ret;
remote_interface_is_active_ret val_remote_interface_is_active_ret;
+ remote_get_lib_version_ret val_remote_get_lib_version_ret;
.args_filter = (xdrproc_t) xdr_remote_interface_is_active_args,
.ret_filter = (xdrproc_t) xdr_remote_interface_is_active_ret,
},
+{ /* GetLibVersion => 157 */
+ .fn = (dispatch_fn) remoteDispatchGetLibVersion,
+ .args_filter = (xdrproc_t) xdr_void,
+ .ret_filter = (xdrproc_t) xdr_remote_get_lib_version_ret,
+},
const char * virConnectGetType (virConnectPtr conn);
int virConnectGetVersion (virConnectPtr conn,
unsigned long *hvVer);
+int virConnectGetLibVersion (virConnectPtr conn,
+ unsigned long *libVer);
char * virConnectGetHostname (virConnectPtr conn);
char * virConnectGetURI (virConnectPtr conn);
# Class methods which are written by hand in libvir.c but the Python-level
# code is still automatically generated (so they are not in skip_function()).
skip_impl = (
+ 'virConnectGetLibVersion',
'virConnectListDomainsID',
'virConnectListDefinedDomains',
'virConnectListNetworks',
<?xml version="1.0"?>
<api name='libvir-python'>
<symbols>
+ <function name="virConnectGetLibVersion" file='python'>
+ <info>Returns the libvirt version of the connection host</info>
+ <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
+ <return type='int' info="0 on success, -1 on error"/>
+ </function>
<function name="virConnectListDomainsID" file='python'>
<info>Returns the list of the ID of the domains on the hypervisor</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
return Py_BuildValue ((char *) "kk", libVer, typeVer);
}
+static PyObject *
+libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args)
+{
+ unsigned long libVer;
+ int c_retval;
+ virConnectPtr conn;
+ PyObject *pyobj_conn;
+
+ if (!PyArg_ParseTuple(args, (char *)"O:virConnectGetLibVersion",
+ &pyobj_conn))
+ return(NULL);
+ conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
+
+ LIBVIRT_BEGIN_ALLOW_THREADS;
+
+ c_retval = virConnectGetLibVersion(conn, &libVer);
+
+ LIBVIRT_END_ALLOW_THREADS;
+
+ if (c_retval == -1)
+ return VIR_PY_INT_FAIL;
+
+ return PyInt_FromLong (libVer);
+}
static PyObject *
libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
static PyMethodDef libvirtMethods[] = {
#include "libvirt-export.c"
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
+ {(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion, METH_VARARGS, NULL},
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS, NULL},
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID, METH_VARARGS, NULL},
{(char *) "virConnectListDefinedDomains", libvirt_virConnectListDefinedDomains, METH_VARARGS, NULL},
typedef int
(*virDrvGetVersion) (virConnectPtr conn,
unsigned long *hvVer);
+typedef int
+ (*virDrvGetLibVersion) (virConnectPtr conn,
+ unsigned long *libVer);
typedef char *
(*virDrvGetHostname) (virConnectPtr conn);
typedef char *
virDrvDrvSupportsFeature supports_feature;
virDrvGetType type;
virDrvGetVersion version;
+ virDrvGetLibVersion libvirtVersion;
virDrvGetHostname getHostname;
virDrvGetMaxVcpus getMaxVcpus;
virDrvNodeGetInfo nodeGetInfo;
esxSupportsFeature, /* supports_feature */
esxGetType, /* type */
esxGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
esxGetHostname, /* hostname */
NULL, /* getMaxVcpus */
esxNodeGetInfo, /* nodeGetInfo */
return -1;
}
+/**
+ * virConnectGetLibVersion:
+ * @conn: pointer to the hypervisor connection
+ * @libVer: returns the libvirt library version used on the connection (OUT)
+ *
+ * Provides @libVer, which is the version of libvirt used by the
+ * daemon running on the @conn host
+ *
+ * Returns -1 in case of failure, 0 otherwise, and values for @libVer have
+ * the format major * 1,000,000 + minor * 1,000 + release.
+ */
+int
+virConnectGetLibVersion(virConnectPtr conn, unsigned long *libVer)
+{
+ int ret = -1;
+ DEBUG("conn=%p, libVir=%p", conn, libVer);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return -1;
+ }
+
+ if (libVer == NULL) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ goto error;
+ }
+
+ if (conn->driver->libvirtVersion) {
+ ret = conn->driver->libvirtVersion(conn, libVer);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ *libVer = LIBVIR_VERSION_NUMBER;
+ ret = 0;
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(conn);
+ return ret;
+}
+
/**
* virConnectGetHostname:
* @conn: pointer to a hypervisor connection
LIBVIRT_0.7.3 {
global:
+ virConnectGetLibVersion;
virConnectIsEncrypted;
virConnectIsSecure;
virDomainIsActive;
NULL, /* supports_feature */
NULL, /* type */
lxcVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
NULL, /* getMaxVcpus */
nodeGetInfo, /* nodeGetInfo */
NULL, /* supports_feature */
NULL, /* type */
oneVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
NULL, /* getHostname */
NULL, /* getMaxVcpus */
NULL, /* nodeGetInfo */
NULL, /* supports_feature */
openvzGetType, /* type */
openvzGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
NULL, /* getHostname */
openvzGetMaxVCPUs, /* getMaxVcpus */
nodeGetInfo, /* nodeGetInfo */
NULL, /* supports_feature */
NULL, /* type */
NULL, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
NULL, /* getHostname */
NULL, /* getMaxVcpus */
NULL, /* nodeGetInfo */
qemudSupportsFeature, /* supports_feature */
qemudGetType, /* type */
qemudGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
qemudGetMaxVCPUs, /* getMaxVcpus */
nodeGetInfo, /* nodeGetInfo */
return rv;
}
+static int
+remoteGetLibVersion (virConnectPtr conn, unsigned long *libVer)
+{
+ int rv = -1;
+ remote_get_lib_version_ret ret;
+ struct private_data *priv = conn->privateData;
+
+ remoteDriverLock(priv);
+
+ memset (&ret, 0, sizeof ret);
+ if (call (conn, priv, 0, REMOTE_PROC_GET_LIB_VERSION,
+ (xdrproc_t) xdr_void, (char *) NULL,
+ (xdrproc_t) xdr_remote_get_lib_version_ret,
+ (char *) &ret) == -1)
+ goto done;
+
+ if (libVer) *libVer = ret.lib_ver;
+ rv = 0;
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
static char *
remoteGetHostname (virConnectPtr conn)
{
remoteSupportsFeature, /* supports_feature */
remoteType, /* type */
remoteGetVersion, /* version */
+ remoteGetLibVersion, /* libvirtVersion */
remoteGetHostname, /* getHostname */
remoteGetMaxVcpus, /* getMaxVcpus */
remoteNodeGetInfo, /* nodeGetInfo */
return TRUE;
}
+bool_t
+xdr_remote_get_lib_version_ret (XDR *xdrs, remote_get_lib_version_ret *objp)
+{
+
+ if (!xdr_int64_t (xdrs, &objp->lib_ver))
+ return FALSE;
+ return TRUE;
+}
+
bool_t
xdr_remote_get_hostname_ret (XDR *xdrs, remote_get_hostname_ret *objp)
{
};
typedef struct remote_get_version_ret remote_get_version_ret;
+struct remote_get_lib_version_ret {
+ int64_t lib_ver;
+};
+typedef struct remote_get_lib_version_ret remote_get_lib_version_ret;
+
struct remote_get_hostname_ret {
remote_nonnull_string hostname;
};
REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154,
REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155,
REMOTE_PROC_INTERFACE_IS_ACTIVE = 156,
+ REMOTE_PROC_GET_LIB_VERSION = 157,
};
typedef enum remote_procedure remote_procedure;
extern bool_t xdr_remote_supports_feature_ret (XDR *, remote_supports_feature_ret*);
extern bool_t xdr_remote_get_type_ret (XDR *, remote_get_type_ret*);
extern bool_t xdr_remote_get_version_ret (XDR *, remote_get_version_ret*);
+extern bool_t xdr_remote_get_lib_version_ret (XDR *, remote_get_lib_version_ret*);
extern bool_t xdr_remote_get_hostname_ret (XDR *, remote_get_hostname_ret*);
extern bool_t xdr_remote_get_uri_ret (XDR *, remote_get_uri_ret*);
extern bool_t xdr_remote_get_max_vcpus_args (XDR *, remote_get_max_vcpus_args*);
extern bool_t xdr_remote_supports_feature_ret ();
extern bool_t xdr_remote_get_type_ret ();
extern bool_t xdr_remote_get_version_ret ();
+extern bool_t xdr_remote_get_lib_version_ret ();
extern bool_t xdr_remote_get_hostname_ret ();
extern bool_t xdr_remote_get_uri_ret ();
extern bool_t xdr_remote_get_max_vcpus_args ();
hyper hv_ver;
};
+struct remote_get_lib_version_ret {
+ hyper lib_ver;
+};
+
struct remote_get_hostname_ret {
remote_nonnull_string hostname;
};
REMOTE_PROC_NETWORK_IS_PERSISTENT = 153,
REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154,
REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155,
- REMOTE_PROC_INTERFACE_IS_ACTIVE = 156
-
+ REMOTE_PROC_INTERFACE_IS_ACTIVE = 156,
+ REMOTE_PROC_GET_LIB_VERSION = 157
/*
* Notice how the entries are grouped in sets of 10 ?
NULL, /* supports_feature */
NULL, /* type */
testGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
testGetMaxVCPUs, /* getMaxVcpus */
testNodeGetInfo, /* nodeGetInfo */
NULL, /* supports_feature */
umlGetType, /* type */
umlGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
NULL, /* getMaxVcpus */
nodeGetInfo, /* nodeGetInfo */
NULL, /* supports_feature */
NULL, /* type */
vboxGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
vboxGetMaxVcpus, /* getMaxVcpus */
nodeGetInfo, /* nodeGetInfo */
xenUnifiedSupportsFeature, /* supports_feature */
xenUnifiedType, /* type */
xenUnifiedGetVersion, /* version */
+ NULL, /* libvirtVersion (impl. in libvirt.c) */
virGetHostname, /* getHostname */
xenUnifiedGetMaxVcpus, /* getMaxVcpus */
xenUnifiedNodeGetInfo, /* nodeGetInfo */