Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- daemon/remote.c | 30 ++++++++++++++++++++++++++++++ src/remote/remote_driver.c | 32 ++++++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 14 +++++++++++++- src/remote_protocol-structs | 5 +++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/daemon/remote.c b/daemon/remote.c index 9db93ff..44d92b8 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -6257,3 +6257,33 @@ remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors, } return -1; } + + +static int +remoteDispatchConnectCrash(virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_connect_crash_args *args) +{ + int rv = -1; + struct daemonClientPrivate *priv = + virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if (virConnectCrash(priv->conn, + VIR_CONNECT_CRASH_SERVER, + args->mode, args->flags) < 0) + goto cleanup; + + rv = 0; + + cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index b03c9ca..0210b0c 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -7450,6 +7450,37 @@ remoteDomainRename(virDomainPtr dom, const char *new_name, unsigned int flags) } +static int +remoteConnectCrash(virConnectPtr conn, + int side, + int mode, + unsigned int flags) +{ + int rv = -1; + struct private_data *priv = conn->privateData; + remote_connect_crash_args args; + + if (side == VIR_CONNECT_CRASH_CLIENT) + return virCrash(mode); + + remoteDriverLock(priv); + + args.mode = mode; + args.flags = flags; + + if (call(conn, priv, 0, REMOTE_PROC_CONNECT_CRASH, + (xdrproc_t)xdr_remote_connect_crash_args, (char *)&args, + (xdrproc_t)xdr_void, (char *)NULL) == -1) { + goto done; + } + + rv = 0; + + done: + remoteDriverUnlock(priv); + return rv; +} + /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. * These can return NULL if underlying memory allocations fail, @@ -7805,6 +7836,7 @@ static virHypervisorDriver hypervisor_driver = { .connectRegisterCloseCallback = remoteConnectRegisterCloseCallback, /* 1.3.2 */ .connectUnregisterCloseCallback = remoteConnectUnregisterCloseCallback, /* 1.3.2 */ .domainMigrateStartPostCopy = remoteDomainMigrateStartPostCopy, /* 1.3.3 */ + .connectCrash = remoteConnectCrash, /* 1.3.3 */ }; static virNetworkDriver network_driver = { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 8bda792..40ae43f 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3261,6 +3261,11 @@ struct remote_domain_migrate_start_post_copy_args { unsigned int flags; }; +struct remote_connect_crash_args { + int mode; + unsigned int flags; +}; + /*----- Protocol. -----*/ /* Define the program number, protocol version and procedure numbers here. */ @@ -5781,5 +5786,12 @@ enum remote_procedure { * @generate: both * @acl: domain:write */ - REMOTE_PROC_DOMAIN_SET_PERF_EVENTS = 366 + REMOTE_PROC_DOMAIN_SET_PERF_EVENTS = 366, + + /** + * @generate: none + * @priority: high + * @acl: connect:write + */ + REMOTE_PROC_CONNECT_CRASH = 367 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 6dddd52..f564365 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2730,6 +2730,10 @@ struct remote_domain_migrate_start_post_copy_args { remote_nonnull_domain dom; u_int flags; }; +struct remote_connect_crash_args { + int mode; + u_int flags; +}; enum remote_procedure { REMOTE_PROC_CONNECT_OPEN = 1, REMOTE_PROC_CONNECT_CLOSE = 2, @@ -3097,4 +3101,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY = 364, REMOTE_PROC_DOMAIN_GET_PERF_EVENTS = 365, REMOTE_PROC_DOMAIN_SET_PERF_EVENTS = 366, + REMOTE_PROC_CONNECT_CRASH = 367, }; -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list