Implement the RPC dispatcher and caller for the new API.
---
src/libvirt_private.syms | 1 +
src/logging/log_daemon_dispatch.c | 26 ++++++++++++++++++++++++++
src/logging/log_manager.c | 34 ++++++++++++++++++++++++++++++++++
src/logging/log_manager.h | 8 ++++++++
src/logging/log_protocol.x | 20 +++++++++++++++++++-
5 files changed, 88 insertions(+), 1 deletion(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 3fd042b..f197f55 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1048,6 +1048,7 @@ virLockManagerRelease;
# logging/log_manager.h
+virLogManagerDomainAppendMessage;
virLogManagerDomainGetLogFilePosition;
virLogManagerDomainOpenLogFile;
virLogManagerDomainReadLogFile;
diff --git a/src/logging/log_daemon_dispatch.c b/src/logging/log_daemon_dispatch.c
index b00cee2..ec69112 100644
--- a/src/logging/log_daemon_dispatch.c
+++ b/src/logging/log_daemon_dispatch.c
@@ -143,3 +143,29 @@ virLogManagerProtocolDispatchDomainReadLogFile(virNetServerPtr server
ATTRIBUTE_
virNetMessageSaveError(rerr);
return rv;
}
+
+
+static int
+virLogManagerProtocolDispatchDomainAppendLogFile(virNetServerPtr server
ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client
ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+
virLogManagerProtocolDomainAppendLogFileArgs *args,
+
virLogManagerProtocolDomainAppendLogFileRet *ret)
+{
+ int rv;
+
+ if ((rv = virLogHandlerDomainAppendLogFile(virLogDaemonGetHandler(logDaemon),
+ args->driver,
+ (unsigned char *)args->dom.uuid,
+ args->dom.name,
+ args->path,
+ args->message,
+ args->flags)) < 0) {
+ virNetMessageSaveError(rerr);
+ return -1;
+ }
+
+ ret->ret = rv;
+ return 0;
+}
diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c
index 7c37ba1..e84abdb 100644
--- a/src/logging/log_manager.c
+++ b/src/logging/log_manager.c
@@ -282,3 +282,37 @@ virLogManagerDomainReadLogFile(virLogManagerPtr mgr,
cleanup:
return rv;
}
+
+
+int
+virLogManagerDomainAppendMessage(virLogManagerPtr mgr,
+ const char *driver,
+ const unsigned char *domuuid,
+ const char *domname,
+ const char *path,
+ const char *message,
+ unsigned int flags)
+{
+ struct virLogManagerProtocolDomainAppendLogFileArgs args;
+ struct virLogManagerProtocolDomainAppendLogFileRet ret;
+
+ memset(&args, 0, sizeof(args));
+
+ args.driver = (char *)driver;
+ memcpy(args.dom.uuid, domuuid, VIR_UUID_BUFLEN);
+ args.dom.name = (char *)domname;
+ args.path = (char *)path;
+ args.message = (char *)message;
+ args.flags = flags;
+
+ if (virNetClientProgramCall(mgr->program,
+ mgr->client,
+ mgr->serial++,
+ VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_APPEND_LOG_FILE,
+ 0, NULL, NULL, NULL,
+
(xdrproc_t)xdr_virLogManagerProtocolDomainAppendLogFileArgs, &args,
+
(xdrproc_t)xdr_virLogManagerProtocolDomainAppendLogFileRet, &ret) < 0)
+ return -1;
+
+ return ret.ret;
+}
diff --git a/src/logging/log_manager.h b/src/logging/log_manager.h
index 7deaba7..7f8e518 100644
--- a/src/logging/log_manager.h
+++ b/src/logging/log_manager.h
@@ -57,4 +57,12 @@ char *virLogManagerDomainReadLogFile(virLogManagerPtr mgr,
size_t maxlen,
unsigned int flags);
+int virLogManagerDomainAppendMessage(virLogManagerPtr mgr,
+ const char *driver,
+ const unsigned char *domuuid,
+ const char *domname,
+ const char *path,
+ const char *message,
+ unsigned int flags);
+
#endif /* __VIR_LOG_MANAGER_H__ */
diff --git a/src/logging/log_protocol.x b/src/logging/log_protocol.x
index 0363c75..2434043 100644
--- a/src/logging/log_protocol.x
+++ b/src/logging/log_protocol.x
@@ -68,6 +68,18 @@ struct virLogManagerProtocolDomainReadLogFileRet {
virLogManagerProtocolNonNullString data;
};
+struct virLogManagerProtocolDomainAppendLogFileArgs {
+ virLogManagerProtocolNonNullString driver;
+ virLogManagerProtocolDomain dom;
+ virLogManagerProtocolNonNullString path;
+ virLogManagerProtocolNonNullString message;
+ unsigned int flags;
+};
+
+struct virLogManagerProtocolDomainAppendLogFileRet {
+ int ret;
+};
+
/* Define the program number, protocol version and procedure numbers here. */
const VIR_LOG_MANAGER_PROTOCOL_PROGRAM = 0x87539319;
const VIR_LOG_MANAGER_PROTOCOL_PROGRAM_VERSION = 1;
@@ -115,5 +127,11 @@ enum virLogManagerProtocolProcedure {
* @generate: none
* @acl: none
*/
- VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_READ_LOG_FILE = 3
+ VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_READ_LOG_FILE = 3,
+
+ /**
+ * @generate: none
+ * @acl: none
+ */
+ VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_APPEND_LOG_FILE = 4
};
--
2.8.3