Class: IbmPowerHmc::PartitionTemplate
Constant Summary
collapse
- ATTRS =
{
:name => "partitionTemplateName",
:description => "description",
:lpar_name => "logicalPartitionConfig/partitionName",
:lpar_type => "logicalPartitionConfig/partitionType",
:lpar_id => "logicalPartitionConfig/partitionId",
:os => "logicalPartitionConfig/osVersion",
:memory => "logicalPartitionConfig/memoryConfiguration/currMemory",
:shared_mem => "logicalPartitionConfig/memoryConfiguration/isSharedMemory",
:dedicated => "logicalPartitionConfig/processorConfiguration/hasDedicatedProcessors",
:sharing_mode => "logicalPartitionConfig/processorConfiguration/sharingMode",
:vprocs => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredVirtualProcessors",
:proc_units => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/desiredProcessingUnits",
:pool_id => "logicalPartitionConfig/processorConfiguration/sharedProcessorConfiguration/sharedProcessorPoolId",
:procs => "logicalPartitionConfig/processorConfiguration/dedicatedProcessorConfiguration/desiredProcessors"
}.freeze
Instance Attribute Summary
Attributes inherited from AbstractRest
#content_type, #etag, #href, #published, #uuid
#xml
Instance Method Summary
collapse
#initialize, #to_s
#collection_of, #create_element, #initialize, marshal, #marshal, #singleton, #timestamp, #to_s, #uuid_from_href, #uuids_from_links
Instance Method Details
#vfc ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 58
def vfc
REXML::XPath.match(xml, 'logicalPartitionConfig/virtualFibreChannelClientAdapters/VirtualFibreChannelClientAdapter').map do |adap|
{
:vios => adap.elements['connectingPartitionName']&.text,
:port => adap.elements['portName']&.text
}
end
end
|
#vfc=(list = []) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 67
def vfc=(list = [])
adaps = REXML::Element.new('virtualFibreChannelClientAdapters')
adaps.add_attribute('schemaVersion', 'V1_5_0')
list.each do |vfc|
adaps.add_element('VirtualFibreChannelClientAdapter', {'schemaVersion' => 'V1_5_0'}).tap do |v|
v.add_element('connectingPartitionName').text = vfc[:vios]
v.add_element('portName').text = vfc[:port]
end
end
if xml.elements['logicalPartitionConfig/virtualFibreChannelClientAdapters']
xml.elements['logicalPartitionConfig/virtualFibreChannelClientAdapters'] = adaps
else
xml.elements['logicalPartitionConfig'].add_element(adaps)
end
end
|
#vlans ⇒ Object
83
84
85
86
87
88
89
90
91
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 83
def vlans
REXML::XPath.match(xml, 'logicalPartitionConfig/clientNetworkAdapters/ClientNetworkAdapter/clientVirtualNetworks/ClientVirtualNetwork').map do |vlan|
{
:name => vlan.elements['name']&.text,
:vlan_id => vlan.elements['vlanId']&.text,
:switch => vlan.elements['associatedSwitchName']&.text
}
end
end
|
#vlans=(list = []) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 93
def vlans=(list = [])
adaps = REXML::Element.new('clientNetworkAdapters')
adaps.add_attribute('schemaVersion', 'V1_5_0')
list.each do |vlan|
adaps.add_element('ClientNetworkAdapter', {'schemaVersion' => 'V1_5_0'})
.add_element('clientVirtualNetworks', {'schemaVersion' => 'V1_5_0'})
.add_element('ClientVirtualNetwork', {'schemaVersion' => 'V1_5_0'})
.tap do |v|
v.add_element('name').text = vlan[:name]
v.add_element('vlanId').text = vlan[:vlan_id]
v.add_element('associatedSwitchName').text = vlan[:switch]
end
end
xml.elements['logicalPartitionConfig/clientNetworkAdapters'] = adaps
end
|
#vscsi ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 28
def vscsi
REXML::XPath.match(xml, 'logicalPartitionConfig/virtualSCSIClientAdapters/VirtualSCSIClientAdapter').map do |adap|
{
:vios => adap.elements['connectingPartitionName']&.text,
:physvol => adap.elements['associatedPhysicalVolume/PhysicalVolume/name']&.text,
}
end
end
|
#vscsi=(list = []) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/ibm_power_hmc/schema/templates.rb', line 37
def vscsi=(list = [])
adaps = REXML::Element.new('virtualSCSIClientAdapters')
adaps.add_attribute('schemaVersion', 'V1_5_0')
list.each do |vscsi|
adaps.add_element('VirtualSCSIClientAdapter', {'schemaVersion' => 'V1_5_0'}).tap do |v|
v.add_element('associatedLogicalUnits', {'schemaVersion' => 'V1_5_0'})
v.add_element('associatedPhysicalVolume', {'schemaVersion' => 'V1_5_0'}).tap do |e|
e.add_element('PhysicalVolume', {'schemaVersion' => 'V1_5_0'}).add_element('name').text = vscsi[:physvol] if vscsi[:physvol]
end
v.add_element('connectingPartitionName').text = vscsi[:vios]
v.add_element('AssociatedTargetDevices', {'schemaVersion' => 'V1_5_0'})
v.add_element('associatedVirtualOpticalMedia', {'schemaVersion' => 'V1_5_0'})
end
end
if xml.elements['logicalPartitionConfig/virtualSCSIClientAdapters']
xml.elements['logicalPartitionConfig/virtualSCSIClientAdapters'] = adaps
else
xml.elements['logicalPartitionConfig'].add_element(adaps)
end
end
|