Class: WeBee::Machine

Inherits:
Object
  • Object
show all
Includes:
SAXMachine
Defined in:
lib/webee.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SAXMachine

#old_parse, #parse

Instance Attribute Details

#datacenter_idObject

Returns the value of attribute datacenter_id.



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

def datacenter_id
  @datacenter_id
end

#rawObject

Returns the value of attribute raw.



364
365
366
# File 'lib/webee.rb', line 364

def raw
  @raw
end

Instance Method Details

#to_xmlObject



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/webee.rb', line 393

def to_xml
  xm = Builder::XmlMarkup.new
  xm.machine {
    xm.name name
    xm.description description
    xm.ip ip
    xm.ipService ip_service
    xm.user user
    xm.password password
    xm.realCpu real_cpu
    xm.realHd real_hd
    xm.realRam real_ram
    xm.state state
    xm.type hypervisortype
    xm.cpu cpu
    xm.cpuRatio cpu_ratio
    xm.cpuUsed cpu_used
    xm.hd hd
    xm.hdUsed hd_used
    xm.ram ram
    xm.ramUsed ram_used
    xm.virtualSwitch virtual_switch
    xm.datastores {
      datastores.each do |ds|
        xm.datastore {
          xm.name ds.name
          xm.directory ds.directory
          xm.rootPath ds.root_path
          xm.enabled ds.enabled
          xm.size ds.size
          xm.usedSize ds.used_size
        }
      end
    }
  }
  xm.target!
end

#virtual_switchesObject



389
390
391
# File 'lib/webee.rb', line 389

def virtual_switches
  virtual_switch.split('/')
end