Module: XmlMsHyperVConfig
- Defined in:
- lib/metadata/VmConfig/xmlMsHyperVConfig.rb
Instance Method Summary collapse
- #controller0(element) ⇒ Object
- #global_id(element) ⇒ Object
- #memory(element) ⇒ Object
- #parse_create_time(filename) ⇒ Object
- #processors(element) ⇒ Object
-
#properties(element) ⇒ Object
def logical_id(element) add_item(‘displayName’, element.text) end.
- #vendor ⇒ Object
Instance Method Details
#controller0(element) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 24 def controller0(element) element.each_element do |drive| next if drive.name[0, 5] != 'drive' if drive.elements['type'].text == 'VHD' add_item("ide0:#{drive.name.reverse.to_i}.fileName", drive.elements['pathname'].text) end end end |
#global_id(element) ⇒ Object
20 21 22 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 20 def global_id(element) add_item('ems.uid', element.text) end |
#memory(element) ⇒ Object
12 13 14 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 12 def memory(element) add_item("memsize", element.elements[1].elements[1].text) end |
#parse_create_time(filename) ⇒ Object
33 34 35 36 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 33 def parse_create_time(filename) name = File.basename(filename, ".*").split("_")[-1] Time.parse("#{name[10..13]}-#{name[6..7]}-#{name[8..9]}T#{name[0..1]}:#{name[2..3]}:#{name[4..5]}").utc end |
#processors(element) ⇒ Object
16 17 18 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 16 def processors(element) add_item("numvcpu", element.elements['count'].text) end |
#properties(element) ⇒ Object
def logical_id(element)
add_item('displayName', element.text)
end
8 9 10 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 8 def properties(element) add_item('displayName', element.elements['name'].text) end |
#vendor ⇒ Object
38 39 40 |
# File 'lib/metadata/VmConfig/xmlMsHyperVConfig.rb', line 38 def vendor "microsoft" end |