Class: Server

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

Overview

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

Instance Attribute Summary

Attributes inherited from Fog::Compute::Server

#private_key, #private_key_path, #public_key, #public_key_path, #ssh_options, #ssh_port, #username

Attributes inherited from Fog::Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Fog::Compute::Server

#scp, #scp_download, #ssh, #ssh_ip_address, #ssh_ip_address=, #sshable?

Methods inherited from Fog::Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

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