Class: Pvectl::Commands::Stop
- Inherits:
-
Object
- Object
- Pvectl::Commands::Stop
- Includes:
- VmLifecycleCommand
- Defined in:
- lib/pvectl/commands/stop.rb,
sig/pvectl/commands/stop.rbs
Overview
Handler for the pvectl stop command.
Stops one or more virtual machines (hard stop).
Constant Summary collapse
- OPERATION =
:stop
Class Method Summary collapse
-
.register(cli) ⇒ void
Registers the stop command with the CLI.
Methods included from VmLifecycleCommand
#build_presenter, #build_repository, #build_selector, #build_service, included, #resource_id_label, #resource_label, #supported_resources
Methods included from ResourceLifecycleCommand
#apply_selectors, #build_presenter, #build_repository, #build_selector, #build_service, #confirm_operation, #determine_exit_code, #execute, included, #initialize, #load_config, #no_resources_found, #operation_name, #output_results, #perform_operation, #resolve_resources, #resource_id_label, #resource_label, #selector_strings, #service_options, #supported_resources, #usage_error
Class Method Details
.register(cli) ⇒ void
This method returns an undefined value.
Registers the stop command with the CLI.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/pvectl/commands/stop.rb', line 22 def self.register(cli) cli.desc "Stop virtual machines or containers (hard stop)" cli.long_desc " Immediately stop one or more virtual machines or containers. This is\n a hard stop (equivalent to pulling the power cord) \u2014 the guest OS is\n NOT shut down gracefully.\n\n For a clean shutdown, use 'pvectl shutdown' instead.\n\n EXAMPLES\n Hard stop a VM:\n $ pvectl stop vm 100\n\n Stop multiple containers:\n $ pvectl stop ct 200 201\n\n Stop all running VMs:\n $ pvectl stop vm --all -l status=running --yes\n\n Stop with sync wait:\n $ pvectl stop vm 100 --wait --timeout 30\n\n NOTES\n Hard stop may cause data loss or filesystem corruption in the guest.\n Prefer 'shutdown' for production workloads.\n\n Batch operations (--all) require --yes or interactive confirmation.\n\n SEE ALSO\n pvectl help shutdown Graceful shutdown (recommended)\n pvectl help start Start resources\n HELP\n cli.arg_name \"RESOURCE_TYPE [ID...]\"\n cli.command :stop do |c|\n SharedFlags.lifecycle(c)\n\n c.action do |global_options, options, args|\n resource_type = args.shift\n resource_ids = args\n exit_code = case resource_type\n when \"container\", \"ct\"\n StopContainer.execute(resource_type, resource_ids, options, global_options)\n else\n execute(resource_type, resource_ids, options, global_options)\n end\n exit exit_code if exit_code != 0\n end\n end\nend\n" |