[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 7/7] tools/libxl: Allow dom0 to be destroyed
When dom0 is not the hardware domain, it can be destroyed in the same way as any other service domain. To avoid accidental use when a domain is not resolved, destroying domain 0 requires passing -f to xl destroy. Since the hypervisor already prevents a domain from destroying itself, this patch is only useful in a disaggregated environment. Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 6b1ebfa..54dea5c 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3076,12 +3076,13 @@ static void unpause_domain(uint32_t domid) libxl_domain_unpause(ctx, domid); } -static void destroy_domain(uint32_t domid) +static void destroy_domain(uint32_t domid, int force) { int rc; - if (domid == 0) { - fprintf(stderr, "Cannot destroy privileged domain 0.\n\n"); + if (domid == 0 && !force) { + fprintf(stderr, "Destroying domain 0 is only supported in a" + " disaggregated environment and requires the -f flag.\n\n"); exit(-1); } rc = libxl_domain_destroy(ctx, domid, 0); @@ -4166,12 +4167,15 @@ int main_unpause(int argc, char **argv) int main_destroy(int argc, char **argv) { int opt; + int force = 0; - SWITCH_FOREACH_OPT(opt, "", NULL, "destroy", 1) { - /* No options */ + SWITCH_FOREACH_OPT(opt, "f", NULL, "destroy", 1) { + case 'f': + force = 1; + break; } - destroy_domain(find_domain(argv[optind])); + destroy_domain(find_domain(argv[optind]), force); return 0; } -- 1.8.5.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |