提交 b32f715d 编写于 作者: E Erik Skultety

admin: introduce virAdmGetVersion

Unfortunately, client side version retrieval API virGetVersion uses
one-time initialization (due to the fact we might not have initialized the
library by calling connect prior to this) which is not completely compatible
with admin initialization. This API is rather simplistic and reimplementing
it for admin might be the preferred method of reusing it. Note that even though
the method will be reimplemented, the version number is still the same for both
the libvirt and libvirt-admin library.
上级 c4bdff19
...@@ -56,6 +56,9 @@ int virAdmConnectClose(virAdmConnectPtr conn); ...@@ -56,6 +56,9 @@ int virAdmConnectClose(virAdmConnectPtr conn);
int virAdmConnectRef(virAdmConnectPtr conn); int virAdmConnectRef(virAdmConnectPtr conn);
int virAdmGetVersion(unsigned long long *libVer);
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif # endif
......
...@@ -386,3 +386,37 @@ virAdmConnectRef(virAdmConnectPtr conn) ...@@ -386,3 +386,37 @@ virAdmConnectRef(virAdmConnectPtr conn)
return 0; return 0;
} }
/**
* virAdmGetVersion:
* @libVer: where to store the library version
*
* Provides version information. @libVer is the version of the library and will
* allways be set unless an error occurs in which case an error code and a
* generic message will be returned. @libVer format is as follows:
* major * 1,000,000 + minor * 1,000 + release.
*
* NOTE: To get the remote side library version use virAdmConnectGetLibVersion
* instead.
*
* Returns 0 on success, -1 in case of an error.
*/
int
virAdmGetVersion(unsigned long long *libVer)
{
if (virAdmInitialize() < 0)
goto error;
VIR_DEBUG("libVer=%p", libVer);
virResetLastError();
if (!libVer)
goto error;
*libVer = LIBVIR_VERSION_NUMBER;
return 0;
error:
virDispatchError(NULL);
return -1;
}
...@@ -15,4 +15,5 @@ LIBVIRT_ADMIN_1.3.0 { ...@@ -15,4 +15,5 @@ LIBVIRT_ADMIN_1.3.0 {
virAdmConnectOpen; virAdmConnectOpen;
virAdmConnectClose; virAdmConnectClose;
virAdmConnectRef; virAdmConnectRef;
virAdmGetVersion;
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册