Class: Pvectl::Commands::Suspend
- Inherits:
-
Object
- Object
- Pvectl::Commands::Suspend
- Includes:
- VmLifecycleCommand
- Defined in:
- lib/pvectl/commands/suspend.rb,
sig/pvectl/commands/suspend.rbs
Overview
Handler for the pvectl suspend command.
Suspends one or more virtual machines (hibernate).
Constant Summary collapse
- OPERATION =
:suspend
Class Method Summary collapse
-
.register(cli) ⇒ void
Registers the suspend 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 suspend 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 |
# File 'lib/pvectl/commands/suspend.rb', line 22 def self.register(cli) cli.desc "Suspend virtual machines (hibernate)" cli.long_desc " Suspend (hibernate) one or more virtual machines. Saves the VM's\n memory state to disk and stops it. The VM can be resumed later\n with 'pvectl resume'.\n\n Only available for VMs. Containers do not support suspend.\n\n EXAMPLES\n Suspend a VM:\n $ pvectl suspend vm 100\n\n Suspend all running VMs on a node:\n $ pvectl suspend vm --all --node pve1 -l status=running --yes\n\n NOTES\n Suspend saves the full memory state to disk, which may take time\n for VMs with large memory allocations.\n\n Not available for containers.\n\n SEE ALSO\n pvectl help resume Resume suspended VMs\n pvectl help shutdown Graceful shutdown (no state saved)\n HELP\n cli.arg_name \"RESOURCE_TYPE [ID...]\"\n cli.command :suspend 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 = execute(resource_type, resource_ids, options, global_options)\n exit exit_code if exit_code != 0\n end\n end\nend\n" |