Merge "Add port group mode to manageable servers"
This commit is contained in:
commit
4be116f70e
@ -17,6 +17,7 @@
|
|||||||
{
|
{
|
||||||
"address": "a4:dc:be:0e:82:a6",
|
"address": "a4:dc:be:0e:82:a6",
|
||||||
"uuid": "1ec01153-685a-49b5-a6d3-45a4e7dddf54",
|
"uuid": "1ec01153-685a-49b5-a6d3-45a4e7dddf54",
|
||||||
|
"mode": "active-backup",
|
||||||
"neutron_port_id": "a9b94592-1d8e-46bb-836b-c7ba935b0137"
|
"neutron_port_id": "a9b94592-1d8e-46bb-836b-c7ba935b0137"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -128,18 +128,27 @@ class IronicDriver(base_driver.BaseEngineDriver):
|
|||||||
|
|
||||||
return dic
|
return dic
|
||||||
|
|
||||||
def _port_or_group_resource(self, port_or_pg):
|
def _port_resource(self, port):
|
||||||
"""Helper method to create resource dict from port or portgroup
|
"""Helper method to create resource dict from port stats."""
|
||||||
|
|
||||||
stats.
|
neutron_port_id = (port.internal_info.get(TENANT_VIF_KEY) or
|
||||||
|
port.extra.get(VIF_KEY))
|
||||||
"""
|
|
||||||
|
|
||||||
neutron_port_id = (port_or_pg.internal_info.get(TENANT_VIF_KEY) or
|
|
||||||
port_or_pg.extra.get(VIF_KEY))
|
|
||||||
dic = {
|
dic = {
|
||||||
'address': port_or_pg.address,
|
'address': port.address,
|
||||||
'uuid': port_or_pg.uuid,
|
'uuid': port.uuid,
|
||||||
|
'neutron_port_id': neutron_port_id,
|
||||||
|
}
|
||||||
|
return dic
|
||||||
|
|
||||||
|
def _portgroup_resource(self, portgroup):
|
||||||
|
"""Helper method to create resource dict from portgroup stats. """
|
||||||
|
|
||||||
|
neutron_port_id = (portgroup.internal_info.get(TENANT_VIF_KEY) or
|
||||||
|
portgroup.extra.get(VIF_KEY))
|
||||||
|
dic = {
|
||||||
|
'address': portgroup.address,
|
||||||
|
'uuid': portgroup.uuid,
|
||||||
|
'mode': portgroup.mode,
|
||||||
'neutron_port_id': neutron_port_id,
|
'neutron_port_id': neutron_port_id,
|
||||||
}
|
}
|
||||||
return dic
|
return dic
|
||||||
@ -465,11 +474,11 @@ class IronicDriver(base_driver.BaseEngineDriver):
|
|||||||
if node.resource_class is None:
|
if node.resource_class is None:
|
||||||
continue
|
continue
|
||||||
# Add ports to the associated node
|
# Add ports to the associated node
|
||||||
node.ports = [self._port_or_group_resource(port)
|
node.ports = [self._port_resource(port)
|
||||||
for port in port_list
|
for port in port_list
|
||||||
if node.uuid == port.node_uuid]
|
if node.uuid == port.node_uuid]
|
||||||
# Add portgroups to the associated node
|
# Add portgroups to the associated node
|
||||||
node.portgroups = [self._port_or_group_resource(portgroup)
|
node.portgroups = [self._portgroup_resource(portgroup)
|
||||||
for portgroup in portgroup_list
|
for portgroup in portgroup_list
|
||||||
if node.uuid == portgroup.node_uuid]
|
if node.uuid == portgroup.node_uuid]
|
||||||
node_resources[node.uuid] = self._node_resource(node)
|
node_resources[node.uuid] = self._node_resource(node)
|
||||||
@ -815,11 +824,11 @@ class IronicDriver(base_driver.BaseEngineDriver):
|
|||||||
portgroup_list = self.ironicclient.call("portgroup.list", **params)
|
portgroup_list = self.ironicclient.call("portgroup.list", **params)
|
||||||
|
|
||||||
# Add ports to the associated node
|
# Add ports to the associated node
|
||||||
node.ports = [self._port_or_group_resource(port)
|
node.ports = [self._port_resource(port)
|
||||||
for port in port_list
|
for port in port_list
|
||||||
if node.uuid == port.node_uuid]
|
if node.uuid == port.node_uuid]
|
||||||
# Add portgroups to the associated node
|
# Add portgroups to the associated node
|
||||||
node.portgroups = [self._port_or_group_resource(portgroup)
|
node.portgroups = [self._portgroup_resource(portgroup)
|
||||||
for portgroup in portgroup_list
|
for portgroup in portgroup_list
|
||||||
if node.uuid == portgroup.node_uuid]
|
if node.uuid == portgroup.node_uuid]
|
||||||
node.power_state = map_power_state(node.power_state)
|
node.power_state = map_power_state(node.power_state)
|
||||||
|
Loading…
Reference in New Issue
Block a user