ExtractProvisionNode adding resource_class if its possible
Currently the tripleo-STACK-baremetal.yaml includes the instances
of the Roles but it does not include the resource_class.
This patch add the resource_class to the instance when is possible.
Change-Id: I4601b2335c1102dc5e462fe74646acf6166c785c
(cherry picked from commit 269fa30b50
)
This commit is contained in:
parent
23dbe54cd5
commit
94bdb3f812
|
@ -808,9 +808,13 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
mock.Mock()
|
||||
]
|
||||
self.nodes[0].name = 'bm-0'
|
||||
self.nodes[0].resource_class = 'controller'
|
||||
self.nodes[1].name = 'bm-1'
|
||||
self.nodes[1].resource_class = 'controller'
|
||||
self.nodes[2].name = 'bm-2'
|
||||
self.nodes[2].resource_class = None
|
||||
self.nodes[3].name = 'bm-3'
|
||||
self.nodes[3].resource_class = 'compute'
|
||||
|
||||
self.nodes[0].instance_info = {
|
||||
'display_name': 'overcloud-controller-0'}
|
||||
|
@ -912,7 +916,6 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
self.orchestration.stacks.get.return_value = stack
|
||||
|
||||
self.baremetal.node.list.return_value = self.nodes
|
||||
|
||||
argslist = ['--output', self.extract_file.name,
|
||||
'--yes']
|
||||
self.app.command_options = argslist
|
||||
|
@ -940,7 +943,8 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
},
|
||||
'instances': [{
|
||||
'hostname': 'overcloud-novacompute-0',
|
||||
'name': 'bm-3'
|
||||
'name': 'bm-3',
|
||||
'resource_class': 'compute',
|
||||
}],
|
||||
}, {
|
||||
'name': 'Controller',
|
||||
|
@ -962,10 +966,12 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
},
|
||||
'instances': [{
|
||||
'hostname': 'overcloud-controller-0',
|
||||
'name': 'bm-0'
|
||||
'name': 'bm-0',
|
||||
'resource_class': 'controller',
|
||||
}, {
|
||||
'hostname': 'overcloud-controller-1',
|
||||
'name': 'bm-1'
|
||||
'name': 'bm-1',
|
||||
'resource_class': 'controller',
|
||||
}, {
|
||||
'hostname': 'overcloud-controller-2',
|
||||
'name': 'bm-2'
|
||||
|
@ -989,7 +995,6 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
self.orchestration.stacks.get.return_value = stack
|
||||
|
||||
self.baremetal.node.list.return_value = self.nodes
|
||||
|
||||
argslist = ['--roles-file', self.roles_file.name,
|
||||
'--output', self.extract_file.name,
|
||||
'--yes']
|
||||
|
@ -1020,6 +1025,7 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
'instances': [{
|
||||
'hostname': 'overcloud-novacompute-0',
|
||||
'name': 'bm-3',
|
||||
'resource_class': 'compute',
|
||||
'networks': [{'fixed_ip': '192.168.26.11',
|
||||
'network': 'ctlplane',
|
||||
'vif': True},
|
||||
|
@ -1048,6 +1054,7 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
'instances': [{
|
||||
'hostname': 'overcloud-controller-0',
|
||||
'name': 'bm-0',
|
||||
'resource_class': 'controller',
|
||||
'networks': [{'fixed_ip': '192.168.25.21',
|
||||
'network': 'ctlplane',
|
||||
'vif': True},
|
||||
|
@ -1060,6 +1067,7 @@ class TestExtractProvisionedNode(test_utils.TestCommand):
|
|||
}, {
|
||||
'hostname': 'overcloud-controller-1',
|
||||
'name': 'bm-1',
|
||||
'resource_class': 'controller',
|
||||
'networks': [{'fixed_ip': '192.168.25.25',
|
||||
'network': 'ctlplane',
|
||||
'vif': True},
|
||||
|
|
|
@ -557,10 +557,13 @@ class ExtractProvisionedNode(command.Command):
|
|||
# list all baremetal nodes and map hostname to node name
|
||||
node_details = self.baremetal_client.node.list(detail=True)
|
||||
hostname_node_map = {}
|
||||
hostname_node_resource = {}
|
||||
for node in node_details:
|
||||
hostname = node.instance_info.get('display_name')
|
||||
if hostname and node.name:
|
||||
hostname_node_map[hostname] = node.name
|
||||
if hostname and node.resource_class:
|
||||
hostname_node_resource[hostname] = node.resource_class
|
||||
|
||||
data = []
|
||||
for role_name, entries in host_vars.items():
|
||||
|
@ -646,6 +649,9 @@ class ExtractProvisionedNode(command.Command):
|
|||
if entry in hostname_node_map:
|
||||
instance['name'] = hostname_node_map[entry]
|
||||
|
||||
if entry in hostname_node_resource:
|
||||
instance['resource_class'] = hostname_node_resource[entry]
|
||||
|
||||
if ips_from_pool:
|
||||
instance['networks'] = copy.deepcopy(role_networks)
|
||||
for net in instance['networks']:
|
||||
|
|
Loading…
Reference in New Issue