From 3e2360d383d8e7503a8afe07291ab8c0b1182a14 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 17 Nov 2018 17:54:07 +0200 Subject: Implement the terminate-instances command * TODO: Update. * doc/Makefile.inc: Add new files. * doc/eclat-mkinst.1: Mention the terminate command. * doc/eclat-terminate.1: New file. * etc/Makefile.am: Add new files. * etc/terminate-instances.fln: New file. * src/eclat.c (cmdtab): Register new command. * src/eclat.h (eclat_terminate_instances): New proto. * src/startstop.c (eclat_terminate_instances): New function. * tests/Makefile.am: Add new test. * tests/testsuite.at: Likewise. * tests/terminate-instances.at: New test. --- src/startstop.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/startstop.c') diff --git a/src/startstop.c b/src/startstop.c index 2460682..78c581c 100644 --- a/src/startstop.c +++ b/src/startstop.c @@ -44,7 +44,6 @@ start_stop_instance(eclat_command_env_t *env, int argc, char **argv) snprintf(bend, bs, "%lu", (unsigned long)(i + 1)); eclat_request_add_param(q, buf, argv[i]); } - return 0; } @@ -90,3 +89,16 @@ eclat_reboot_instance(eclat_command_env_t *env, int argc, char **argv) debug(ECLAT_DEBCAT_MAIN, 1, ("rebooting instances")); return start_stop_instance(env, argc - i, argv + i); } + +int +eclat_terminate_instances(eclat_command_env_t *env, int argc, char **argv) +{ + int i; + + parse_options(env->cmd, + "Terminate named instances", + argc, argv, &i); + + debug(ECLAT_DEBCAT_MAIN, 1, ("terminate instances")); + return start_stop_instance(env, argc - i, argv + i); +} -- cgit v1.2.1