Class: Pvectl::Commands::Start

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

Overview

Handler for the pvectl start command.

Starts one or more virtual machines.

Examples:

Start a single VM

pvectl start vm 100

Start with JSON output

pvectl start vm 100 -o json

Constant Summary collapse

OPERATION =

Returns:

  • (Symbol)
:start

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 start command with the CLI.

Parameters:

  • cli (GLI::App)

    the CLI application object



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
71
72
73
74
# File 'lib/pvectl/commands/start.rb', line 22

def self.register(cli)
  cli.desc "Start virtual machines or containers"
  cli.long_desc "    Start one or more virtual machines or containers. Supports single\n    resource, multiple IDs, and batch operations with selectors.\n\n    By default, operations run asynchronously (fire-and-forget). Use\n    --wait to wait for completion, or --async to explicitly force async.\n\n    EXAMPLES\n      Start a single VM:\n        $ pvectl start vm 100\n\n      Start multiple VMs:\n        $ pvectl start vm 100 101 102\n\n      Start a container:\n        $ pvectl start ct 200\n\n      Start all stopped VMs on a node:\n        $ pvectl start vm --all -l status=stopped --node pve1\n\n      Wait for start to complete with timeout:\n        $ pvectl start vm 100 --wait --timeout 60\n\n    NOTES\n      Batch operations (--all) require --yes or interactive confirmation.\n\n      Use selectors (-l) to filter: status, name, tags, pool.\n      Multiple selectors use AND logic.\n\n    SEE ALSO\n      pvectl help stop            Hard stop resources\n      pvectl help shutdown        Graceful shutdown\n      pvectl help get vms         List VMs and their status\n  HELP\n  cli.arg_name \"RESOURCE_TYPE [ID...]\"\n  cli.command :start 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        StartContainer.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"