Class: Fog::Compute::XenServer::Real

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/xenserver/compute.rb,
lib/fog/xenserver/requests/compute/scan_sr.rb,
lib/fog/xenserver/requests/compute/start_vm.rb,
lib/fog/xenserver/requests/compute/create_sr.rb,
lib/fog/xenserver/requests/compute/eject_vbd.rb,
lib/fog/xenserver/requests/compute/create_vbd.rb,
lib/fog/xenserver/requests/compute/create_vdi.rb,
lib/fog/xenserver/requests/compute/create_vif.rb,
lib/fog/xenserver/requests/compute/destroy_sr.rb,
lib/fog/xenserver/requests/compute/get_record.rb,
lib/fog/xenserver/requests/compute/insert_vbd.rb,
lib/fog/xenserver/requests/compute/unplug_pbd.rb,
lib/fog/xenserver/requests/compute/unplug_vbd.rb,
lib/fog/xenserver/requests/compute/create_vlan.rb,
lib/fog/xenserver/requests/compute/destroy_vdi.rb,
lib/fog/xenserver/requests/compute/destroy_vif.rb,
lib/fog/xenserver/requests/compute/enable_host.rb,
lib/fog/xenserver/requests/compute/get_records.rb,
lib/fog/xenserver/requests/compute/reboot_host.rb,
lib/fog/xenserver/requests/compute/clone_server.rb,
lib/fog/xenserver/requests/compute/destroy_vlan.rb,
lib/fog/xenserver/requests/compute/disable_host.rb,
lib/fog/xenserver/requests/compute/set_affinity.rb,
lib/fog/xenserver/requests/compute/start_server.rb,
lib/fog/xenserver/requests/compute/create_server.rb,
lib/fog/xenserver/requests/compute/reboot_server.rb,
lib/fog/xenserver/requests/compute/set_attribute.rb,
lib/fog/xenserver/requests/compute/shutdown_host.rb,
lib/fog/xenserver/requests/compute/create_network.rb,
lib/fog/xenserver/requests/compute/destroy_server.rb,
lib/fog/xenserver/requests/compute/destroy_network.rb,
lib/fog/xenserver/requests/compute/shutdown_server.rb,
lib/fog/xenserver/requests/compute/snapshot_revert.rb,
lib/fog/xenserver/requests/compute/snapshot_server.rb,
lib/fog/xenserver/requests/compute/provision_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



116
117
118
119
120
121
122
123
124
# File 'lib/fog/xenserver/compute.rb', line 116

def initialize(options={})
  @host        = options[:xenserver_url]
  @username    = options[:xenserver_username]
  @password    = options[:xenserver_password]
  @defaults    = options[:xenserver_defaults] || {}
  @timeout     = options[:xenserver_timeout] || 30
  @connection  = Fog::XenServer::Connection.new(@host, @timeout)
  @connection.authenticate(@username, @password)
end

Instance Method Details

#clone_server(server_name, template_ref) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/xenserver/requests/compute/clone_server.rb', line 5

def clone_server( server_name, template_ref )
  # Clone the VM template
  if template_ref.kind_of? Fog::Compute::XenServer::Server
    template_ref = template_ref.reference
  end
  raise ArgumentError.new("Invalid template_ref") if template_ref.nil?
  raise ArgumentError.new("Invalid template_ref") if server_name.nil?

  ref = @connection.request(
    {:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.clone'},
    template_ref, server_name
  )
end

#create_network(name, config = {}) ⇒ Object

Create a Network



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/xenserver/requests/compute/create_network.rb', line 9

def create_network( name, config = {} )
  config.reject! { |k,v| v.nil? }

  default_config = {
    :name_label => name,
    # Description is mandatory in XenAPI but we default to empty
    :name_description => config[:description] || '',
    # Mandatory, but can be empty
    :other_config => {}
  }.merge config

  @connection.request(
    {
      :parser => Fog::Parsers::XenServer::Base.new,
      :method => 'network.create'
    },
    default_config
  )
end

#create_server(name_label, template = nil, networks = [], extra_args = {}) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fog/xenserver/requests/compute/create_server.rb', line 77

def create_server( name_label, template = nil, networks = [], extra_args = {})
  if !networks.kind_of? Array
    raise "Invalid networks argument"
  end

  if template.kind_of? String
    template_string = template
    # try template by UUID
    template = servers.templates.find { |s| s.uuid == template_string }
    if template.nil?
      # Try with the template name just in case
      template = servers.get get_vm_by_name(template_string)
    end
  end

  if template.nil?
    raise "Invalid template"
  end

  raise "Template #{template_string} does not exist" if template.allowed_operations.nil?
  raise 'Clone Operation not Allowed' unless template.allowed_operations.include?('clone')

  # Clone the VM template
  ref = clone_server name_label, template.reference
  # Add additional NICs
  networks.each do |n|
    create_vif ref, n.reference
  end
  if !extra_args[:auto_start] == false
    @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.provision'}, ref)
    start_vm( ref )
  end

  ref
end

#create_server_raw(config = {}) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fog/xenserver/requests/compute/create_server.rb', line 13

def create_server_raw(config = {})
  config[:name_label] = config[:name] if config[:name]
  config.delete :name
  config[:affinity] = config[:__affinity] if config[:__affinity]
  config.delete :__affinity
  raise ArgumentError.new("Invalid :name_label attribute") \
    if !config[:name_label]
  raise ArgumentError.new("Invalid :affinity attribute") \
    if not config[:affinity]
  config[:affinity] = config[:affinity].reference \
    if config[:affinity].kind_of? Fog::Compute::XenServer::Host
  config.reduce({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
  %w{ VCPUs_at_startup
      VCPUs_max
      VCPUs_params
      PV_bootloader_args
      PV_bootloader
      PV_kernel
      PV_ramdisk
      PV_legacy_args
      HVM_boot_policy
      HVM_boot_params
  }.each do |k|
    if config[k.downcase.to_sym]
      config[k.to_sym] = config[k.downcase.to_sym]
      config.delete k.downcase.to_sym
    end
  end
  vm_record = {
    :name_label =>              '',
    :name_description =>        'description',
    :user_version =>            '0',
    :affinity =>                '',
    :is_a_template =>           true,
    :auto_power_on =>           false,
    :memory_static_max =>       '536870912',
    :memory_static_min =>       '536870912',
    :memory_dynamic_max =>      '536870912',
    :memory_dynamic_min =>      '536870912',
    :VCPUs_params =>            {},
    :VCPUs_max =>               '1',
    :VCPUs_at_startup =>        '1',
    :actions_after_shutdown =>  'Destroy',
    :actions_after_reboot =>    'Restart',
    :actions_after_crash =>     'Restart',
    :platform =>                { 'nx' => false, 'acpi' => true, 'apic' => 'true', 'pae' => true, 'viridian' => true},
    :platform =>                {},
    :other_config =>            {},
    :pool_name =>               '',
    :PV_bootloader =>           'pygrub', #pvgrub, eliloader
    :PV_kernel =>                '',
    :PV_ramdisk =>              '',
    :PV_args =>                 '-- quiet console=hvc0',
    :PV_bootloader_args =>      '',
    :PV_legacy_args =>          '',
    :HVM_boot_policy =>         '',
    :HVM_boot_params =>         {},
    :PCI_bus =>                 '',
    :recommendations =>         '',
  }.merge config
  ref = @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.create' }, vm_record)
  ref
end

#create_sr(host_ref, name_label, type, name_description = '', device_config = {}, physical_size = '0', content_type = 'user', shared = false, sm_config = {}) ⇒ String

Create a storage repository (SR)

{ :device => /dev/sdb } for example needs confirmation) According to Citrix documentation, used only to distinguish ISO libraries from other SRs. Set it to ‘iso’ for storage repositories that store a library of ISOs, ‘user’ or ” (empty) otherwise.

Parameters:

  • host_ref (String)

    host reference

  • name_label (String)

    repository label

  • type (String)

    storage repository type

  • name_description (String) (defaults to: '')

    storage repository description

  • device_config (Hash) (defaults to: {})

    used to specify block device path, like

  • physical_size (String) (defaults to: '0')

    ‘0’ will use the whole device (FIXME

  • content_type (String) (defaults to: 'user')

    the type of the SR’s content.

  • shared (String) (defaults to: false)

Returns:

  • (String)

    an OpaqueRef to the storage repository

See Also:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/xenserver/requests/compute/create_sr.rb', line 26

def create_sr( host_ref,
               name_label,
               type,
               name_description = '',
               device_config    = {},
               physical_size    = '0',
               content_type     = 'user',
               shared           = false,
               sm_config        = {} )

  @connection.request(
    {:parser => Fog::Parsers::XenServer::Base.new, :method => 'SR.create'},
    host_ref,
    device_config || {},
    physical_size || '0',
    name_label,
    name_description || '',
    type,
    content_type,
    shared || false,
    sm_config || {}
  )
end

#create_vbd(vm_ref, vdi_ref, config = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/xenserver/requests/compute/create_vbd.rb', line 5

def create_vbd( vm_ref, vdi_ref, config = {} )
  raise ArgumentError.new('Invalid config') if config.nil?
  vm_ref = vm_ref.reference if vm_ref.kind_of? Fog::Compute::XenServer::Server
  vdi_ref = vdi_ref.reference if vdi_ref.kind_of? Fog::Compute::XenServer::VDI
  config.reject! { |k,v| (k == :server) or (k == :vdi) }
  default_config = {
    :VM => vm_ref,
    :VDI => vdi_ref,
    :empty => false,
    :other_config => {'owner' => ''},
    :userdevice => "0",
    :bootable => true,
    :mode => 'RW',
    :qos_algorithm_type=> '',
    :qos_algorithm_params=> {},
    :qos_supported_algorithms=> [],
    :type => 'Disk'
  }.merge config

  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VBD.create'}, default_config )
end

#create_vdi(config) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fog/xenserver/requests/compute/create_vdi.rb', line 5

def create_vdi( config )
  raise ArgumentError.new('Invalid config') if config.nil?
  raise ArgumentError.new('Missing virtual_size attribute') if config[:virtual_size].nil?
  raise ArgumentError.new('Missing read_only attribute') if config[:read_only].nil?
  raise ArgumentError.new('Missing type attribute') if config[:type].nil?
  raise ArgumentError.new('Missing sharable attribute') if config[:sharable].nil?
  raise ArgumentError.new('Missing other_config attribute') if config[:other_config].nil?
  raise ArgumentError.new('Missing storage_repository attribute') if config[:storage_repository].nil?
  config[:SR] = config[:storage_repository].reference
  config[:name_label] = config[:name]
  config[:name_description] = config[:description] if config[:description]
  config.reject! { |k,v| (k == :__sr) or (k == :storage_repository) }
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VDI.create'}, config )
end

#create_vif(vm_ref, network_ref, device = -1)) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
# File 'lib/fog/xenserver/requests/compute/create_vif.rb', line 5

def create_vif( vm_ref, network_ref, device = -1)
  raise ArgumentError.new('Invalid vm_ref') if vm_ref.nil?
  raise ArgumentError.new('Invalid network_ref') if network_ref.nil?
  vm_ref = vm_ref.reference if vm_ref.kind_of? Fog::Model
  network_ref = network_ref.reference if network_ref.kind_of? Fog::Model
  vif_config = default_vif_config(vm_ref, network_ref, device.to_s)
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VIF.create'}, vif_config )
end

#create_vif_custom(conf) ⇒ Object

Raises:

  • (ArgumentError)


14
15
16
17
# File 'lib/fog/xenserver/requests/compute/create_vif.rb', line 14

def create_vif_custom( conf )
  raise ArgumentError.new('VIF config is not a Hash') if not conf.kind_of?(Hash)
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VIF.create'}, conf )
end

#create_vlan(pif_ref, vlan_id, network_ref) ⇒ Object

Create a VLAN



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/xenserver/requests/compute/create_vlan.rb', line 10

def create_vlan( pif_ref, vlan_id, network_ref )
  @connection.request(
    {
      :parser => Fog::Parsers::XenServer::Base.new,
      :method => 'VLAN.create'
    },
    pif_ref,
    vlan_id.to_s,
    network_ref
  )
end

#default_networkObject



141
142
143
# File 'lib/fog/xenserver/compute.rb', line 141

def default_network
  networks.find { |n| n.name == (@defaults[:network] || "Pool-wide network associated with eth0") }
end

#default_templateObject



134
135
136
137
138
139
# File 'lib/fog/xenserver/compute.rb', line 134

def default_template
  return nil if @defaults[:template].nil?
  (servers.custom_templates + servers.builtin_templates).find do |s|
    (s.name == @defaults[:template]) or (s.uuid == @defaults[:template])
  end
end

#default_template=(name) ⇒ Object



130
131
132
# File 'lib/fog/xenserver/compute.rb', line 130

def default_template=(name)
  @defaults[:template] = name
end

#default_vif_config(vm_ref, network_ref, device_number = '-1') ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/xenserver/requests/compute/create_vif.rb', line 19

def default_vif_config( vm_ref, network_ref, device_number = '-1' )
  conf = {
    'MAC_autogenerated' => 'True',
    'VM' => vm_ref,
    'network' => network_ref,
    'MAC' => '',
    'MTU' => '0',
    'other_config' => {},
    'qos_algorithm_type' => 'ratelimit',
    'qos_algorithm_params' => {}
  }
  if device_number.to_i >= 0
    conf['device'] = device_number
  else
    highest_dev = 0
    server = servers.get vm_ref
    server.vifs.each do |vif|
      dev = vif.device.to_i
      highest_dev = dev if dev > highest_dev
    end
    conf['device'] = (highest_dev + 1).to_s
  end
  conf
end

#destroy_network(ref) ⇒ Object

Destroy a Network



10
11
12
13
14
15
16
17
18
# File 'lib/fog/xenserver/requests/compute/destroy_network.rb', line 10

def destroy_network( ref )
  @connection.request(
    {
      :parser => Fog::Parsers::XenServer::Base.new,
      :method => 'network.destroy'
    },
    ref
  )
end

#destroy_server(vm_ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/destroy_server.rb', line 5

def destroy_server( vm_ref , extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.destroy'}, vm_ref)
end

#destroy_sr(sr_ref) ⇒ Object



10
11
12
13
14
15
# File 'lib/fog/xenserver/requests/compute/destroy_sr.rb', line 10

def destroy_sr( sr_ref )
  @connection.request(
    {:parser => Fog::Parsers::XenServer::Base.new, :method => 'SR.destroy'},
    sr_ref
  )
end

#destroy_vdi(vdi_ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/destroy_vdi.rb', line 5

def destroy_vdi( vdi_ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VDI.destroy'}, vdi_ref)
end

#destroy_vif(ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/destroy_vif.rb', line 5

def destroy_vif( ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VIF.destroy'}, ref)
end

#destroy_vlan(ref) ⇒ Object

Destroy a VLAN



9
10
11
12
13
14
15
16
17
# File 'lib/fog/xenserver/requests/compute/destroy_vlan.rb', line 9

def destroy_vlan( ref )
  @connection.request(
    {
      :parser => Fog::Parsers::XenServer::Base.new,
      :method => 'VLAN.destroy'
    },
    ref
  )
end

#disable_host(ref) ⇒ Object

Puts the host into a state in which no new VMs can be started. Currently active VMs on the host continue to execute.



11
12
13
# File 'lib/fog/xenserver/requests/compute/disable_host.rb', line 11

def disable_host( ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "host.disable"}, ref)
end

#eject_vbd(ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/eject_vbd.rb', line 5

def eject_vbd(ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VBD.eject'}, ref)
end

#enable_host(ref) ⇒ Object

Puts the host into a state in which VMs can be started.



10
11
12
# File 'lib/fog/xenserver/requests/compute/enable_host.rb', line 10

def enable_host( ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "host.enable"}, ref)
end

#get_record(ref, klass, options = {}) ⇒ Object



7
8
9
# File 'lib/fog/xenserver/requests/compute/get_record.rb', line 7

def get_record( ref, klass, options = {} )
  get_record_by_ref ref, klass, options
end

#get_record_by_ref(ref, klass, options = {}) ⇒ Object



11
12
13
# File 'lib/fog/xenserver/requests/compute/get_record.rb', line 11

def get_record_by_ref( ref, klass, options = {} )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "#{klass}.get_record"}, ref).merge(:reference => ref)
end

#get_records(klass, options = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/fog/xenserver/requests/compute/get_records.rb', line 7

def get_records( klass, options = {} )
  begin
    res = @connection.request(:parser => Fog::Parsers::XenServer::GetRecords.new, :method => "#{klass}.get_all_records")
    res
  rescue Fog::XenServer::RequestFailed => e
    []
  end
end

#get_vm_by_name(label) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/create_server.rb', line 5

def get_vm_by_name(label)
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.get_by_name_label' }, label)
end

#get_vm_by_uuid(uuid) ⇒ Object



9
10
11
# File 'lib/fog/xenserver/requests/compute/create_server.rb', line 9

def get_vm_by_uuid(uuid)
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.get_by_uuid' }, uuid)
end

#insert_vbd(ref, vdi_ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/insert_vbd.rb', line 5

def insert_vbd(ref, vdi_ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VBD.insert'}, ref, vdi_ref)
end

#provision_server(ref) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/provision_server.rb', line 5

def provision_server( ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.provision'}, ref)
end

#reboot_host(ref) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/reboot_host.rb', line 5

def reboot_host( ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "host.reboot"}, ref)
end

#reboot_server(ref, stype = 'clean') ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/reboot_server.rb', line 5

def reboot_server( ref, stype = 'clean' )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "VM.#{stype}_reboot"}, ref)
end

#reloadObject



126
127
128
# File 'lib/fog/xenserver/compute.rb', line 126

def reload
  @connection.authenticate(@username, @password)
end

#scan_sr(ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/scan_sr.rb', line 5

def scan_sr( ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'SR.scan'}, ref)
end

#set_affinity(host_ref) ⇒ Object



7
8
9
# File 'lib/fog/xenserver/requests/compute/set_affinity.rb', line 7

def set_affinity( host_ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.set_affinity'}, host_ref)
end

#set_attribute(klass, ref, attr_name, *value) ⇒ Object



7
8
9
# File 'lib/fog/xenserver/requests/compute/set_attribute.rb', line 7

def set_attribute( klass, ref, attr_name, *value )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "#{klass}.set_#{attr_name.gsub('-','_')}"}, ref, *value)
end

#shutdown_host(ref) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/shutdown_host.rb', line 5

def shutdown_host( ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "host.shutdown"}, ref)
end

#shutdown_server(vm_ref, stype = 'clean') ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/shutdown_server.rb', line 5

def shutdown_server( vm_ref, stype = 'clean' )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => "VM.#{stype}_shutdown"}, vm_ref)
end

#snapshot_revert(snapshot_ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/snapshot_revert.rb', line 5

def snapshot_revert( snapshot_ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.revert'}, snapshot_ref)
end

#snapshot_server(vm_ref, name, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/snapshot_server.rb', line 5

def snapshot_server( vm_ref , name, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.snapshot'}, vm_ref, name)
end

#start_server(vm_ref) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/start_server.rb', line 5

def start_server( vm_ref )
  start_vm( vm_ref )
end

#start_vm(vm_ref) ⇒ Object

bit.ly/8ZPyCN VM.start( session, VM_ref, start_paused, force)



7
8
9
# File 'lib/fog/xenserver/requests/compute/start_vm.rb', line 7

def start_vm( vm_ref )
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VM.start'}, vm_ref, false, false)
end

#unplug_force_vbd(ref, extra_args = {}) ⇒ Object



9
10
11
# File 'lib/fog/xenserver/requests/compute/unplug_vbd.rb', line 9

def unplug_force_vbd(ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VBD.unplug_force'}, ref)
end

#unplug_pbd(ref) ⇒ Object



5
6
7
8
9
10
# File 'lib/fog/xenserver/requests/compute/unplug_pbd.rb', line 5

def unplug_pbd( ref )
  @connection.request(
    {:parser => Fog::Parsers::XenServer::Base.new, :method => 'PBD.unplug'},
    ref
  )
end

#unplug_vbd(vbd_ref, extra_args = {}) ⇒ Object



5
6
7
# File 'lib/fog/xenserver/requests/compute/unplug_vbd.rb', line 5

def unplug_vbd( vbd_ref, extra_args = {})
  @connection.request({:parser => Fog::Parsers::XenServer::Base.new, :method => 'VBD.unplug'}, vbd_ref)
end