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

[xen staging] tools/xenstore: perform kexec for stubdom live update



commit 38286e84a85be9669b22e59332591531b7b105c5
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Thu Jul 17 12:48:35 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 17 12:48:35 2025 +0200

    tools/xenstore: perform kexec for stubdom live update
    
    For the final step of live-update in stubdom, call kexec().
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 tools/xenstored/lu_minios.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/tools/xenstored/lu_minios.c b/tools/xenstored/lu_minios.c
index b14a0b29d5..b8ca631610 100644
--- a/tools/xenstored/lu_minios.c
+++ b/tools/xenstored/lu_minios.c
@@ -8,13 +8,44 @@
 #include <stdlib.h>
 #include <syslog.h>
 
+#include <mini-os/kexec.h>
+
 #include "talloc.h"
 #include "lu.h"
+#include "core.h"
 
 #ifndef NO_LIVE_UPDATE
 char *lu_exec(const void *ctx, int argc, char **argv)
 {
-       return "NYI";
+       int i;
+       int ret;
+       char *errbuf;
+       char *cmdline;
+
+       if (!lu_status->kernel)
+               return "No new kernel";
+
+       cmdline = talloc_strdup(ctx, "");
+       if (!cmdline)
+               return "Allocation failure";
+       for (i = 1; argv[i]; i++) {
+               if (i > 1) {
+                       cmdline = talloc_append_string(ctx, cmdline, " ");
+                       if (!cmdline)
+                               return "Allocation failure";
+               }
+               cmdline = talloc_append_string(ctx, cmdline, argv[i]);
+               if (!cmdline)
+                       return "Allocation failure";
+       }
+
+       ret = kexec(lu_status->kernel, lu_status->kernel_size, cmdline);
+
+       errbuf = talloc_asprintf(ctx, "kexec() returned %d", ret);
+       if (!errbuf)
+               errbuf = "kexec() returned";
+
+       return errbuf;
 }
 
 static const char *lu_binary_alloc(const void *ctx, struct connection *conn,
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.