Class: Pangea::VM

Inherits:
XObject show all
Defined in:
lib/pangea/objects.rb

Overview

A Virtual Machine or Guest (DomU)

xen-api: VM

Instance Method Summary collapse

Methods inherited from XObject

#ref_call, #uuid

Constructor Details

#initialize(link, ref) ⇒ VM

:nodoc:



323
324
325
326
# File 'lib/pangea/objects.rb', line 323

def initialize(link, ref) #:nodoc:
  super(link, ref)
  @proxy_name = 'VM'
end

Instance Method Details

#actions_after_crashObject

xen-api: VM.get_actions_after_crash



444
445
446
# File 'lib/pangea/objects.rb', line 444

def actions_after_crash
  ref_call :get_actions_after_crash
end

#actions_after_rebootObject

xen-api: VM.get_actions_after_reboot



437
438
439
# File 'lib/pangea/objects.rb', line 437

def actions_after_reboot
  ref_call :get_actions_after_reboot
end

#actions_after_shutdownObject

xen-api: VM.get_actions_after_shutdown



423
424
425
# File 'lib/pangea/objects.rb', line 423

def actions_after_shutdown
  ref_call :get_actions_after_shutdown
end

#domidObject

xen-api: VM.get_domid



402
403
404
# File 'lib/pangea/objects.rb', line 402

def domid
  (ref = ref_call :get_domid).to_i
end

#dyn_max_memObject



376
377
378
# File 'lib/pangea/objects.rb', line 376

def dyn_max_mem
  ref_call :get_memory_dynamic_max
end

#dyn_min_memObject



380
381
382
# File 'lib/pangea/objects.rb', line 380

def dyn_min_mem
  ref_call :get_memory_dynamic_min
end

#guest_metricsObject

xen-api: VM.get_guest_metrics



347
348
349
# File 'lib/pangea/objects.rb', line 347

def guest_metrics
  VMGuestMetrics.new(@link, ref_call(:get_guest_metrics))
end

#is_control_domain?Boolean

xen-api: VM.get_is_control_domain

Returns:

  • (Boolean)


409
410
411
# File 'lib/pangea/objects.rb', line 409

def is_control_domain?
  ref_call :get_is_control_domain
end

#labelObject

VM Label (same one you see when you run ‘xm list’)

xen-api: VM.get_name_label



333
334
335
# File 'lib/pangea/objects.rb', line 333

def label
  ref_call :get_name_label
end

#max_memObject

xen-api: VM.get_memory_static_max



372
373
374
# File 'lib/pangea/objects.rb', line 372

def max_mem
  ref_call :get_memory_static_max
end

#metricsObject

xen-api: VM.get_metrics



340
341
342
# File 'lib/pangea/objects.rb', line 340

def metrics
  VMMetrics.new(@link, ref_call(:get_metrics))
end

#min_memObject

xen-api: VM.get_memory_static_min



387
388
389
# File 'lib/pangea/objects.rb', line 387

def min_mem
  ref_call :get_memory_static_min
end

#power_stateObject

xen-api: VM.get_power_state



365
366
367
# File 'lib/pangea/objects.rb', line 365

def power_state
  ref_call :get_power_state
end

#pv_kernelObject

xen-api: VM.get_pv_kernel



430
431
432
# File 'lib/pangea/objects.rb', line 430

def pv_kernel
  ref_call :get_PV_kernel
end

#resident_onObject

xen-api: VM.get_resident_on



394
395
396
397
# File 'lib/pangea/objects.rb', line 394

def resident_on
  ref = ref_call(:get_resident_on)
  Host.new(@link, ref)
end

#to_sObject



448
449
450
451
452
453
454
455
# File 'lib/pangea/objects.rb', line 448

def to_s
  eol = "\n"
  "Label: #{label}" + eol +
  "UUID: #{uuid}" + eol +
  "Power State: #{power_state}" + eol +
  "Mem: #{Util::humanize_bytes(dyn_min_mem)}" + eol +
  "Max Mem: #{Util::humanize_bytes(max_mem)}" + eol
end

#vifsObject

xen-api: VM.get_VIFs



354
355
356
357
358
359
360
# File 'lib/pangea/objects.rb', line 354

def vifs
  list = []
  ref_call(:get_VIFs).each do |vif|
    list << VIF.new(@link, vif)
  end
  list
end