[libvirt] [PATCH 4/7] remote: implement the remote protocol for virNodeMKTMEInfo()

Larkins Carvalho larkins.l.carvalho at intel.com
Fri May 17 23:55:49 UTC 2019


Add remote support for virNodeMKTMEInfo().
---
 src/remote/remote_daemon_dispatch.c | 44 +++++++++++++++++++++++++++++
 src/remote/remote_driver.c          | 41 ++++++++++++++++++++++++++-
 src/remote/remote_protocol.x        | 21 +++++++++++++-
 src/remote_protocol-structs         | 12 ++++++++
 4 files changed, 116 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index df28259042..78591791cc 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -5230,6 +5230,50 @@ remoteDispatchNodeGetSevInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
 }
 
 
+static int
+remoteDispatchNodeGetMktmeInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
+                               virNetServerClientPtr client ATTRIBUTE_UNUSED,
+                               virNetMessagePtr msg ATTRIBUTE_UNUSED,
+                               virNetMessageErrorPtr rerr,
+                               remote_node_get_mktme_info_args *args,
+                               remote_node_get_mktme_info_ret *ret)
+{
+    virTypedParameterPtr params = NULL;
+    int nparams = 0;
+    int rv = -1;
+    struct daemonClientPrivate *priv =
+        virNetServerClientGetPrivateData(client);
+
+    if (!priv->conn) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+        goto cleanup;
+    }
+
+    if (virNodeGetMKTMEInfo(priv->conn, &params, &nparams, args->flags) < 0)
+        goto cleanup;
+
+    if (nparams > REMOTE_NODE_MKTME_INFO_MAX) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
+        goto cleanup;
+    }
+
+
+    if (virTypedParamsSerialize(params, nparams,
+        (virTypedParameterRemotePtr *)&ret->params.params_val,
+        &ret->params.params_len,
+        args->flags) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+ cleanup:
+    if (rv < 0)
+        virNetMessageSaveError(rerr);
+    virTypedParamsFree(params, nparams);
+    return rv;
+}
+
+
 static int
 remoteDispatchNodeGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
                                       virNetServerClientPtr client ATTRIBUTE_UNUSED,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 5c4dd41227..af2f7a8223 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6825,6 +6825,44 @@ remoteNodeGetSEVInfo(virConnectPtr conn,
 }
 
 
+static int
+remoteNodeGetMKTMEInfo(virConnectPtr conn,
+                       virTypedParameterPtr *params,
+                       int *nparams,
+                       unsigned int flags)
+{
+    int rv = -1;
+    remote_node_get_mktme_info_args args;
+    remote_node_get_mktme_info_ret ret;
+    struct private_data *priv = conn->privateData;
+
+    remoteDriverLock(priv);
+
+    args.flags = flags;
+
+    memset(&ret, 0, sizeof(ret));
+    if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_MKTME_INFO,
+        (xdrproc_t)xdr_remote_node_get_mktme_info_args, (char *)&args,
+        (xdrproc_t)xdr_remote_node_get_mktme_info_ret, (char *)&ret) == -1)
+        goto done;
+
+    if (virTypedParamsDeserialize((virTypedParameterRemotePtr)ret.params.params_val,
+        ret.params.params_len,
+        REMOTE_NODE_MKTME_INFO_MAX,
+        params,
+        nparams) < 0)
+        goto cleanup;
+
+    rv = 0;
+
+ cleanup:
+    xdr_free((xdrproc_t)xdr_remote_node_get_mktme_info_ret, (char *)&ret);
+ done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
+
 static int
 remoteNodeGetCPUMap(virConnectPtr conn,
                     unsigned char **cpumap,
@@ -8516,7 +8554,8 @@ static virHypervisorDriver hypervisor_driver = {
     .connectCompareHypervisorCPU = remoteConnectCompareHypervisorCPU, /* 4.4.0 */
     .connectBaselineHypervisorCPU = remoteConnectBaselineHypervisorCPU, /* 4.4.0 */
     .nodeGetSEVInfo = remoteNodeGetSEVInfo, /* 4.5.0 */
-    .domainGetLaunchSecurityInfo = remoteDomainGetLaunchSecurityInfo /* 4.5.0 */
+    .domainGetLaunchSecurityInfo = remoteDomainGetLaunchSecurityInfo, /* 4.5.0 */
+    .nodeGetMKTMEInfo = remoteNodeGetMKTMEInfo /* 5.3.0 */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 11f44ee267..391e3be66f 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -263,6 +263,9 @@ const REMOTE_NODE_SEV_INFO_MAX = 64;
 /* Upper limit on number of launch security information entries */
 const REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX = 64;
 
+/* Upper limit on number of MKTME parameters */
+const REMOTE_NODE_MKTME_INFO_MAX = 64;
+
 /* UUID.  VIR_UUID_BUFLEN definition comes from libvirt.h */
 typedef opaque remote_uuid[VIR_UUID_BUFLEN];
 
@@ -3514,6 +3517,16 @@ struct remote_node_get_sev_info_ret {
     int nparams;
 };
 
+struct remote_node_get_mktme_info_args {
+    int nparams;
+    unsigned int flags;
+};
+
+struct remote_node_get_mktme_info_ret {
+    remote_typed_param params<REMOTE_NODE_MKTME_INFO_MAX>;
+    int nparams;
+};
+
 struct remote_domain_get_launch_security_info_args {
     remote_nonnull_domain dom;
     unsigned int flags;
@@ -6342,5 +6355,11 @@ enum remote_procedure {
      * @generate: both
      * @acl: connect:read
      */
-    REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES = 403
+    REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES = 403,
+
+    /**
+     * @generate: none
+     * @acl: connect:read
+     */
+    REMOTE_PROC_NODE_GET_MKTME_INFO = 404
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 768189c573..7a3489c004 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2931,6 +2931,17 @@ struct remote_node_get_sev_info_ret {
         } params;
         int                        nparams;
 };
+struct remote_node_get_mktme_info_args {
+        int                        nparams;
+        u_int                      flags;
+};
+struct remote_node_get_mktme_info_ret {
+        struct {
+                u_int              params_len;
+                remote_typed_param * params_val;
+        } params;
+        int                        nparams;
+};
 struct remote_domain_get_launch_security_info_args {
         remote_nonnull_domain      dom;
         u_int                      flags;
@@ -3385,4 +3396,5 @@ enum remote_procedure {
         REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS = 401,
         REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS = 402,
         REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES = 403,
+        REMOTE_PROC_NODE_GET_MKTME_INFO = 404,
 };
-- 
2.21.0.windows.1




More information about the libvir-list mailing list