Class: Server

Inherits:
Fog::Compute::Server
  • Object
show all
Defined in:
lib/fog/openstack/examples/compute/basics.rb

Overview

vm.start / vm.stop / vm.pause should work after this

Instance Method Summary collapse

Instance Method Details

#pauseObject



51
52
53
# File 'lib/fog/openstack/examples/compute/basics.rb', line 51

def pause
  service.pause_server(id)   # stores VM state in RAM
end

#startObject



39
40
41
42
43
44
45
# File 'lib/fog/openstack/examples/compute/basics.rb', line 39

def start
  if state.downcase == 'paused'
    service.unpause_server(id) # resumes from frozen VM state
  else
    service.resume_server(id)  # resumes from hibernation
  end
end

#stopObject



47
48
49
# File 'lib/fog/openstack/examples/compute/basics.rb', line 47

def stop
  service.suspend_server(id) # hibernates the VM at hypervisor-level
end