1 # Copyright (c) 2017 Intel Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 def do_find_fuel_nodes(fuel_nodes):
17 for fuel_node in fuel_nodes:
18 if 'controller' in fuel_node['roles']:
19 ips.setdefault("controller_ids", []).append(fuel_node['id'])
20 ips.setdefault("controllers_ips", []).append(fuel_node['ip'])
21 if 'compute' in fuel_node['roles']:
22 ips.setdefault("compute_ids", []).append(fuel_node['id'])
23 ips.setdefault("computes_ips", []).append(fuel_node['ip'])
26 # def do_find_fuel_nodes(fuel_output):
28 # for l in fuel_output.splitlines():
30 # if 'controller' in l:
31 # ips["controller_ids"] = splits[0]
32 # ips["controllers_ips"] = splits[9]
34 # ips["compute_ids"] = splits[0]
35 # ips["computes_ips"] = splits[9]
39 class FilterModule(object):
42 'find_fuel_nodes': do_find_fuel_nodes,
47 id | status | name | cluster | ip | mac | roles | pending_roles | online | group_id
48 ---+--------+------------------+---------+-----------+-------------------+----------------------+---------------+--------+---------
49 4 | ready | Untitled (9a:b1) | 1 | 10.20.0.6 | 0c:c4:7a:75:9a:b1 | ceph-osd, compute | | 1 | 1
50 1 | ready | Untitled (9a:ab) | 1 | 10.20.0.4 | 0c:c4:7a:75:9a:ab | ceph-osd, controller | | 1 | 1
51 5 | ready | Untitled (9a:1b) | 1 | 10.20.0.7 | 0c:c4:7a:75:9a:1b | ceph-osd, compute | | 1 | 1
52 2 | ready | Untitled (9a:67) | 1 | 10.20.0.3 | 0c:c4:7a:75:9a:67 | controller | | 1 | 1
53 3 | ready | Untitled (99:d7) | 1 | 10.20.0.5 | 0c:c4:7a:75:99:d7 | controller, mongo | | 1 | 1