12
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
|
# File 'lib/fog/parsers/compute/voxel/devices_list.rb', line 12
def start_element(name, attrs = [])
super
case name
when "accessmethod"
@access_method = { "type" => attr_value("type", attrs) }
when "accessmethods"
@device["access_methods"] = []
when "device"
@device = {
"id" => attr_value("id", attrs),
"label" => attr_value("label", attrs),
"status" => attr_value("status", attrs)
}
when "err"
@response["err"] = {
"code" => attr_value("code", attrs),
"msg" => attr_value("msg", attrs)
}
when "cage", "facility", "rack", "row", "zone"
@device["location"][name] = { "id" => attr_value("id", attrs) }
if code = attr_value("code", attrs)
@device["location"][name]["code"] = code
end
when "drive"
@drive = { "position" => attr_value("position", attrs) }
when "ipassignment"
@device["ipassignments"] = []
@device["ipassignments"] << {
"id" => attr_value("id", attrs),
"type" => attr_value("type", attrs),
"description" => attr_value("description", attrs),
}
when "ipassignments"
@device["ipassignments"] = {}
when "location"
@device["location"] = {}
when "memory"
@device["memory"] = { "size" => attr_value("size", attrs).to_i }
when "model", "type"
@device[name] = { "id" => attr_value("id", attrs) }
when "operating_system"
@device["operating_system"] = {}
when "power_consumption"
@device[name] = attr_value("unit", attrs)
when "processor"
@device["processor"] = {}
when "rsp"
@response["stat"] = attr_value("stat", attrs)
when "storage"
@device["drives"] = []
end
end
|