[RFC PATCH 2/3] remote: Implement domain inject launch secret API

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

 



Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---
 src/remote/remote_daemon_dispatch.c | 27 ++++++++++++++++++++++++
 src/remote/remote_driver.c          | 32 +++++++++++++++++++++++++++++
 src/remote/remote_protocol.x        | 16 ++++++++++++++-
 src/remote_protocol-structs         |  8 ++++++++
 4 files changed, 82 insertions(+), 1 deletion(-)

diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 689001889e..f2f7b35f53 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -3451,6 +3451,33 @@ remoteDispatchDomainGetLaunchSecurityInfo(virNetServer *server G_GNUC_UNUSED,
     return rv;
 }
 
+static int
+remoteDispatchDomainInjectLaunchSecret(virNetServer *server G_GNUC_UNUSED,
+                                       virNetServerClient *client,
+                                       virNetMessage *msg G_GNUC_UNUSED,
+                                       struct virNetMessageError *rerr,
+                                       remote_domain_inject_launch_secret_args *args)
+{
+    int rv = -1;
+    virConnectPtr conn = remoteGetHypervisorConn(client);
+    virDomainPtr dom = NULL;
+
+    if (!conn)
+        goto cleanup;
+
+    if (!(dom = get_nonnull_domain(conn, args->dom)))
+        goto cleanup;
+
+    rv = virDomainInjectLaunchSecret(dom, args->secrethdr, args->secret,
+                                     args->injectaddr, args->flags);
+
+ cleanup:
+    if (rv < 0)
+        virNetMessageSaveError(rerr);
+    virObjectUnref(dom);
+    return rv;
+}
+
 static int
 remoteDispatchDomainGetPerfEvents(virNetServer *server G_GNUC_UNUSED,
                                   virNetServerClient *client,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 235c406a5a..4fbb3c5bad 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1893,6 +1893,37 @@ remoteDomainGetLaunchSecurityInfo(virDomainPtr domain,
     return rv;
 }
 
+static int
+remoteDomainInjectLaunchSecret(virDomainPtr domain,
+                               const char *secrethdr,
+                               const char *secret,
+                               unsigned long long injectaddr,
+                               unsigned int flags)
+{
+    int rv = -1;
+    struct private_data *priv = domain->conn->privateData;
+    remote_domain_inject_launch_secret_args args;
+
+    remoteDriverLock(priv);
+
+    make_nonnull_domain(&args.dom, domain);
+    args.secrethdr = (char *) secrethdr;
+    args.secret = (char *) secret;
+    args.injectaddr = injectaddr;
+    args.flags = flags;
+
+    if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_INJECT_LAUNCH_SECRET,
+             (xdrproc_t) xdr_remote_domain_inject_launch_secret_args, (char *) &args,
+             (xdrproc_t) xdr_void, (char *) NULL) == -1)
+        goto done;
+
+    rv = 0;
+
+ done:
+    remoteDriverUnlock(priv);
+    return rv;
+}
+
 static int
 remoteDomainGetPerfEvents(virDomainPtr domain,
                           virTypedParameterPtr *params,
@@ -8574,6 +8605,7 @@ static virHypervisorDriver hypervisor_driver = {
     .domainAuthorizedSSHKeysSet = remoteDomainAuthorizedSSHKeysSet, /* 6.10.0 */
     .domainGetMessages = remoteDomainGetMessages, /* 7.1.0 */
     .domainStartDirtyRateCalc = remoteDomainStartDirtyRateCalc, /* 7.2.0 */
+    .domainInjectLaunchSecret = remoteDomainInjectLaunchSecret, /* 7.10.0 */
 };
 
 static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 60010778ca..fb0da81e9a 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -3900,6 +3900,14 @@ struct remote_domain_event_memory_device_size_change_msg {
     unsigned hyper size;
 };
 
+struct remote_domain_inject_launch_secret_args {
+    remote_nonnull_domain dom;
+    remote_nonnull_string secrethdr;
+    remote_nonnull_string secret;
+    unsigned hyper injectaddr;
+    unsigned int flags;
+};
+
 /*----- Protocol. -----*/
 
 /* Define the program number, protocol version and procedure numbers here. */
@@ -6905,5 +6913,11 @@ enum remote_procedure {
      * @generate: both
      * @acl: none
      */
-    REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE = 438
+    REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE = 438,
+
+    /**
+     * @generate: none
+     * @acl: domain:write
+     */
+    REMOTE_PROC_DOMAIN_INJECT_LAUNCH_SECRET = 439
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index dbef4ace79..c9e26b0ce1 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -3241,6 +3241,13 @@ struct remote_domain_event_memory_device_size_change_msg {
         remote_nonnull_string      alias;
         uint64_t                   size;
 };
+struct remote_domain_inject_launch_secret_args {
+        remote_nonnull_domain      dom;
+        remote_nonnull_string      secrethdr;
+        remote_nonnull_string      secret;
+        uint64_t                   injectaddr;
+        u_int                      flags;
+};
 enum remote_procedure {
         REMOTE_PROC_CONNECT_OPEN = 1,
         REMOTE_PROC_CONNECT_CLOSE = 2,
@@ -3680,4 +3687,5 @@ enum remote_procedure {
         REMOTE_PROC_NODE_DEVICE_IS_ACTIVE = 436,
         REMOTE_PROC_NETWORK_CREATE_XML_FLAGS = 437,
         REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE = 438,
+        REMOTE_PROC_DOMAIN_INJECT_LAUNCH_SECRET = 439,
 };
-- 
2.33.0





[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