Ian Campbell
2011-Apr-18 16:24 UTC
[Xen-devel] [PATCH] tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1303143831 -3600 # Node ID 31b98feb0eb6a50fe9e664a31feaa32ad3dac7cc # Parent 05abea47f4dc670974cd513a0e74db54d22eacc9 tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground Perhaps this should be a separate option but I find that when I''m debugging xl in the foreground this is the behaviour I would like. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 05abea47f4dc -r 31b98feb0eb6 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon Apr 18 17:21:44 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Mon Apr 18 17:23:51 2011 +0100 @@ -1354,7 +1354,7 @@ static int create_domain(struct domain_c int migrate_fd = dom_info->migrate_fd; int fd, i; - int need_daemon = 1; + int need_daemon = daemonize; int ret, rc; libxl_waiter *w1 = NULL, *w2 = NULL; void *config_data = 0; @@ -1537,7 +1537,7 @@ start: libxl_domain_unpause(ctx, domid); ret = domid; /* caller gets success in parent */ - if (!daemonize) + if (!daemonize && !debug) goto out; if (need_daemon) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-04 13:44 UTC
Re: [Xen-devel] [PATCH] tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground
Ian Campbell writes ("[Xen-devel] [PATCH] tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground"):> tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground > > Perhaps this should be a separate option but I find that when I''m debugging xl > in the foreground this is the behaviour I would like.Normally the "-e" option prevents xl from restarting domains when they ask to reboot, etc. With your patch, "-d" suppresses this property of "-e". Perhaps it would be better to have a new "run in foreground" option ? Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-May-04 15:00 UTC
Re: [Xen-devel] [PATCH] tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground
On Wed, 2011-05-04 at 14:44 +0100, Ian Jackson wrote:> Ian Campbell writes ("[Xen-devel] [PATCH] tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground"): > > tools: xl: on create, if debug && !daemonize, wait for domain destroy in the foreground > > > > Perhaps this should be a separate option but I find that when I''m debugging xl > > in the foreground this is the behaviour I would like. > > Normally the "-e" option prevents xl from restarting domains when they > ask to reboot, etc.Oh, is that what it means...> With your patch, "-d" suppresses this property of "-e". Perhaps it > would be better to have a new "run in foreground" option ?Sure. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-May-04 15:36 UTC
[Xen-devel] [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1304523348 -3600 # Node ID 6f20fdf37a97db6ff6ce4690057b8fd6662582f5 # Parent f033c864926375fd545af71a2f0229c00c4354a7 tools: xl: add option to run in foreground but still monitor for reboot etc Split daemonization option out from monitoring a domain for reboot etc. The ''e'' option continues to disable both and a new ''F''(oreground) option disables only daemonization. When I''m debugging xl in the foreground this is often the behaviour I would like. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r f033c8649263 -r 6f20fdf37a97 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue May 03 14:57:55 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Wed May 04 16:35:48 2011 +0100 @@ -1268,6 +1268,7 @@ static int preserve_domain(libxl_ctx *ct struct domain_create { int debug; int daemonize; + int monitor; /* handle guest reboots etc */ int paused; int dryrun; int quiet; @@ -1347,6 +1348,7 @@ static int create_domain(struct domain_c int debug = dom_info->debug; int daemonize = dom_info->daemonize; + int monitor = dom_info->monitor; int paused = dom_info->paused; const char *config_file = dom_info->config_file; const char *extra_config = dom_info->extra_config; @@ -1354,7 +1356,7 @@ static int create_domain(struct domain_c int migrate_fd = dom_info->migrate_fd; int fd, i; - int need_daemon = 1; + int need_daemon = daemonize; int ret, rc; libxl_waiter *w1 = NULL, *w2 = NULL; void *config_data = 0; @@ -1537,7 +1539,7 @@ start: libxl_domain_unpause(ctx, domid); ret = domid; /* caller gets success in parent */ - if (!daemonize) + if (!daemonize && !monitor) goto out; if (need_daemon) { @@ -2722,7 +2724,7 @@ static void core_dump_domain(const char if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); } } -static void migrate_receive(int debug, int daemonize) +static void migrate_receive(int debug, int daemonize, int monitor) { int rc, rc2; char rc_buf; @@ -2743,6 +2745,7 @@ static void migrate_receive(int debug, i memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = 1; dom_info.restore_file = "incoming migration stream"; dom_info.migrate_fd = 0; /* stdin */ @@ -2825,10 +2828,11 @@ int main_restore(int argc, char **argv) const char *checkpoint_file = NULL; const char *config_file = NULL; struct domain_create dom_info; - int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0; + int paused = 0, debug = 0, daemonize = 1, monitor = 1, + console_autoconnect = 0; int opt, rc; - while ((opt = getopt(argc, argv, "chpde")) != -1) { + while ((opt = getopt(argc, argv, "Fchpde")) != -1) { switch (opt) { case ''c'': console_autoconnect = 1; @@ -2839,8 +2843,12 @@ int main_restore(int argc, char **argv) case ''d'': debug = 1; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''h'': help("restore"); @@ -2864,6 +2872,7 @@ int main_restore(int argc, char **argv) memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = paused; dom_info.config_file = config_file; dom_info.restore_file = checkpoint_file; @@ -2879,17 +2888,21 @@ int main_restore(int argc, char **argv) int main_migrate_receive(int argc, char **argv) { - int debug = 0, daemonize = 1; + int debug = 0, daemonize = 1, monitor = 1; int opt; - while ((opt = getopt(argc, argv, "hed")) != -1) { + while ((opt = getopt(argc, argv, "Fhed")) != -1) { switch (opt) { case ''h'': help("migrate-receive"); return 2; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''d'': debug = 1; @@ -2904,7 +2917,7 @@ int main_migrate_receive(int argc, char help("migrate-receive"); return 2; } - migrate_receive(debug, daemonize); + migrate_receive(debug, daemonize, monitor); return 0; } @@ -2948,9 +2961,9 @@ int main_migrate(int argc, char **argv) const char *ssh_command = "ssh"; char *rune = NULL; char *host; - int opt, daemonize = 1, debug = 0; - - while ((opt = getopt(argc, argv, "hC:s:ed")) != -1) { + int opt, daemonize = 1, monitor = 1, debug = 0; + + while ((opt = getopt(argc, argv, "FhC:s:ed")) != -1) { switch (opt) { case ''h'': help("migrate"); @@ -2961,8 +2974,12 @@ int main_migrate(int argc, char **argv) case ''s'': ssh_command = optarg; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''d'': debug = 1; @@ -3250,7 +3267,7 @@ int main_create(int argc, char **argv) char extra_config[1024]; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0, - dryrun = 0, quiet = 0; + dryrun = 0, quiet = 0, monitor = 1; int opt, rc; int option_index = 0; static struct option long_options[] = { @@ -3267,7 +3284,7 @@ int main_create(int argc, char **argv) } while (1) { - opt = getopt_long(argc, argv, "hnqf:pcde", long_options, &option_index); + opt = getopt_long(argc, argv, "Fhnqf:pcde", long_options, &option_index); if (opt == -1) break; @@ -3284,8 +3301,12 @@ int main_create(int argc, char **argv) case ''d'': debug = 1; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''h'': help("create"); @@ -3318,6 +3339,7 @@ int main_create(int argc, char **argv) memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = paused; dom_info.dryrun = dryrun; dom_info.quiet = quiet; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-May-06 12:40 UTC
Re: [Xen-devel] [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc
On Wed, 2011-05-04 at 16:36 +0100, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1304523348 -3600 > # Node ID 6f20fdf37a97db6ff6ce4690057b8fd6662582f5 > # Parent f033c864926375fd545af71a2f0229c00c4354a7 > tools: xl: add option to run in foreground but still monitor for reboot etcv3 updated for 23299:39f2942fe56b "xl: refactor common parts of command line parsing" 8<---------------------- # HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1304685600 -3600 # Node ID c0d309593d78b3e7340b805f95330249e7142169 # Parent 94ddef3d9f45fa36aa076a164dfbfa04c09eeb85 tools: xl: add option to run in foreground but still monitor for reboot etc Split daemonization option out from monitoring a domain for reboot etc. The ''e'' option continues to disable both and a new ''F''(oreground) option disables only daemonization. When I''m debugging xl in the foreground this is often the behaviour I would like. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 94ddef3d9f45 -r c0d309593d78 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri May 06 13:38:20 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Fri May 06 13:40:00 2011 +0100 @@ -1268,6 +1268,7 @@ static int preserve_domain(libxl_ctx *ct struct domain_create { int debug; int daemonize; + int monitor; /* handle guest reboots etc */ int paused; int dryrun; int quiet; @@ -1347,6 +1348,7 @@ static int create_domain(struct domain_c int debug = dom_info->debug; int daemonize = dom_info->daemonize; + int monitor = dom_info->monitor; int paused = dom_info->paused; const char *config_file = dom_info->config_file; const char *extra_config = dom_info->extra_config; @@ -1354,7 +1356,7 @@ static int create_domain(struct domain_c int migrate_fd = dom_info->migrate_fd; int fd, i; - int need_daemon = 1; + int need_daemon = daemonize; int ret, rc; libxl_waiter *w1 = NULL, *w2 = NULL; void *config_data = 0; @@ -1537,7 +1539,7 @@ start: libxl_domain_unpause(ctx, domid); ret = domid; /* caller gets success in parent */ - if (!daemonize) + if (!daemonize && !monitor) goto out; if (need_daemon) { @@ -2651,7 +2653,7 @@ static void core_dump_domain(const char if (rc) { fprintf(stderr,"core dump failed (rc=%d)\n",rc);exit(-1); } } -static void migrate_receive(int debug, int daemonize) +static void migrate_receive(int debug, int daemonize, int monitor) { int rc, rc2; char rc_buf; @@ -2672,6 +2674,7 @@ static void migrate_receive(int debug, i memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = 1; dom_info.restore_file = "incoming migration stream"; dom_info.migrate_fd = 0; /* stdin */ @@ -2754,10 +2757,11 @@ int main_restore(int argc, char **argv) const char *checkpoint_file = NULL; const char *config_file = NULL; struct domain_create dom_info; - int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0; + int paused = 0, debug = 0, daemonize = 1, monitor = 1, + console_autoconnect = 0; int opt, rc; - while ((opt = def_getopt(argc, argv, "cpde", "restore", 1)) != -1) { + while ((opt = def_getopt(argc, argv, "Fcpde", "restore", 1)) != -1) { switch (opt) { case 0: case 2: return opt; @@ -2770,8 +2774,12 @@ int main_restore(int argc, char **argv) case ''d'': debug = 1; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; } } @@ -2789,6 +2797,7 @@ int main_restore(int argc, char **argv) memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = paused; dom_info.config_file = config_file; dom_info.restore_file = checkpoint_file; @@ -2804,15 +2813,19 @@ int main_restore(int argc, char **argv) int main_migrate_receive(int argc, char **argv) { - int debug = 0, daemonize = 1; + int debug = 0, daemonize = 1, monitor = 1; int opt; - while ((opt = def_getopt(argc, argv, "ed", "migrate-receive", 0)) != -1) { + while ((opt = def_getopt(argc, argv, "Fed", "migrate-receive", 0)) != -1) { switch (opt) { case 0: case 2: return opt; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''d'': debug = 1; @@ -2824,7 +2837,7 @@ int main_migrate_receive(int argc, char help("migrate-receive"); return 2; } - migrate_receive(debug, daemonize); + migrate_receive(debug, daemonize, monitor); return 0; } @@ -2864,9 +2877,9 @@ int main_migrate(int argc, char **argv) const char *ssh_command = "ssh"; char *rune = NULL; char *host; - int opt, daemonize = 1, debug = 0; - - while ((opt = def_getopt(argc, argv, "C:s:ed", "migrate", 2)) != -1) { + int opt, daemonize = 1, monitor = 1, debug = 0; + + while ((opt = def_getopt(argc, argv, "FC:s:ed", "migrate", 2)) != -1) { switch (opt) { case 0: case 2: return opt; @@ -2876,8 +2889,12 @@ int main_migrate(int argc, char **argv) case ''s'': ssh_command = optarg; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''d'': debug = 1; @@ -3069,7 +3086,7 @@ int main_create(int argc, char **argv) char extra_config[1024]; struct domain_create dom_info; int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0, - dryrun = 0, quiet = 0; + dryrun = 0, quiet = 0, monitor = 1; int opt, rc; int option_index = 0; static struct option long_options[] = { @@ -3086,7 +3103,7 @@ int main_create(int argc, char **argv) } while (1) { - opt = getopt_long(argc, argv, "hnqf:pcde", long_options, &option_index); + opt = getopt_long(argc, argv, "Fhnqf:pcde", long_options, &option_index); if (opt == -1) break; @@ -3103,8 +3120,12 @@ int main_create(int argc, char **argv) case ''d'': debug = 1; break; + case ''F'': + daemonize = 0; + break; case ''e'': daemonize = 0; + monitor = 0; break; case ''h'': help("create"); @@ -3137,6 +3158,7 @@ int main_create(int argc, char **argv) memset(&dom_info, 0, sizeof(dom_info)); dom_info.debug = debug; dom_info.daemonize = daemonize; + dom_info.monitor = monitor; dom_info.paused = paused; dom_info.dryrun = dryrun; dom_info.quiet = quiet; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-May-17 16:32 UTC
Re: [Xen-devel] [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc
Ian Campbell writes ("Re: [Xen-devel] [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc"):> v3 updated for 23299:39f2942fe56b "xl: refactor common parts of command > line parsing"Great, thanks.> tools: xl: add option to run in foreground but still monitor for reboot etc > > Split daemonization option out from monitoring a domain for reboot > etc. The ''e'' option continues to disable both and a new ''F''(oreground) > option disables only daemonization. > > When I''m debugging xl in the foreground this is often the behaviour I > would like.Applied. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Olaf Hering
2013-Jan-28 15:22 UTC
Re: [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc
Ian, the xl migrate command gets a new option -F with this change. Is it intentional? The "monitor" variable is not used in this part of the patch. It got applied in changeset 23350:f531ed84b066 Olaf On Fri, May 06, Ian Campbell wrote:> On Wed, 2011-05-04 at 16:36 +0100, Ian Campbell wrote: > > # HG changeset patch > > # User Ian Campbell <ian.campbell@citrix.com> > > # Date 1304523348 -3600 > > # Node ID 6f20fdf37a97db6ff6ce4690057b8fd6662582f5 > > # Parent f033c864926375fd545af71a2f0229c00c4354a7 > > tools: xl: add option to run in foreground but still monitor for reboot etc > > v3 updated for 23299:39f2942fe56b "xl: refactor common parts of command > line parsing" > > 8<---------------------- > > # HG changeset patch > # User Ian Campbell <ian.campbell@citrix.com> > # Date 1304685600 -3600 > # Node ID c0d309593d78b3e7340b805f95330249e7142169 > # Parent 94ddef3d9f45fa36aa076a164dfbfa04c09eeb85 > tools: xl: add option to run in foreground but still monitor for reboot etc > > Split daemonization option out from monitoring a domain for reboot > etc. The ''e'' option continues to disable both and a new ''F''(oreground) > option disables only daemonization. > > When I''m debugging xl in the foreground this is often the behaviour I > would like.> @@ -2864,9 +2877,9 @@ int main_migrate(int argc, char **argv) > const char *ssh_command = "ssh"; > char *rune = NULL; > char *host; > - int opt, daemonize = 1, debug = 0; > - > - while ((opt = def_getopt(argc, argv, "C:s:ed", "migrate", 2)) != -1) { > + int opt, daemonize = 1, monitor = 1, debug = 0; > + > + while ((opt = def_getopt(argc, argv, "FC:s:ed", "migrate", 2)) != -1) { > switch (opt) { > case 0: case 2: > return opt; > @@ -2876,8 +2889,12 @@ int main_migrate(int argc, char **argv) > case ''s'': > ssh_command = optarg; > break; > + case ''F'': > + daemonize = 0; > + break; > case ''e'': > daemonize = 0; > + monitor = 0; > break; > case ''d'': > debug = 1;
Ian Campbell
2013-Jan-28 15:27 UTC
Re: [PATCH] tools: xl: add option to run in foreground but still monitor for reboot etc
On Mon, 2013-01-28 at 15:22 +0000, Olaf Hering wrote:> Ian, > > > the xl migrate command gets a new option -F with this change. > Is it intentional? The "monitor" variable is not used in this part of > the patch.Looks like I intended to plumb it through to the invocation of migrate-receive?> It got applied in changeset 23350:f531ed84b066 > > Olaf > > On Fri, May 06, Ian Campbell wrote: > > > On Wed, 2011-05-04 at 16:36 +0100, Ian Campbell wrote: > > > # HG changeset patch > > > # User Ian Campbell <ian.campbell@citrix.com> > > > # Date 1304523348 -3600 > > > # Node ID 6f20fdf37a97db6ff6ce4690057b8fd6662582f5 > > > # Parent f033c864926375fd545af71a2f0229c00c4354a7 > > > tools: xl: add option to run in foreground but still monitor for reboot etc > > > > v3 updated for 23299:39f2942fe56b "xl: refactor common parts of command > > line parsing" > > > > 8<---------------------- > > > > # HG changeset patch > > # User Ian Campbell <ian.campbell@citrix.com> > > # Date 1304685600 -3600 > > # Node ID c0d309593d78b3e7340b805f95330249e7142169 > > # Parent 94ddef3d9f45fa36aa076a164dfbfa04c09eeb85 > > tools: xl: add option to run in foreground but still monitor for reboot etc > > > > Split daemonization option out from monitoring a domain for reboot > > etc. The ''e'' option continues to disable both and a new ''F''(oreground) > > option disables only daemonization. > > > > When I''m debugging xl in the foreground this is often the behaviour I > > would like. > > > > @@ -2864,9 +2877,9 @@ int main_migrate(int argc, char **argv) > > const char *ssh_command = "ssh"; > > char *rune = NULL; > > char *host; > > - int opt, daemonize = 1, debug = 0; > > - > > - while ((opt = def_getopt(argc, argv, "C:s:ed", "migrate", 2)) != -1) { > > + int opt, daemonize = 1, monitor = 1, debug = 0; > > + > > + while ((opt = def_getopt(argc, argv, "FC:s:ed", "migrate", 2)) != -1) { > > switch (opt) { > > case 0: case 2: > > return opt; > > @@ -2876,8 +2889,12 @@ int main_migrate(int argc, char **argv) > > case ''s'': > > ssh_command = optarg; > > break; > > + case ''F'': > > + daemonize = 0; > > + break; > > case ''e'': > > daemonize = 0; > > + monitor = 0; > > break; > > case ''d'': > > debug = 1; >
Seemingly Similar Threads
- [PATCH 0 of 2 v2] Add vncviewer xm compatibility options
- [PATCH] Add vncviewer xm compatibility options the 'xl create' command
- [PATCH 0/9] libxl: disk configuration handling
- [PATCH 0 of 4] Support for VM generation ID save/restore and migrate
- [PATCH 0 of 3] Support for VM generation ID save/restore and migrate