Merge "Rework: Move nailgun timeout patch to postinstall"
[armband.git] / patches / opnfv-fuel / 0019-deploy-ipmi-adapter-Add-port-config-support.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Mon, 23 May 2016 22:06:09 +0200
3 Subject: [PATCH] deploy: ipmi adapter: Add <port> config support.
4
5 Sometimes the IPMI lanplus protocol listens on a non-standard
6 remote port, e.g. when target nodes are interfaced through a
7 fake IPMI BMC application that listens on multiple ports on the
8 same IP address.
9
10 Therefore, allow setting IPMI port in the DHA using a new
11 property named `ipmiPort`, and pass it along to `ipmitool` when set.
12
13 CHANGE: get_access_info now also supports specifying the IPMI
14 port to use with `ipmitool` by configuring the `ipmiPort`
15 property in the DHA.
16
17 hp_adapter.py: updated `get_access_info` return signature with
18 the new (unused there) `ipmiport`.
19
20 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
21 ---
22  deploy/dha_adapters/hp_adapter.py   | 2 +-
23  deploy/dha_adapters/ipmi_adapter.py | 7 +++++--
24  deploy/reap.py                      | 2 ++
25  3 files changed, 8 insertions(+), 3 deletions(-)
26
27 diff --git a/deploy/dha_adapters/hp_adapter.py b/deploy/dha_adapters/hp_adapter.py
28 index 13bb349..6434da8 100644
29 --- a/deploy/dha_adapters/hp_adapter.py
30 +++ b/deploy/dha_adapters/hp_adapter.py
31 @@ -29,7 +29,7 @@ class HpAdapter(IpmiAdapter):
32  
33      def node_set_boot_order(self, node_id, boot_order_list):
34          log('Set boot order %s on Node %s' % (boot_order_list, node_id))
35 -        ip, username, password = self.get_access_info(node_id)
36 +        ip, username, password, ipmiport = self.get_access_info(node_id)
37          ssh = SSHClient(ip, username, password)
38          with ssh as s:
39              for order, dev in enumerate(boot_order_list):
40 diff --git a/deploy/dha_adapters/ipmi_adapter.py b/deploy/dha_adapters/ipmi_adapter.py
41 index 283bd57..f4f2e6a 100644
42 --- a/deploy/dha_adapters/ipmi_adapter.py
43 +++ b/deploy/dha_adapters/ipmi_adapter.py
44 @@ -30,12 +30,15 @@ class IpmiAdapter(HardwareAdapter):
45          ip = self.get_node_property(node_id, 'ipmiIp')
46          username = self.get_node_property(node_id, 'ipmiUser')
47          password = self.get_node_property(node_id, 'ipmiPass')
48 -        return ip, username, password
49 +        ipmiport = self.get_node_property(node_id, 'ipmiPort')
50 +        return ip, username, password, ipmiport
51  
52      def ipmi_cmd(self, node_id):
53 -        ip, username, password = self.get_access_info(node_id)
54 +        ip, username, password, ipmiport = self.get_access_info(node_id)
55          cmd = 'ipmitool -I lanplus -A password'
56          cmd += ' -H %s -U %s -P %s' % (ip, username, password)
57 +        if ipmiport:
58 +            cmd += ' -p %d' % int(ipmiport)
59          return cmd
60  
61      def get_node_pxe_mac(self, node_id):
62 diff --git a/deploy/reap.py b/deploy/reap.py
63 index 1f1b8ad..d5386aa 100644
64 --- a/deploy/reap.py
65 +++ b/deploy/reap.py
66 @@ -59,6 +59,8 @@ adapter:
67  #       ipmiIp
68  #       ipmiUser
69  #       ipmiPass
70 +#     and you *MAY* provide (optional, not added by reap.py):
71 +#       ipmiPort
72  #   - libvirt adapter you need to provide:
73  #       libvirtName: <whatever>
74  #       libvirtTemplate: [libvirt/vms/controller.xml | libvirt/vms/compute.xml]