[libvirt] [PATCH] admin: Distribute libvirt-admin.conf
by Martin Kletzander
Commit 48cd3dfa668e5033b02dd029c2e6de558a3c4583 introduced configuration
file for libvirt-admin but forgot to distribute it. Also the change
made to libvirt.conf in commit dbecb87f94e8f1591e3c471b34ae48a7203c9cb3
should've been removed thanks to introduction of separate config file.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
libvirt.spec.in | 1 +
src/Makefile.am | 2 +-
src/libvirt.conf | 1 -
3 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index bbd287b4d570..1f76f2406c5d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1569,6 +1569,7 @@ mv $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.so \
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt-admin.so
rm -f $RPM_BUILD_ROOT%{_bindir}/virt-admin
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/virt-admin.1*
+rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/libvirt-admin.conf
%if %{with_network}
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
diff --git a/src/Makefile.am b/src/Makefile.am
index be3b3c84e863..7219f7c5635a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -79,7 +79,7 @@ moddir = $(libdir)/libvirt/connection-driver
mod_LTLIBRARIES =
confdir = $(sysconfdir)/libvirt
-conf_DATA = libvirt.conf
+conf_DATA = libvirt.conf libvirt-admin.conf
augeasdir = $(datadir)/augeas/lenses
augeas_DATA =
diff --git a/src/libvirt.conf b/src/libvirt.conf
index a6e16ae1534c..da4dfbecb187 100644
--- a/src/libvirt.conf
+++ b/src/libvirt.conf
@@ -16,4 +16,3 @@
# (@uri_default also prevents probing of the hypervisor driver).
#
#uri_default = "qemu:///system"
-#uri_default_admin = "libvirtd:///system"
--
2.6.3
8 years, 11 months
[libvirt] [PATCH] admin: Rename virAdmConnect to virAdmDaemon
by Martin Kletzander
virAdmConnect was named after virConnect, but after some discussions,
most of the APIs called will be working with remote daemon and starting
them virAdmDaemon will make more sense. Only possibly controversal name
is CloseCallback (de)registration, and connecting to the daemon (which
will still be Open/Close), but even this makes sense if one thinks about
the daemon being opened and closed, e.g. as file, etc.
This way all the APIs working with the daemon will start with
virAdmDaemon prefix, they will accept virAdmDaemonPtr as first parameter
and that will better suit with other namings as well (virDomain*,
virAdmServer*, etc.).
Because in virt-admin, the connection name does not refer to a struct
that would have a connect in its name, also adjust 'connname' in
clients. And because it is not used anywhere in the vsh code, move it
from there into each client.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
daemon/admin_server.c | 22 ++---
include/libvirt/libvirt-admin.h | 48 +++++-----
src/admin/admin_protocol.x | 10 +--
src/admin/admin_remote.c | 36 ++++----
src/admin_protocol-structs | 10 +--
src/datatypes.c | 38 ++++----
src/datatypes.h | 28 +++---
src/libvirt-admin.c | 195 ++++++++++++++++++++--------------------
src/libvirt_admin_private.syms | 4 +-
src/libvirt_admin_public.syms | 16 ++--
src/rpc/gendispatch.pl | 2 +-
tools/virsh.c | 18 ++--
tools/virsh.h | 1 +
tools/virt-admin.c | 65 +++++++-------
tools/virt-admin.h | 3 +-
tools/vsh.h | 1 -
16 files changed, 248 insertions(+), 249 deletions(-)
diff --git a/daemon/admin_server.c b/daemon/admin_server.c
index 189091e75a15..678e8bcde852 100644
--- a/daemon/admin_server.c
+++ b/daemon/admin_server.c
@@ -79,11 +79,11 @@ remoteAdmClientInitHook(virNetServerClientPtr client ATTRIBUTE_UNUSED,
/* Functions */
static int
-adminDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr,
- struct admin_connect_open_args *args)
+adminDispatchDaemonOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ struct admin_daemon_open_args *args)
{
unsigned int flags;
struct daemonAdmClientPrivate *priv =
@@ -105,18 +105,18 @@ adminDispatchConnectOpen(virNetServerPtr server ATTRIBUTE_UNUSED,
}
static int
-adminDispatchConnectClose(virNetServerPtr server ATTRIBUTE_UNUSED,
- virNetServerClientPtr client,
- virNetMessagePtr msg ATTRIBUTE_UNUSED,
- virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
+adminDispatchDaemonClose(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr ATTRIBUTE_UNUSED)
{
virNetServerClientDelayedClose(client);
return 0;
}
static int
-adminConnectGetLibVersion(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
- unsigned long long *libVer)
+adminDaemonGetVersion(virNetDaemonPtr dmn ATTRIBUTE_UNUSED,
+ unsigned long long *libVer)
{
if (libVer)
*libVer = LIBVIR_VERSION_NUMBER;
diff --git a/include/libvirt/libvirt-admin.h b/include/libvirt/libvirt-admin.h
index ab9df96b351f..b81698e63f36 100644
--- a/include/libvirt/libvirt-admin.h
+++ b/include/libvirt/libvirt-admin.h
@@ -35,53 +35,51 @@ extern "C" {
# undef __VIR_ADMIN_H_INCLUDES__
/**
- * virAdmConnect:
+ * virAdmDaemon:
*
- * a virAdmConnect is a private structure representing a connection to
- * libvirt daemon.
+ * a virAdmDaemon is a private structure representing a remote daemon.
*/
-typedef struct _virAdmConnect virAdmConnect;
+typedef struct _virAdmDaemon virAdmDaemon;
/**
- * virAdmConnectPtr:
+ * virAdmDaemonPtr:
*
- * a virAdmConnectPtr is pointer to a virAdmConnect private structure,
- * this is the type used to reference a connection to the daemon
- * in the API.
+ * a virAdmDaemonPtr is pointer to a virAdmDaemon private structure,
+ * this is the type used to reference a daemon in the API.
*/
-typedef virAdmConnect *virAdmConnectPtr;
+typedef virAdmDaemon *virAdmDaemonPtr;
-virAdmConnectPtr virAdmConnectOpen(const char *name, unsigned int flags);
-int virAdmConnectClose(virAdmConnectPtr conn);
+virAdmDaemonPtr virAdmDaemonOpen(const char *name, unsigned int flags);
+int virAdmDaemonClose(virAdmDaemonPtr dmn);
-int virAdmConnectRef(virAdmConnectPtr conn);
-int virAdmConnectIsAlive(virAdmConnectPtr conn);
+int virAdmDaemonRef(virAdmDaemonPtr dmn);
+int virAdmDaemonIsAlive(virAdmDaemonPtr dmn);
int virAdmGetVersion(unsigned long long *libVer);
-char *virAdmConnectGetURI(virAdmConnectPtr conn);
+char *virAdmDaemonGetURI(virAdmDaemonPtr dmn);
-int virAdmConnectGetLibVersion(virAdmConnectPtr conn,
- unsigned long long *libVer);
+int virAdmDaemonGetVersion(virAdmDaemonPtr dmn,
+ unsigned long long *libVer);
/**
- * virAdmConnectCloseFunc:
- * @conn: virAdmConnect connection
+ * virAdmDaemonCloseFunc:
+ * @dmn: virAdmDaemon connection
* @reason: reason why the connection was closed (see virConnectCloseReason)
* @opaque: opaque client data
*
* A callback to be registered, in case a connection was closed.
*/
-typedef void (*virAdmConnectCloseFunc)(virAdmConnectPtr conn,
+typedef void (*virAdmDaemonCloseFunc)(virAdmDaemonPtr dmn,
int reason,
void *opaque);
-int virAdmConnectRegisterCloseCallback(virAdmConnectPtr conn,
- virAdmConnectCloseFunc cb,
- void *opaque,
- virFreeCallback freecb);
-int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
- virAdmConnectCloseFunc cb);
+int virAdmDaemonRegisterCloseCallback(virAdmDaemonPtr dmn,
+ virAdmDaemonCloseFunc cb,
+ void *opaque,
+ virFreeCallback freecb);
+int virAdmDaemonUnregisterCloseCallback(virAdmDaemonPtr dmn,
+ virAdmDaemonCloseFunc cb);
# ifdef __cplusplus
}
diff --git a/src/admin/admin_protocol.x b/src/admin/admin_protocol.x
index 878983d2ec74..b168f6fffda7 100644
--- a/src/admin/admin_protocol.x
+++ b/src/admin/admin_protocol.x
@@ -37,11 +37,11 @@ typedef string admin_nonnull_string<ADMIN_STRING_MAX>;
typedef admin_nonnull_string *admin_string;
/*----- Protocol. -----*/
-struct admin_connect_open_args {
+struct admin_daemon_open_args {
unsigned int flags;
};
-struct admin_connect_get_lib_version_ret {
+struct admin_daemon_get_version_ret {
unsigned hyper libVer;
};
@@ -70,15 +70,15 @@ enum admin_procedure {
/**
* @generate: none
*/
- ADMIN_PROC_CONNECT_OPEN = 1,
+ ADMIN_PROC_DAEMON_OPEN = 1,
/**
* @generate: none
*/
- ADMIN_PROC_CONNECT_CLOSE = 2,
+ ADMIN_PROC_DAEMON_CLOSE = 2,
/**
* @generate: both
*/
- ADMIN_PROC_CONNECT_GET_LIB_VERSION = 3
+ ADMIN_PROC_DAEMON_GET_VERSION = 3
};
diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index 7b40ea16e120..8073b0827a51 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -48,7 +48,7 @@ remoteAdminPrivDispose(void *opaque)
static int
-callFull(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
+callFull(virAdmDaemonPtr dmn ATTRIBUTE_UNUSED,
remoteAdminPrivPtr priv,
int *fdin,
size_t fdinlen,
@@ -86,7 +86,7 @@ callFull(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
}
static int
-call(virAdmConnectPtr conn,
+call(virAdmDaemonPtr dmn,
unsigned int flags,
int proc_nr,
xdrproc_t args_filter, char *args,
@@ -94,7 +94,7 @@ call(virAdmConnectPtr conn,
{
virCheckFlags(0, -1);
- return callFull(conn, conn->privateData,
+ return callFull(dmn, dmn->privateData,
NULL, 0, NULL, NULL, proc_nr,
args_filter, args, ret_filter, ret);
}
@@ -106,14 +106,14 @@ remoteAdminClientCloseFunc(virNetClientPtr client ATTRIBUTE_UNUSED,
int reason,
void *opaque)
{
- virAdmConnectCloseCallbackDataPtr cbdata = opaque;
+ virAdmDaemonCloseCallbackDataPtr cbdata = opaque;
virObjectLock(cbdata);
if (cbdata->callback) {
VIR_DEBUG("Triggering connection close callback %p reason=%d, opaque=%p",
cbdata->callback, reason, cbdata->opaque);
- cbdata->callback(cbdata->conn, reason, cbdata->opaque);
+ cbdata->callback(cbdata->dmn, reason, cbdata->opaque);
if (cbdata->freeCallback)
cbdata->freeCallback(cbdata->opaque);
@@ -124,11 +124,11 @@ remoteAdminClientCloseFunc(virNetClientPtr client ATTRIBUTE_UNUSED,
}
static int
-remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
+remoteAdminDaemonOpen(virAdmDaemonPtr dmn, unsigned int flags)
{
int rv = -1;
- remoteAdminPrivPtr priv = conn->privateData;
- admin_connect_open_args args;
+ remoteAdminPrivPtr priv = dmn->privateData;
+ admin_daemon_open_args args;
virObjectLock(priv);
@@ -140,13 +140,13 @@ remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
virResetLastError();
}
- virObjectRef(conn->closeCallback);
+ virObjectRef(dmn->closeCallback);
virNetClientSetCloseCallback(priv->client, remoteAdminClientCloseFunc,
- conn->closeCallback,
+ dmn->closeCallback,
virObjectFreeCallback);
- if (call(conn, 0, ADMIN_PROC_CONNECT_OPEN,
- (xdrproc_t)xdr_admin_connect_open_args, (char *)&args,
+ if (call(dmn, 0, ADMIN_PROC_DAEMON_OPEN,
+ (xdrproc_t)xdr_admin_daemon_open_args, (char *)&args,
(xdrproc_t)xdr_void, (char *)NULL) == -1) {
goto done;
}
@@ -159,14 +159,14 @@ remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags)
}
static int
-remoteAdminConnectClose(virAdmConnectPtr conn)
+remoteAdminDaemonClose(virAdmDaemonPtr dmn)
{
int rv = -1;
- remoteAdminPrivPtr priv = conn->privateData;
+ remoteAdminPrivPtr priv = dmn->privateData;
virObjectLock(priv);
- if (call(conn, 0, ADMIN_PROC_CONNECT_CLOSE,
+ if (call(dmn, 0, ADMIN_PROC_DAEMON_CLOSE,
(xdrproc_t)xdr_void, (char *)NULL,
(xdrproc_t)xdr_void, (char *)NULL) == -1) {
goto done;
@@ -184,10 +184,10 @@ remoteAdminConnectClose(virAdmConnectPtr conn)
static void
remoteAdminPrivFree(void *opaque)
{
- virAdmConnectPtr conn = opaque;
+ virAdmDaemonPtr dmn = opaque;
- remoteAdminConnectClose(conn);
- virObjectUnref(conn->privateData);
+ remoteAdminDaemonClose(dmn);
+ virObjectUnref(dmn->privateData);
}
static remoteAdminPrivPtr
diff --git a/src/admin_protocol-structs b/src/admin_protocol-structs
index 809379be3498..1753f54d36f5 100644
--- a/src/admin_protocol-structs
+++ b/src/admin_protocol-structs
@@ -1,12 +1,12 @@
/* -*- c -*- */
-struct admin_connect_open_args {
+struct admin_daemon_open_args {
u_int flags;
};
-struct admin_connect_get_lib_version_ret {
+struct admin_daemon_get_version_ret {
uint64_t libVer;
};
enum admin_procedure {
- ADMIN_PROC_CONNECT_OPEN = 1,
- ADMIN_PROC_CONNECT_CLOSE = 2,
- ADMIN_PROC_CONNECT_GET_LIB_VERSION = 3,
+ ADMIN_PROC_DAEMON_OPEN = 1,
+ ADMIN_PROC_DAEMON_CLOSE = 2,
+ ADMIN_PROC_DAEMON_GET_VERSION = 3,
};
diff --git a/src/datatypes.c b/src/datatypes.c
index c832d805859f..dc592b68d7cf 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -59,11 +59,11 @@ static void virStreamDispose(void *obj);
static void virStorageVolDispose(void *obj);
static void virStoragePoolDispose(void *obj);
-virClassPtr virAdmConnectClass;
-virClassPtr virAdmConnectCloseCallbackDataClass;
+virClassPtr virAdmDaemonClass;
+virClassPtr virAdmDaemonCloseCallbackDataClass;
-static void virAdmConnectDispose(void *obj);
-static void virAdmConnectCloseCallbackDataDispose(void *obj);
+static void virAdmDaemonDispose(void *obj);
+static void virAdmDaemonCloseCallbackDataDispose(void *obj);
static int
virDataTypesOnceInit(void)
@@ -92,8 +92,8 @@ virDataTypesOnceInit(void)
DECLARE_CLASS(virStorageVol);
DECLARE_CLASS(virStoragePool);
- DECLARE_CLASS_LOCKABLE(virAdmConnect);
- DECLARE_CLASS_LOCKABLE(virAdmConnectCloseCallbackData);
+ DECLARE_CLASS_LOCKABLE(virAdmDaemon);
+ DECLARE_CLASS_LOCKABLE(virAdmDaemonCloseCallbackData);
#undef DECLARE_CLASS_COMMON
#undef DECLARE_CLASS_LOCKABLE
@@ -814,18 +814,18 @@ virDomainSnapshotDispose(void *obj)
}
-virAdmConnectPtr
-virAdmConnectNew(void)
+virAdmDaemonPtr
+virAdmDaemonNew(void)
{
- virAdmConnectPtr ret;
+ virAdmDaemonPtr ret;
if (virDataTypesInitialize() < 0)
return NULL;
- if (!(ret = virObjectLockableNew(virAdmConnectClass)))
+ if (!(ret = virObjectLockableNew(virAdmDaemonClass)))
return NULL;
- if (!(ret->closeCallback = virObjectLockableNew(virAdmConnectCloseCallbackDataClass)))
+ if (!(ret->closeCallback = virObjectLockableNew(virAdmDaemonCloseCallbackDataClass)))
goto error;
return ret;
@@ -836,21 +836,21 @@ virAdmConnectNew(void)
}
static void
-virAdmConnectDispose(void *obj)
+virAdmDaemonDispose(void *obj)
{
- virAdmConnectPtr conn = obj;
+ virAdmDaemonPtr dmn = obj;
- if (conn->privateDataFreeFunc)
- conn->privateDataFreeFunc(conn);
+ if (dmn->privateDataFreeFunc)
+ dmn->privateDataFreeFunc(dmn);
- virURIFree(conn->uri);
- virObjectUnref(conn->closeCallback);
+ virURIFree(dmn->uri);
+ virObjectUnref(dmn->closeCallback);
}
static void
-virAdmConnectCloseCallbackDataDispose(void *obj)
+virAdmDaemonCloseCallbackDataDispose(void *obj)
{
- virAdmConnectCloseCallbackDataPtr cb_data = obj;
+ virAdmDaemonCloseCallbackDataPtr cb_data = obj;
virObjectLock(cb_data);
diff --git a/src/datatypes.h b/src/datatypes.h
index 1b1777daa885..0402f09d5736 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -41,7 +41,7 @@ extern virClassPtr virStreamClass;
extern virClassPtr virStorageVolClass;
extern virClassPtr virStoragePoolClass;
-extern virClassPtr virAdmConnectClass;
+extern virClassPtr virAdmDaemonClass;
# define virCheckConnectReturn(obj, retval) \
do { \
@@ -297,9 +297,9 @@ extern virClassPtr virAdmConnectClass;
dom, NULLSTR(_domname), _uuidstr, __VA_ARGS__); \
} while (0)
-# define virCheckAdmConnectReturn(obj, retval) \
+# define virCheckAdmDaemonReturn(obj, retval) \
do { \
- if (!virObjectIsClass(obj, virAdmConnectClass)) { \
+ if (!virObjectIsClass(obj, virAdmDaemonClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
__FILE__, __FUNCTION__, __LINE__, \
__FUNCTION__); \
@@ -307,9 +307,9 @@ extern virClassPtr virAdmConnectClass;
return retval; \
} \
} while (0)
-# define virCheckAdmConnectGoto(obj, label) \
+# define virCheckAdmDaemonGoto(obj, label) \
do { \
- if (!virObjectIsClass(obj, virAdmConnectClass)) { \
+ if (!virObjectIsClass(obj, virAdmDaemonClass)) { \
virReportErrorHelper(VIR_FROM_THIS, VIR_ERR_INVALID_CONN, \
__FILE__, __FUNCTION__, __LINE__, \
__FUNCTION__); \
@@ -331,8 +331,8 @@ extern virClassPtr virAdmConnectClass;
typedef struct _virConnectCloseCallbackData virConnectCloseCallbackData;
typedef virConnectCloseCallbackData *virConnectCloseCallbackDataPtr;
-typedef struct _virAdmConnectCloseCallbackData virAdmConnectCloseCallbackData;
-typedef virAdmConnectCloseCallbackData *virAdmConnectCloseCallbackDataPtr;
+typedef struct _virAdmDaemonCloseCallbackData virAdmDaemonCloseCallbackData;
+typedef virAdmDaemonCloseCallbackData *virAdmDaemonCloseCallbackDataPtr;
/**
* Internal structures holding data related to connection close callbacks.
@@ -346,11 +346,11 @@ struct _virConnectCloseCallbackData {
virFreeCallback freeCallback;
};
-struct _virAdmConnectCloseCallbackData {
+struct _virAdmDaemonCloseCallbackData {
virObjectLockable parent;
- virAdmConnectPtr conn;
- virAdmConnectCloseFunc callback;
+ virAdmDaemonPtr dmn;
+ virAdmDaemonCloseFunc callback;
void *opaque;
virFreeCallback freeCallback;
};
@@ -402,11 +402,11 @@ struct _virConnect {
};
/**
- * _virAdmConnect:
+ * _virAdmDaemon:
*
* Internal structure associated to an admin connection
*/
-struct _virAdmConnect {
+struct _virAdmDaemon {
virObjectLockable object;
virURIPtr uri;
@@ -414,7 +414,7 @@ struct _virAdmConnect {
virFreeCallback privateDataFreeFunc;
/* Per-connection close callback */
- virAdmConnectCloseCallbackDataPtr closeCallback;
+ virAdmDaemonCloseCallbackDataPtr closeCallback;
};
@@ -599,6 +599,6 @@ virNWFilterPtr virGetNWFilter(virConnectPtr conn,
virDomainSnapshotPtr virGetDomainSnapshot(virDomainPtr domain,
const char *name);
-virAdmConnectPtr virAdmConnectNew(void);
+virAdmDaemonPtr virAdmDaemonNew(void);
#endif /* __VIR_DATATYPES_H__ */
diff --git a/src/libvirt-admin.c b/src/libvirt-admin.c
index 6e6da81b3f5d..7b767bdebd4c 100644
--- a/src/libvirt-admin.c
+++ b/src/libvirt-admin.c
@@ -53,7 +53,7 @@ virAdmGlobalInit(void)
{
/* It would be nice if we could trace the use of this call, to
* help diagnose in log files if a user calls something other than
- * virAdmConnectOpen first. But we can't rely on VIR_DEBUG working
+ * virAdmDaemonOpen first. But we can't rely on VIR_DEBUG working
* until after initialization is complete, and since this is
* one-shot, we never get here again. */
if (virThreadInitialize() < 0 ||
@@ -183,20 +183,20 @@ virAdmGetDefaultURI(virConfPtr conf)
}
/**
- * virAdmConnectOpen:
+ * virAdmDaemonOpen:
* @name: uri of the daemon to connect to, NULL for default
* @flags: unused, must be 0
*
* Opens connection to admin interface of the daemon.
*
- * Returns @virAdmConnectPtr object or NULL on error
+ * Returns @virAdmDaemonPtr object or NULL on error
*/
-virAdmConnectPtr
-virAdmConnectOpen(const char *name, unsigned int flags)
+virAdmDaemonPtr
+virAdmDaemonOpen(const char *name, unsigned int flags)
{
char *sock_path = NULL;
char *alias = NULL;
- virAdmConnectPtr conn = NULL;
+ virAdmDaemonPtr dmn = NULL;
virConfPtr conf = NULL;
if (virAdmInitialize() < 0)
@@ -206,7 +206,7 @@ virAdmConnectOpen(const char *name, unsigned int flags)
virResetLastError();
virCheckFlags(VIR_CONNECT_NO_ALIASES, NULL);
- if (!(conn = virAdmConnectNew()))
+ if (!(dmn = virAdmDaemonNew()))
goto error;
if (virConfLoadConfig(&conf, "libvirt-admin.conf") < 0)
@@ -219,46 +219,46 @@ virAdmConnectOpen(const char *name, unsigned int flags)
virURIResolveAlias(conf, name, &alias) < 0))
goto error;
- if (!(conn->uri = virURIParse(alias ? alias : name)))
+ if (!(dmn->uri = virURIParse(alias ? alias : name)))
goto error;
- if (!(sock_path = getSocketPath(conn->uri)))
+ if (!(sock_path = getSocketPath(dmn->uri)))
goto error;
- if (!(conn->privateData = remoteAdminPrivNew(sock_path)))
+ if (!(dmn->privateData = remoteAdminPrivNew(sock_path)))
goto error;
- conn->privateDataFreeFunc = remoteAdminPrivFree;
+ dmn->privateDataFreeFunc = remoteAdminPrivFree;
- if (remoteAdminConnectOpen(conn, flags) < 0)
+ if (remoteAdminDaemonOpen(dmn, flags) < 0)
goto error;
cleanup:
VIR_FREE(sock_path);
VIR_FREE(alias);
virConfFree(conf);
- return conn;
+ return dmn;
error:
virDispatchError(NULL);
- virObjectUnref(conn);
- conn = NULL;
+ virObjectUnref(dmn);
+ dmn = NULL;
goto cleanup;
}
/**
- * virAdmConnectClose:
- * @conn: pointer to admin connection to close
+ * virAdmDaemonClose:
+ * @dmn: pointer to admin connection to close
*
* This function closes the admin connection to the Hypervisor. This should not
* be called if further interaction with the Hypervisor are needed especially if
* there is running domain which need further monitoring by the application.
*
* Connections are reference counted; the count is explicitly increased by the
- * initial virAdmConnectOpen, as well as virAdmConnectRef; it is also temporarily
+ * initial virAdmDaemonOpen, as well as virAdmDaemonRef; it is also temporarily
* increased by other API that depend on the connection remaining alive. The
- * open and every virAdmConnectRef call should have a matching
- * virAdmConnectClose, and all other references will be released after the
+ * open and every virAdmDaemonRef call should have a matching
+ * virAdmDaemonClose, and all other references will be released after the
* corresponding operation completes.
*
* Returns a positive number if at least 1 reference remains on success. The
@@ -266,34 +266,34 @@ virAdmConnectOpen(const char *name, unsigned int flags)
* return of 0 implies no references remain and the connection is closed and
* memory has been freed. A return of -1 implies a failure.
*
- * It is possible for the last virAdmConnectClose to return a positive value if
+ * It is possible for the last virAdmDaemonClose to return a positive value if
* some other object still has a temporary reference to the connection, but the
* application should not try to further use a connection after the
- * virAdmConnectClose that matches the initial open.
+ * virAdmDaemonClose that matches the initial open.
*/
int
-virAdmConnectClose(virAdmConnectPtr conn)
+virAdmDaemonClose(virAdmDaemonPtr dmn)
{
- VIR_DEBUG("conn=%p", conn);
+ VIR_DEBUG("dmn=%p", dmn);
virResetLastError();
- if (!conn)
+ if (!dmn)
return 0;
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
- if (!virObjectUnref(conn))
+ if (!virObjectUnref(dmn))
return 0;
return 1;
}
/**
- * virAdmConnectRef:
- * @conn: the connection to hold a reference on
+ * virAdmDaemonRef:
+ * @dmn: the connection to hold a reference on
*
* Increment the reference count on the connection. For each additional call to
- * this method, there shall be a corresponding call to virAdmConnectClose to
+ * this method, there shall be a corresponding call to virAdmDaemonClose to
* release the reference count, once the caller no longer needs the reference to
* this object.
*
@@ -305,15 +305,15 @@ virAdmConnectClose(virAdmConnectPtr conn)
* Returns 0 in case of success, -1 in case of failure
*/
int
-virAdmConnectRef(virAdmConnectPtr conn)
+virAdmDaemonRef(virAdmDaemonPtr dmn)
{
- VIR_DEBUG("conn=%p refs=%d", conn,
- conn ? conn->object.parent.u.s.refs : 0);
+ VIR_DEBUG("dmn=%p refs=%d", dmn,
+ dmn ? dmn->object.parent.u.s.refs : 0);
virResetLastError();
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
- virObjectRef(conn);
+ virObjectRef(dmn);
return 0;
}
@@ -327,8 +327,7 @@ virAdmConnectRef(virAdmConnectPtr conn)
* 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.
+ * NOTE: To get the remote side version use virAdmDaemonGetVersion instead.
*
* Returns 0 on success, -1 in case of an error.
*/
@@ -353,8 +352,8 @@ virAdmGetVersion(unsigned long long *libVer)
}
/**
- * virAdmConnectIsAlive:
- * @conn: connection to admin server
+ * virAdmDaemonIsAlive:
+ * @dmn: connection to admin server
*
* Decide whether the connection to the admin server is alive or not.
* Connection is considered alive if the channel it is running over is not
@@ -364,20 +363,20 @@ virAdmGetVersion(unsigned long long *libVer)
* connection at all or the channel has already been closed, or -1 on error.
*/
int
-virAdmConnectIsAlive(virAdmConnectPtr conn)
+virAdmDaemonIsAlive(virAdmDaemonPtr dmn)
{
bool ret;
remoteAdminPrivPtr priv = NULL;
- VIR_DEBUG("conn=%p", conn);
+ VIR_DEBUG("dmn=%p", dmn);
- if (!conn)
+ if (!dmn)
return 0;
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
virResetLastError();
- priv = conn->privateData;
+ priv = dmn->privateData;
virObjectLock(priv);
ret = virNetClientIsOpen(priv->client);
virObjectUnlock(priv);
@@ -386,35 +385,35 @@ virAdmConnectIsAlive(virAdmConnectPtr conn)
}
/**
- * virAdmConnectGetURI:
- * @conn: pointer to an admin connection
+ * virAdmDaemonGetURI:
+ * @dmn: pointer to an admin connection
*
* String returned by this method is normally the same as the string passed
- * to the virAdmConnectOpen. Even if NULL was passed to virAdmConnectOpen,
+ * to the virAdmDaemonOpen. Even if NULL was passed to virAdmDaemonOpen,
* this method returns a non-null URI string.
*
* Returns an URI string related to the connection or NULL in case of an error.
* Caller is responsible for freeing the string.
*/
char *
-virAdmConnectGetURI(virAdmConnectPtr conn)
+virAdmDaemonGetURI(virAdmDaemonPtr dmn)
{
char *uri = NULL;
- VIR_DEBUG("conn=%p", conn);
+ VIR_DEBUG("dmn=%p", dmn);
virResetLastError();
- virCheckAdmConnectReturn(conn, NULL);
+ virCheckAdmDaemonReturn(dmn, NULL);
- if (!(uri = virURIFormat(conn->uri)))
+ if (!(uri = virURIFormat(dmn->uri)))
virDispatchError(NULL);
return uri;
}
/**
- * virAdmConnectRegisterCloseCallback:
- * @conn: connection to admin server
+ * virAdmDaemonRegisterCloseCallback:
+ * @dmn: connection to admin server
* @cb: callback to be invoked upon connection close
* @opaque: user data to pass to @cb
* @freecb: callback to free @opaque
@@ -430,103 +429,103 @@ virAdmConnectGetURI(virAdmConnectPtr conn)
*
* Returns 0 on success, -1 on error
*/
-int virAdmConnectRegisterCloseCallback(virAdmConnectPtr conn,
- virAdmConnectCloseFunc cb,
- void *opaque,
- virFreeCallback freecb)
+int virAdmDaemonRegisterCloseCallback(virAdmDaemonPtr dmn,
+ virAdmDaemonCloseFunc cb,
+ void *opaque,
+ virFreeCallback freecb)
{
- VIR_DEBUG("conn=%p", conn);
+ VIR_DEBUG("dmn=%p", dmn);
virResetLastError();
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
- virObjectRef(conn);
+ virObjectRef(dmn);
- virObjectLock(conn);
- virObjectLock(conn->closeCallback);
+ virObjectLock(dmn);
+ virObjectLock(dmn->closeCallback);
virCheckNonNullArgGoto(cb, error);
- if (conn->closeCallback->callback) {
+ if (dmn->closeCallback->callback) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("A close callback is already registered"));
goto error;
}
- conn->closeCallback->conn = conn;
- conn->closeCallback->callback = cb;
- conn->closeCallback->opaque = opaque;
- conn->closeCallback->freeCallback = freecb;
+ dmn->closeCallback->dmn = dmn;
+ dmn->closeCallback->callback = cb;
+ dmn->closeCallback->opaque = opaque;
+ dmn->closeCallback->freeCallback = freecb;
- virObjectUnlock(conn->closeCallback);
- virObjectUnlock(conn);
+ virObjectUnlock(dmn->closeCallback);
+ virObjectUnlock(dmn);
return 0;
error:
- virObjectUnlock(conn->closeCallback);
- virObjectUnlock(conn);
+ virObjectUnlock(dmn->closeCallback);
+ virObjectUnlock(dmn);
virDispatchError(NULL);
- virObjectUnref(conn);
+ virObjectUnref(dmn);
return -1;
}
/**
- * virAdmConnectUnregisterCloseCallback:
- * @conn: pointer to connection object
+ * virAdmDaemonUnregisterCloseCallback:
+ * @dmn: pointer to connection object
* @cb: pointer to the current registered callback
*
* Unregisters the callback previously set with the
- * virAdmConnectRegisterCloseCallback method. The callback
+ * virAdmDaemonRegisterCloseCallback method. The callback
* will no longer receive notifications when the connection
* closes. If a virFreeCallback was provided at time of
* registration, it will be invoked.
*
* Returns 0 on success, -1 on error
*/
-int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
- virAdmConnectCloseFunc cb)
+int virAdmDaemonUnregisterCloseCallback(virAdmDaemonPtr dmn,
+ virAdmDaemonCloseFunc cb)
{
- VIR_DEBUG("conn=%p", conn);
+ VIR_DEBUG("dmn=%p", dmn);
virResetLastError();
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
- virObjectLock(conn);
- virObjectLock(conn->closeCallback);
+ virObjectLock(dmn);
+ virObjectLock(dmn->closeCallback);
virCheckNonNullArgGoto(cb, error);
- if (conn->closeCallback->callback != cb) {
+ if (dmn->closeCallback->callback != cb) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("A different callback was requested"));
goto error;
}
- conn->closeCallback->callback = NULL;
- if (conn->closeCallback->freeCallback)
- conn->closeCallback->freeCallback(conn->closeCallback->opaque);
- conn->closeCallback->freeCallback = NULL;
+ dmn->closeCallback->callback = NULL;
+ if (dmn->closeCallback->freeCallback)
+ dmn->closeCallback->freeCallback(dmn->closeCallback->opaque);
+ dmn->closeCallback->freeCallback = NULL;
- virObjectUnlock(conn->closeCallback);
- virObjectUnlock(conn);
- virObjectUnref(conn);
+ virObjectUnlock(dmn->closeCallback);
+ virObjectUnlock(dmn);
+ virObjectUnref(dmn);
return 0;
error:
- virObjectUnlock(conn->closeCallback);
- virObjectUnlock(conn);
+ virObjectUnlock(dmn->closeCallback);
+ virObjectUnlock(dmn);
virDispatchError(NULL);
return -1;
}
/**
- * virAdmConnectGetLibVersion:
- * @conn: pointer to an active admin connection
+ * virAdmDaemonGetVersion:
+ * @dmn: pointer to an active admin connection
* @libVer: stores the current remote libvirt version number
*
* Retrieves the remote side libvirt version used by the daemon. Format
@@ -535,17 +534,17 @@ int virAdmConnectUnregisterCloseCallback(virAdmConnectPtr conn,
*
* Returns 0 on success, -1 on failure and @libVer follows this format:
*/
-int virAdmConnectGetLibVersion(virAdmConnectPtr conn,
- unsigned long long *libVer)
+int virAdmDaemonGetVersion(virAdmDaemonPtr dmn,
+ unsigned long long *libVer)
{
- VIR_DEBUG("conn=%p, libVir=%p", conn, libVer);
+ VIR_DEBUG("dmn=%p, libVir=%p", dmn, libVer);
virResetLastError();
- virCheckAdmConnectReturn(conn, -1);
+ virCheckAdmDaemonReturn(dmn, -1);
virCheckNonNullArgReturn(libVer, -1);
- if (remoteAdminConnectGetLibVersion(conn, libVer) < 0)
+ if (remoteAdminDaemonGetVersion(dmn, libVer) < 0)
goto error;
return 0;
diff --git a/src/libvirt_admin_private.syms b/src/libvirt_admin_private.syms
index 85380dcb2fc5..3dc06a0a8763 100644
--- a/src/libvirt_admin_private.syms
+++ b/src/libvirt_admin_private.syms
@@ -6,8 +6,8 @@
#
# admin/admin_protocol.x
-xdr_admin_connect_get_lib_version_ret;
-xdr_admin_connect_open_args;
+xdr_admin_daemon_get_version_ret;
+xdr_admin_daemon_open_args;
# Let emacs know we want case-insensitive sorting
# Local Variables:
diff --git a/src/libvirt_admin_public.syms b/src/libvirt_admin_public.syms
index 33b1db45a31d..75ff8a8c1d4a 100644
--- a/src/libvirt_admin_public.syms
+++ b/src/libvirt_admin_public.syms
@@ -12,13 +12,13 @@
#
LIBVIRT_ADMIN_1.3.0 {
global:
- virAdmConnectOpen;
- virAdmConnectClose;
- virAdmConnectRef;
+ virAdmDaemonClose;
+ virAdmDaemonGetURI;
+ virAdmDaemonGetVersion;
+ virAdmDaemonIsAlive;
+ virAdmDaemonOpen;
+ virAdmDaemonRef;
+ virAdmDaemonRegisterCloseCallback;
+ virAdmDaemonUnregisterCloseCallback;
virAdmGetVersion;
- virAdmConnectIsAlive;
- virAdmConnectGetURI;
- virAdmConnectGetLibVersion;
- virAdmConnectRegisterCloseCallback;
- virAdmConnectUnregisterCloseCallback;
};
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 5cfc5120b209..eb45465e1e75 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -49,7 +49,7 @@ my $procprefix = shift or die "missing procedure prefix argument";
my $protocol = shift or die "missing protocol argument";
my @autogen;
-my $connect_ptr = $structprefix eq "admin" ? "virAdmConnectPtr" : "virConnectPtr";
+my $connect_ptr = $structprefix eq "admin" ? "virAdmDaemonPtr" : "virConnectPtr";
my $prefix = ($structprefix eq "admin") ? "admin" : "vir";
sub fixup_name {
diff --git a/tools/virsh.c b/tools/virsh.c
index 7484bed8ebd5..96316bfb9140 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -198,7 +198,7 @@ virshReconnect(vshControl *ctl)
"disconnect from the hypervisor"));
}
- priv->conn = virshConnect(ctl, ctl->connname, priv->readonly);
+ priv->conn = virshConnect(ctl, priv->connname, priv->readonly);
if (!priv->conn) {
if (disconnected)
@@ -275,18 +275,18 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
priv->conn = NULL;
}
- VIR_FREE(ctl->connname);
+ VIR_FREE(priv->connname);
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
return false;
- ctl->connname = vshStrdup(ctl, name);
+ priv->connname = vshStrdup(ctl, name);
priv->useGetInfo = false;
priv->useSnapshotOld = false;
priv->blockJobNoBytes = false;
priv->readonly = ro;
- priv->conn = virshConnect(ctl, ctl->connname, priv->readonly);
+ priv->conn = virshConnect(ctl, priv->connname, priv->readonly);
if (!priv->conn) {
vshError(ctl, "%s", _("Failed to connect to the hypervisor"));
@@ -398,7 +398,7 @@ virshInit(vshControl *ctl)
NULL)) < 0)
return false;
- if (ctl->connname) {
+ if (priv->connname) {
virshReconnect(ctl);
/* Connecting to a named connection must succeed, but we delay
* connecting to the default connection until we need it
@@ -430,7 +430,7 @@ virshDeinit(vshControl *ctl)
virshControlPtr priv = ctl->privData;
vshDeinit(ctl);
- VIR_FREE(ctl->connname);
+ VIR_FREE(priv->connname);
if (priv->conn) {
int ret;
virConnectUnregisterCloseCallback(priv->conn, virshCatchDisconnect);
@@ -706,8 +706,8 @@ virshParseArgv(vshControl *ctl, int argc, char **argv)
while ((arg = getopt_long(argc, argv, "+:c:d:e:hk:K:l:qrtvV", opt, &longindex)) != -1) {
switch (arg) {
case 'c':
- VIR_FREE(ctl->connname);
- ctl->connname = vshStrdup(ctl, optarg);
+ VIR_FREE(priv->connname);
+ priv->connname = vshStrdup(ctl, optarg);
break;
case 'd':
if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) {
@@ -934,7 +934,7 @@ main(int argc, char **argv)
virFileActivateDirOverride(argv[0]);
if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI")))
- ctl->connname = vshStrdup(ctl, defaultConn);
+ virshCtl.connname = vshStrdup(ctl, defaultConn);
if (!vshInit(ctl, cmdGroups, NULL))
exit(EXIT_FAILURE);
diff --git a/tools/virsh.h b/tools/virsh.h
index 3402408e8992..1845b0e52d34 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -69,6 +69,7 @@ typedef struct _virshCtrlData virshCtrlData;
*/
struct _virshControl {
virConnectPtr conn; /* connection to hypervisor (MAY BE NULL) */
+ char *connname; /* connection name */
bool readonly; /* connect readonly (first time only, not
* during explicit connect command)
*/
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 137296357d25..3b5efab9cf04 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -56,11 +56,11 @@ static const vshClientHooks hooks;
* vshAdmCatchDisconnect:
*
* We get here when the connection was closed. Unlike virsh, we do not save
- * the fact that the event was raised, sice there is virAdmConnectIsAlive to
+ * the fact that the event was raised, sice there is virAdmDaemonIsAlive to
* check if the communication channel has not been closed by remote party.
*/
static void
-vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
+vshAdmCatchDisconnect(virAdmDaemonPtr dmn ATTRIBUTE_UNUSED,
int reason,
void *opaque)
{
@@ -73,7 +73,7 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
return;
error = virSaveLastError();
- uri = virAdmConnectGetURI(conn);
+ uri = virAdmDaemonGetURI(dmn);
switch ((virConnectCloseReason) reason) {
case VIR_CONNECT_CLOSE_REASON_ERROR:
@@ -100,21 +100,21 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
}
static int
-vshAdmConnect(vshControl *ctl, unsigned int flags)
+vshAdmDaemon(vshControl *ctl, unsigned int flags)
{
vshAdmControlPtr priv = ctl->privData;
- priv->conn = virAdmConnectOpen(ctl->connname, flags);
+ priv->dmn = virAdmDaemonOpen(priv->name, flags);
- if (!priv->conn) {
+ if (!priv->dmn) {
if (priv->wantReconnect)
vshError(ctl, "%s", _("Failed to reconnect to the admin server"));
else
vshError(ctl, "%s", _("Failed to connect to the admin server"));
return -1;
} else {
- if (virAdmConnectRegisterCloseCallback(priv->conn, vshAdmCatchDisconnect,
- NULL, NULL) < 0)
+ if (virAdmDaemonRegisterCloseCallback(priv->dmn, vshAdmCatchDisconnect,
+ NULL, NULL) < 0)
vshError(ctl, "%s", _("Unable to register disconnect callback"));
if (priv->wantReconnect)
@@ -132,17 +132,17 @@ vshAdmDisconnect(vshControl *ctl)
int ret = 0;
vshAdmControlPtr priv = ctl->privData;
- if (!priv->conn)
+ if (!priv->dmn)
return ret;
- virAdmConnectUnregisterCloseCallback(priv->conn, vshAdmCatchDisconnect);
- ret = virAdmConnectClose(priv->conn);
+ virAdmDaemonUnregisterCloseCallback(priv->dmn, vshAdmCatchDisconnect);
+ ret = virAdmDaemonClose(priv->dmn);
if (ret < 0)
vshError(ctl, "%s", _("Failed to disconnect from the admin server"));
else if (ret > 0)
vshError(ctl, "%s", _("One or more references were leaked after "
"disconnect from the hypervisor"));
- priv->conn = NULL;
+ priv->dmn = NULL;
return ret;
}
@@ -156,11 +156,11 @@ static void
vshAdmReconnect(vshControl *ctl)
{
vshAdmControlPtr priv = ctl->privData;
- if (priv->conn)
+ if (priv->dmn)
priv->wantReconnect = true;
vshAdmDisconnect(ctl);
- vshAdmConnect(ctl, 0);
+ vshAdmDaemon(ctl, 0);
priv->wantReconnect = false;
}
@@ -185,7 +185,7 @@ cmdURI(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
char *uri;
vshAdmControlPtr priv = ctl->privData;
- uri = virAdmConnectGetURI(priv->conn);
+ uri = virAdmDaemonGetURI(priv->dmn);
if (!uri) {
vshError(ctl, "%s", _("failed to get URI"));
return false;
@@ -243,7 +243,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
vshPrint(ctl, _("Using library: libvirt %d.%d.%d\n"),
major, minor, rel);
- ret = virAdmConnectGetLibVersion(priv->conn, &daemonVersion);
+ ret = virAdmDaemonGetVersion(priv->dmn, &daemonVersion);
if (ret < 0) {
vshError(ctl, "%s", _("failed to get the daemon version"));
} else {
@@ -292,28 +292,28 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "name", &name) < 0)
return false;
- VIR_FREE(ctl->connname);
- ctl->connname = vshStrdup(ctl, name);
+ VIR_FREE(priv->name);
+ priv->name = vshStrdup(ctl, name);
vshAdmReconnect(ctl);
- return !!priv->conn;
+ return !!priv->dmn;
}
static void *
-vshAdmConnectionHandler(vshControl *ctl)
+vshAdmDaemonionHandler(vshControl *ctl)
{
vshAdmControlPtr priv = ctl->privData;
- if (!virAdmConnectIsAlive(priv->conn))
+ if (!virAdmDaemonIsAlive(priv->dmn))
vshAdmReconnect(ctl);
- if (!virAdmConnectIsAlive(priv->conn)) {
+ if (!virAdmDaemonIsAlive(priv->dmn)) {
vshError(ctl, "%s", _("no valid connection"));
return NULL;
}
- return priv->conn;
+ return priv->dmn;
}
/*
@@ -329,7 +329,7 @@ vshAdmInit(vshControl *ctl)
* work properly */
vshInitReload(ctl);
- if (priv->conn)
+ if (priv->dmn)
return false;
/* set up the library error handler */
@@ -342,7 +342,7 @@ vshAdmInit(vshControl *ctl)
return false;
ctl->eventLoopStarted = true;
- if (ctl->connname) {
+ if (priv->name) {
vshAdmReconnect(ctl);
/* Connecting to a named connection must succeed, but we delay
* connecting to the default connection until we need it
@@ -350,7 +350,7 @@ vshAdmInit(vshControl *ctl)
* non-default connection, or might be 'help' which needs no
* connection).
*/
- if (!priv->conn) {
+ if (!priv->dmn) {
vshReportError(ctl);
return false;
}
@@ -374,9 +374,9 @@ vshAdmDeinit(vshControl *ctl)
vshAdmControlPtr priv = ctl->privData;
vshDeinit(ctl);
- VIR_FREE(ctl->connname);
+ VIR_FREE(priv->name);
- if (priv->conn)
+ if (priv->dmn)
vshAdmDisconnect(ctl);
virResetLastError();
@@ -473,6 +473,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv)
int arg, debug;
size_t i;
int longindex = -1;
+ vshAdmControlPtr priv = ctl->privData;
struct option opt[] = {
{"connect", required_argument, NULL, 'c'},
{"debug", required_argument, NULL, 'd'},
@@ -489,8 +490,8 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv)
while ((arg = getopt_long(argc, argv, "+:c:d:hl:qvV", opt, &longindex)) != -1) {
switch (arg) {
case 'c':
- VIR_FREE(ctl->connname);
- ctl->connname = vshStrdup(ctl, optarg);
+ VIR_FREE(priv->name);
+ priv->name = vshStrdup(ctl, optarg);
break;
case 'd':
if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) {
@@ -598,7 +599,7 @@ static const vshCmdGrp cmdGroups[] = {
};
static const vshClientHooks hooks = {
- .connHandler = vshAdmConnectionHandler
+ .connHandler = vshAdmDaemonionHandler
};
int
@@ -656,7 +657,7 @@ main(int argc, char **argv)
virFileActivateDirOverride(argv[0]);
if ((defaultConn = virGetEnvBlockSUID("LIBVIRT_DEFAULT_ADMIN_URI")))
- ctl->connname = vshStrdup(ctl, defaultConn);
+ virtAdminCtl.name = vshStrdup(ctl, defaultConn);
if (!vshInit(ctl, cmdGroups, NULL))
exit(EXIT_FAILURE);
diff --git a/tools/virt-admin.h b/tools/virt-admin.h
index 62228ccab189..d1b1bb4f1a9e 100644
--- a/tools/virt-admin.h
+++ b/tools/virt-admin.h
@@ -39,7 +39,8 @@ typedef vshAdmControl *vshAdmControlPtr;
* adminControl
*/
struct _vshAdmControl {
- virAdmConnectPtr conn; /* connection to a daemon's admin server */
+ virAdmDaemonPtr dmn; /* remote daemon */
+ char *name;
bool wantReconnect;
};
diff --git a/tools/vsh.h b/tools/vsh.h
index d4e9710524ad..fac62f4d4d9a 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -197,7 +197,6 @@ struct _vshControl {
const char *name; /* hardcoded name of the binary that cannot
* be changed without recompilation compared
* to program name */
- char *connname; /* connection name */
char *progname; /* program name */
vshCmd *cmd; /* the current command */
char *cmdstr; /* string with command */
--
2.6.3
8 years, 11 months
[libvirt] [PATCH] spec: Temporarily disable new admin-related files
by Martin Kletzander
The virt-admin binary and its man page should not yet be distributed,
but we need libvirt-common.h. RPM build fails without specifying these.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
libvirt.spec.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 8420d1107ca8..9db550c2a0db 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1565,8 +1565,10 @@ mv $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.so \
$RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/libvirt.so
%endif
-# Temporarily get rid of not-installed libvirt-admin.so
+# Temporarily get rid of not-installed admin-related files
rm -f $RPM_BUILD_ROOT%{_libdir}/libvirt-admin.so
+rm -f $RPM_BUILD_ROOT%{_bindir}/virt-admin
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/virsh.1*
%if %{with_network}
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/lib/libvirt/dnsmasq/
@@ -2320,6 +2322,7 @@ exit 0
%dir %{_includedir}/libvirt
%{_includedir}/libvirt/virterror.h
%{_includedir}/libvirt/libvirt.h
+%{_includedir}/libvirt/libvirt-common.h
%{_includedir}/libvirt/libvirt-domain.h
%{_includedir}/libvirt/libvirt-domain-snapshot.h
%{_includedir}/libvirt/libvirt-event.h
--
2.6.3
8 years, 11 months
[libvirt] [PATCH] admin: Include admin_remote.c in the dist package
by Martin Kletzander
Otherwise all builds from the package will fail.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed under the build-breaker rule, checked by doing distcheck in
VPATH, also visible on ci.centos.org
src/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index 93b9c66662a1..be3b3c84e863 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2117,6 +2117,10 @@ libvirt_admin.syms: libvirt_admin_public.syms $(ADMIN_SYM_FILES) \
chmod a-w $@-tmp && \
mv $@-tmp libvirt_admin.syms
+# admin/admin_remote.c is being included in libvirt-admin.c, so we
+# need to include it in the dist
+EXTRA_DIST += admin/admin_remote.c
+
lib_LTLIBRARIES += libvirt-admin.la
libvirt_admin_la_SOURCES = \
libvirt-admin.c \
--
2.6.3
8 years, 11 months
[libvirt] [PATCH] tools: fix output of list with state-shutoff
by Wei Jiangang
Due to the default of flags is VIR_CONNECT_LIST_DOMAINS_ACTIVE,
It doesn't show the domains that have been shutdown when we use
'virsh list' with only --state-shutoff.
Signed-off-by: Wei Jiangang <weijg.fnst(a)cn.fujitsu.com>
---
tools/virsh-domain-monitor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index d4e500b..7b30c4c 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1873,7 +1873,8 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
unsigned int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
/* construct filter flags */
- if (vshCommandOptBool(cmd, "inactive"))
+ if (vshCommandOptBool(cmd, "inactive") ||
+ vshCommandOptBool(cmd, "state-shutoff"))
flags = VIR_CONNECT_LIST_DOMAINS_INACTIVE;
if (vshCommandOptBool(cmd, "all"))
--
1.9.3
8 years, 11 months
[libvirt] [PATCH 0/8] Add perf and Intel CMT feature support
by Qiaowei Ren
The series mainly adds Intel CMT feature support into libvirt. CMT is
new introduced PQos (Platform Qos) feature to monitor the usage of
cache by applications running on the platform.
Currently CMT patches has been merged into Linux kernel mainline.
The CMT implementation in Linux kernel is based on perf mechanism and
there is no support for perf in libvirt, and so this series firstly
add perf support into libvirt, including two public API and a set of
util interfaces. And based on these APIs and interfaces, thie series
implements CMT perf event support.
TODO:
1. This series relys on keeping an open file descriptor for the guest.
We should add one patch to call sys_perf_event_open again iff libvirtd
is restarted.
Qiaowei Ren (8):
perf: add new public APIs for perf event
perf: define internal driver API for perf event
perf: implement the public APIs for perf event
perf: implement the remote protocol for perf event
perf: implement a set of util functions for perf event
qemu_driver: add support to perf event
virsh: extend domstats command
virsh: implement new command to support perf
daemon/remote.c | 60 +++++++++++
include/libvirt/libvirt-domain.h | 19 ++++
include/libvirt/virterror.h | 2 +
src/Makefile.am | 1 +
src/driver-hypervisor.h | 12 +++
src/libvirt-domain.c | 106 +++++++++++++++++++
src/libvirt_private.syms | 8 ++
src/libvirt_public.syms | 6 ++
src/qemu/qemu_domain.h | 3 +
src/qemu/qemu_driver.c | 181 +++++++++++++++++++++++++++++++
src/qemu/qemu_process.c | 6 ++
src/remote/remote_driver.c | 49 +++++++++
src/remote/remote_protocol.x | 32 +++++-
src/remote_protocol-structs | 20 ++++
src/util/virerror.c | 2 +
src/util/virperf.c | 222 +++++++++++++++++++++++++++++++++++++++
src/util/virperf.h | 60 +++++++++++
tools/virsh-domain-monitor.c | 7 ++
tools/virsh-domain.c | 139 ++++++++++++++++++++++++
tools/virsh.pod | 15 ++-
20 files changed, 947 insertions(+), 3 deletions(-)
create mode 100644 src/util/virperf.c
create mode 100644 src/util/virperf.h
--
1.9.1
8 years, 11 months