class OnappMarket::Instance::VM

A generic ‘vm’ instance to define an individual vm, for example, as provisioned on a hypervisor zone from an OnApp CP, or on a more generic interface such as to RackSpace OpenStack or EC2.

In the future this will likely be split into Compute, Storage, Network as per OCCI

Constants

TYPE

Generic VM type

Attributes

cpus[RW]

number of CPUs assigned to the VM.

disk_size[RW]

set the disk space for this VM

host_name[RW]

set the host name for this VM.

memory[RW]

amount of RAM assigned to the VM.

required_automatic_backup[RW]

set 1 if you need automatic backups.

required_ip_address_assignment[RW]

set “1” if you want IP address to be assigned automatically after creation. Otherwise set “0”

required_virtual_machine_build[RW]

set 1 to build VM automatically

required_virtual_machine_startup[RW]

set 1 to start up the VM automatically, otherwise set 0 (default state is “1”)

swap_size[RW]

set swap space. There is no swap disk for Windows-based VMs

Public Class Methods

new(hash = {}, type = nil) click to toggle source

Create a generic VM resource

Attributes

  • hash - Hash of attributes to apply

  • type - type for serialization help

# File lib/onapp_market/instance/vm.rb, line 39
def initialize(hash = {}, type = nil)
  type = TYPE if type == nil
  super(hash, type)
end

Public Instance Methods

backup() click to toggle source

Restart a VM

Returns

OnappMarket::API::Response - VM has been shutdown if is_ok?

Roles

trader, admin

# File lib/onapp_market/instance/vm.rb, line 70
def backup
  @api.get("/vm/#{self.instance_id}/backup")
end
restart() click to toggle source

Restart a VM

Returns

OnappMarket::API::Response - VM has been shutdown if is_ok?

Roles

trader, admin

# File lib/onapp_market/instance/vm.rb, line 60
def restart
  @api.get("/vm/#{self.instance_id}/restart")
end
restore() click to toggle source

Restart a VM

Returns

OnappMarket::API::Response - VM has been shutdown if is_ok?

Roles

trader, admin

# File lib/onapp_market/instance/vm.rb, line 80
def restore
  @api.get("/vm/#{self.instance_id}/restore")
end
shutdown() click to toggle source

Shutdown a VM

Returns

OnappMarket::API::Response - VM has been shutdown if is_ok?

Roles

trader, admin

# File lib/onapp_market/instance/vm.rb, line 50
def shutdown
  @api.get("/vm/#{self.instance_id}/shutdown")
end