mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@suse.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Paul Durrant <paul@xen.org> Acked-by: Wei Liu <wl@xen.org>
This commit is contained in:
1 parent
e867af081d
commit
42f684d2ea
2 files changed
+12
-1
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||