Class: Pvectl::Commands::Resume

Inherits:
Object
  • Object
show all
Includes:
VmLifecycleCommand
Defined in:
lib/pvectl/commands/resume.rb

Overview

Handler for the ‘pvectl resume` command.

Resumes one or more suspended virtual machines.

Examples:

Resume a single VM

pvectl resume vm 100

Resume with JSON output

pvectl resume vm 100 -o json

Constant Summary collapse

OPERATION =
:resume

Class Method Summary collapse

Methods included from VmLifecycleCommand

included

Methods included from ResourceLifecycleCommand

#execute, included, #initialize

Class Method Details

.register(cli) ⇒ void

This method returns an undefined value.

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

def self.register(cli)
  cli.desc "Resume suspended virtual machines"
  cli.long_desc <<~HELP
    Resume one or more suspended (hibernated) virtual machines. Restores
    the VM's memory state from disk and continues execution.

    Only available for VMs. Containers do not support resume.

    EXAMPLES
      Resume a suspended VM:
        $ pvectl resume vm 100

      Resume all suspended VMs:
        $ pvectl resume vm --all -l status=suspended --yes

    SEE ALSO
      pvectl help suspend         Suspend (hibernate) VMs
      pvectl help start           Start a stopped VM (no state restore)
  HELP
  cli.arg_name "RESOURCE_TYPE [ID...]"
  cli.command :resume do |c|
    SharedFlags.lifecycle(c)

    c.action do |global_options, options, args|
      resource_type = args.shift
      resource_ids = args
      exit_code = execute(resource_type, resource_ids, options, global_options)
      exit exit_code if exit_code != 0
    end
  end
end