Class: Vixen::CommandLine::Snapshot

Inherits:
Base
  • Object
show all
Defined in:
lib/vixen/command_line/snapshot.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #start

Instance Method Summary collapse

Methods inherited from Base

#elapsed_time, #host, #initialize, #new_line_after, #print, #puts, #vms

Constructor Details

This class inherits a constructor from Vixen::CommandLine::Base

Instance Method Details

#createObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/vixen/command_line/snapshot.rb', line 36

def create
  snapshot_name = ARGV.shift
  vms.each do |vm|
    new_line_after do
      vm.create_snapshot(snapshot_name) do |job_handle, event_type, more_event_info, client_data|
        print "Creating #{snapshot_name} snapshot on #{vm.name}"
      end
    end
  end
end

#currentObject



29
30
31
32
33
34
# File 'lib/vixen/command_line/snapshot.rb', line 29

def current
  vms.each do |vm|
    puts "#{vm.name}"
    puts "  - #{vm.current_snapshot.full_name}"
  end
end

#default_actionObject



53
54
55
# File 'lib/vixen/command_line/snapshot.rb', line 53

def default_action
  'list'
end

#executeObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/vixen/command_line/snapshot.rb', line 4

def execute
  action = ARGV.shift
  action ||= default_action

  action = action.to_sym

  if defined? action
    send action
  end
end

#listObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vixen/command_line/snapshot.rb', line 15

def list
  total_snapshots = 0

  vms.each do |vm|
    puts "#{vm.name} : (#{vm.current_snapshot.display_name})"
    all_snaps = vm.all_snapshots
    total_snapshots += all_snaps.count
    all_snaps.each do |snap|
      puts "  - #{snap.display_name}"
    end
  end
  puts "Found #{total_snapshots} snapshots on #{vms.count} virtual machines"
end

#removeObject



50
51
# File 'lib/vixen/command_line/snapshot.rb', line 50

def remove
end

#revertObject



47
48
# File 'lib/vixen/command_line/snapshot.rb', line 47

def revert
end