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

[xen master] tools/xenstore: add command line handling for live update



commit 42f684d2ea6bfab74369c9e5974e1b0f3fa46c1a
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Jan 13 14:00:18 2021 +0100
Commit:     Juergen Gross <jgross@xxxxxxxx>
CommitDate: Thu Jan 21 17:30:57 2021 +0100

    tools/xenstore: add command line handling for live update
    
    Updating an instance of Xenstore via live update needs to hand over
    the command line parameters to the updated instance. Those can be
    either the parameters used by the updated instance or new ones when
    supplied when starting the live update.
    
    So when supplied store the new command line parameters in lu_status.
    
    As it is related add a new option -U (or --live-update") to the command
    line of xenstored which will be added when starting the new instance.
    This enables to perform slightly different initializations when
    started as a result of live update.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
    Reviewed-by: Paul Durrant <paul@xxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/xenstore/xenstored_control.c | 6 ++++++
 tools/xenstore/xenstored_core.c    | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_control.c 
b/tools/xenstore/xenstored_control.c
index 95ac1a1648..2e0827b9ef 100644
--- a/tools/xenstore/xenstored_control.c
+++ b/tools/xenstore/xenstored_control.c
@@ -42,6 +42,8 @@ struct live_update {
 #else
        char *filename;
 #endif
+
+       char *cmdline;
 };
 
 static struct live_update *lu_status;
@@ -211,6 +213,10 @@ static const char *lu_cmdline(const void *ctx, struct 
connection *conn,
        if (!lu_status || lu_status->conn != conn)
                return "Not in live-update session.";
 
+       lu_status->cmdline = talloc_strdup(lu_status, cmdline);
+       if (!lu_status->cmdline)
+               return "Allocation failure.";
+
        return NULL;
 }
 
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index e1b92c3dc8..0dddf24327 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1969,6 +1969,7 @@ static struct option options[] = {
        { "internal-db", 0, NULL, 'I' },
        { "verbose", 0, NULL, 'V' },
        { "watch-nb", 1, NULL, 'W' },
+       { "live-update", 0, NULL, 'U' },
        { NULL, 0, NULL, 0 } };
 
 extern void dump_conn(struct connection *conn); 
@@ -1983,11 +1984,12 @@ int main(int argc, char *argv[])
        bool dofork = true;
        bool outputpid = false;
        bool no_domain_init = false;
+       bool live_update = false;
        const char *pidfile = NULL;
        int timeout;
 
 
-       while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:A:M:T:RVW:", options,
+       while ((opt = getopt_long(argc, argv, "DE:F:HNPS:t:A:M:T:RVW:U", 
options,
                                  NULL)) != -1) {
                switch (opt) {
                case 'D':
@@ -2045,6 +2047,9 @@ int main(int argc, char *argv[])
                case 'p':
                        priv_domid = strtol(optarg, NULL, 10);
                        break;
+               case 'U':
+                       live_update = true;
+                       break;
                }
        }
        if (optind != argc)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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