Class: Pvectl::Commands::Restart

Inherits:
Object
  • Object
show all
Includes:
VmLifecycleCommand
Defined in:
lib/pvectl/commands/restart.rb,
sig/pvectl/commands/restart.rbs

Overview

Handler for the pvectl restart command.

Restarts one or more virtual machines (reboot).

Examples:

Restart a single VM

pvectl restart vm 100

Restart with sync mode

pvectl restart vm 100 --wait

Constant Summary collapse

OPERATION =
:restart

Class Method Summary collapse

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 restart 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
# File 'lib/pvectl/commands/restart.rb', line 22

def self.register(cli)
  cli.desc "Restart virtual machines or containers (reboot)"
  cli.long_desc "    Reboot one or more virtual machines or containers. Sends a reboot\n    signal to the guest OS for a clean restart.\n\n    EXAMPLES\n      Reboot a VM:\n        $ pvectl restart vm 100\n\n      Reboot a container:\n        $ pvectl restart ct 200\n\n      Reboot all VMs with a specific tag:\n        $ pvectl restart vm --all -l tags=webserver --yes\n\n    NOTES\n      For VMs, this sends an ACPI reboot signal (requires guest agent or\n      ACPI support). For containers, uses LXC reboot.\n\n      For a hard reset (equivalent to pressing the reset button), use\n      'pvectl reset' instead (VMs only).\n\n    SEE ALSO\n      pvectl help reset           Hard reset (VMs only)\n      pvectl help shutdown        Graceful shutdown without restart\n  HELP\n  cli.arg_name \"RESOURCE_TYPE [ID...]\"\n  cli.command :restart 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        RestartContainer.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"