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

[PATCH 2/9] 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>
---
 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,
-- 
2.43.0




 


Rackspace

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