[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/2] tools/xl: add suspend and resume subcommands
On 2024-11-28 12:19, Anthony PERARD wrote: On Tue, Nov 26, 2024 at 12:19:41PM -0500, Jason Andryuk wrote:diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index c45d497c28..3160966972 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -42,6 +42,16 @@ static void unpause_domain(uint32_t domid) libxl_domain_unpause(ctx, domid, NULL); }+static void suspend_domain(uint32_t domid)+{ + libxl_domain_suspend_only(ctx, domid, NULL); +} + +static void resume_domain(uint32_t domid) +{ + libxl_domain_resume(ctx, domid, 1, NULL); +} + static void destroy_domain(uint32_t domid, int force) { int rc; @@ -82,6 +92,32 @@ int main_unpause(int argc, char **argv) return EXIT_SUCCESS; }+int main_suspend(int argc, char **argv)+{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "suspend", 1) { + /* No options */ + } + + suspend_domain(find_domain(argv[optind])); + + return EXIT_SUCCESS; +} + +int main_resume(int argc, char **argv) +{ + int opt; + + SWITCH_FOREACH_OPT(opt, "", NULL, "resume", 1) { + /* No options */ + } + + resume_domain(find_domain(argv[optind])); + + return EXIT_SUCCESS; +}These four new functions in xl_vmcontrol.c needs to be hidden behind LIBXL_HAVE_NO_SUSPEND_RESUME, like the whole xl_migrate.c file is. Both prototypes for main_*() are already hidden as well as the new command in xl_cmdtables. Or alternatively, we could probably have the command been present on Arm, but I don't know if libxl_domain_suspend_only() is going to work. It looks like it only depends on the hypervisor. I can't find any logic that would treat Arm differently, besides the presence of LIBXL_HAVE_NO_SUSPEND_RESUME. But best bet would be to hide those four functions when LIBXL_HAVE_NO_SUSPEND_RESUME is defined. Thanks. Yes, I'll hide them. Regards, Jason
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |