[libvirt PATCH 7/9] remote: Add support for the virConnectGetHypervisorCPUModelDefinition API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/remote/remote_daemon_dispatch.c | 32 ++++++++++++++++++++++
 src/remote/remote_driver.c          | 41 +++++++++++++++++++++++++++++
 src/remote/remote_protocol.x        | 20 +++++++++++++-
 src/remote_protocol-structs         | 11 ++++++++
 4 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 9011977e18..bc30cb819c 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -5913,6 +5913,38 @@ remoteDispatchConnectGetHypervisorCPUModelNames(virNetServer *server G_GNUC_UNUS
 }
 
 
+static int
+remoteDispatchConnectGetHypervisorCPUModelDefinition(virNetServer *server G_GNUC_UNUSED,
+                                                     virNetServerClient *client,
+                                                     virNetMessage *msg G_GNUC_UNUSED,
+                                                     struct virNetMessageError *rerr,
+                                                     remote_connect_get_hypervisor_cpu_model_definition_args *args,
+                                                     remote_connect_get_hypervisor_cpu_model_definition_ret *ret)
+{
+    int rv = -1;
+    virConnectPtr conn = remoteGetHypervisorConn(client);
+    g_autofree char *xml = NULL;
+
+    if (!conn)
+        goto cleanup;
+
+    rv = virConnectGetHypervisorCPUModelDefinition(conn, args->arch,
+                                                   args->machine, args->name,
+                                                   &xml, args->flags);
+    if (rv < 0)
+        goto cleanup;
+
+    ret->xml = g_steal_pointer(&xml);
+    rv = 0;
+
+ cleanup:
+    ret->ret = rv;
+    if (rv < 0)
+        virNetMessageSaveError(rerr);
+    return rv;
+}
+
+
 static int
 remoteDispatchDomainCreateXMLWithFiles(virNetServer *server G_GNUC_UNUSED,
                                        virNetServerClient *client,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 8dca23a7eb..7aec988746 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -6451,6 +6451,46 @@ remoteConnectGetHypervisorCPUModelNames(virConnectPtr conn,
 }
 
 
+static int
+remoteConnectGetHypervisorCPUModelDefinition(virConnectPtr conn,
+                                             const char *arch,
+                                             const char *machine,
+                                             const char *name,
+                                             char **xmlCPU,
+                                             unsigned int flags)
+{
+    int rv = -1;
+    remote_connect_get_hypervisor_cpu_model_definition_args args;
+    remote_connect_get_hypervisor_cpu_model_definition_ret ret;
+
+    struct private_data *priv = conn->privateData;
+
+    remoteDriverLock(priv);
+
+    args.arch = (char *) arch;
+    args.machine = (char *) machine;
+    args.name = (char *) name;
+    args.flags = flags;
+
+    memset(&ret, 0, sizeof(ret));
+    if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_DEFINITION,
+             (xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_definition_args,
+             (char *) &args,
+             (xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_definition_ret,
+             (char *) &ret) < 0)
+        goto done;
+
+    *xmlCPU = g_steal_pointer(&ret.xml);
+    rv = ret.ret;
+
+    xdr_free((xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_definition_ret,
+             (char *) &ret);
+
+ done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
 static int
 remoteDomainOpenGraphics(virDomainPtr dom,
                          unsigned int idx,
@@ -8711,6 +8751,7 @@ static virHypervisorDriver hypervisor_driver = {
     .domainStartDirtyRateCalc = remoteDomainStartDirtyRateCalc, /* 7.2.0 */
     .domainSetLaunchSecurityState = remoteDomainSetLaunchSecurityState, /* 8.0.0 */
     .connectGetHypervisorCPUModelNames = remoteConnectGetHypervisorCPUModelNames, /* 8.5.0 */
+    .connectGetHypervisorCPUModelDefinition = remoteConnectGetHypervisorCPUModelDefinition, /* 8.5.0 */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index a5c60399c7..2d7d6277c6 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3314,6 +3314,18 @@ struct remote_connect_get_hypervisor_cpu_model_names_ret {
     int ret;
 };
 
+struct remote_connect_get_hypervisor_cpu_model_definition_args {
+    remote_nonnull_string arch;
+    remote_nonnull_string machine;
+    remote_nonnull_string name;
+    unsigned int flags;
+};
+
+struct remote_connect_get_hypervisor_cpu_model_definition_ret {
+    remote_nonnull_string xml;
+    int ret;
+};
+
 struct remote_connect_network_event_register_any_args {
     int eventID;
     remote_network net;
@@ -6976,5 +6988,11 @@ enum remote_procedure {
      * @generate: none
      * @acl: connect:read
      */
-    REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES = 443
+    REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES = 443,
+
+    /**
+     * @generate: none
+     * @acl: connect:read
+     */
+    REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_DEFINITION = 444
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index c6afb92aad..0fdc1e8800 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -2686,6 +2686,16 @@ struct remote_connect_get_hypervisor_cpu_model_names_ret {
         } aliases;
         int                        ret;
 };
+struct remote_connect_get_hypervisor_cpu_model_definition_args {
+        remote_nonnull_string      arch;
+        remote_nonnull_string      machine;
+        remote_nonnull_string      name;
+        u_int                      flags;
+};
+struct remote_connect_get_hypervisor_cpu_model_definition_ret {
+        remote_nonnull_string      xml;
+        int                        ret;
+};
 struct remote_connect_network_event_register_any_args {
         int                        eventID;
         remote_network             net;
@@ -3727,4 +3737,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_RESTORE_PARAMS = 441,
         REMOTE_PROC_DOMAIN_ABORT_JOB_FLAGS = 442,
         REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES = 443,
+        REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_DEFINITION = 444,
 };
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux