Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1640826

Summary: Missing validation to requite pm_password and pm_user for importing nodes with pm_type 'ipmi'
Product: Red Hat OpenStack Reporter: Alexander Chuzhoy <sasha>
Component: openstack-ironicAssignee: RHOS Maint <rhos-maint>
Status: CLOSED NOTABUG QA Contact: mlammon
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14.0 (Rocky)CC: bfournie, mburns
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-19 14:29:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1513017    

Description Alexander Chuzhoy 2018-10-18 20:50:35 UTC
Missing validation to requite pm_password and pm_user for importing nodes with pm_type 'ipmi'


Environment:
instack-undercloud-9.4.1-0.20180928005746.15cda5a.el7ost.noarch
openstack-tripleo-heat-templates-9.0.0-0.20181001174822.90afd18.0rc2.el7ost.noarch
puppet-ironic-13.3.1-0.20180911185738.317a1e5.el7ost.noarch
python-ironic-lib-2.14.0-0.20180810074837.344161b.el7ost.noarch
python2-ironicclient-2.5.0-0.20180810135843.fb94fb8.el7ost.noarch
openstack-ironic-common-11.1.1-0.20181001152939.4167083.el7ost.noarch
openstack-ironic-api-11.1.1-0.20181001152939.4167083.el7ost.noarch
python2-ironic-inspector-client-3.3.0-0.20180810080932.53bf4e8.el7ost.noarch

Steps to reproduce:

Have a json file without pm_user and pm_password with pm_type set to ipmi:
(undercloud) [stack@undercloud-0 ~]$ cat in.json 
{
    "nodes": [
    {
      "name": "controller-2",
      "cpu": "4",
      "memory": "32768",
      "disk": "40",
            "arch": "x86_64",
              "pm_addr": "192.168.24.1",
        "pm_type": "ipmi",
        "pm_port": "6231"
                }    ]
}



Attempt to import the node.

Result:
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node list
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| UUID                                 | Name         | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| 8aebc1a9-39cd-4b55-b4c1-3a88734399ad | compute-0    | None          | power off   | manageable         | False       |
| 54ebf3f0-83b4-4edf-9497-9ddfe91d891a | compute-1    | None          | power off   | manageable         | False       |
| 1c86615b-eefd-42f2-ab1e-c7a26179df2b | controller-0 | None          | power off   | manageable         | False       |
| 3084e9f4-d71a-49f1-bfa1-af20c80b17f7 | ironic-0     | None          | power on    | manageable         | False       |
| f6c1413f-09d8-46db-a190-8efe9ee7f0af | ironic-1     | None          | power off   | manageable         | False       |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud node import in.json 
Waiting for messages on queue 'tripleo' with no timeout.

[{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}]
{u'status': u'FAILED', u'message': [{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}], u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=58470223-153f-4f7c-b568-92d00d2cbecb] -> Workflow failed due to message status\n    [wf_ex_id=f01cb453-086b-4f6f-80a3-49fc157a16ff, idx=0]: Workflow failed due to message status\n'}
Exception registering nodes: {u'status': u'FAILED', u'message': [{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}], u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=58470223-153f-4f7c-b568-92d00d2cbecb] -> Workflow failed due to message status\n    [wf_ex_id=f01cb453-086b-4f6f-80a3-49fc157a16ff, idx=0]: Workflow failed due to message status\n'}
(undercloud) [stack@undercloud-0 ~]$ openstack baremetal node list
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| UUID                                 | Name         | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
| 8aebc1a9-39cd-4b55-b4c1-3a88734399ad | compute-0    | None          | power off   | manageable         | False       |
| 54ebf3f0-83b4-4edf-9497-9ddfe91d891a | compute-1    | None          | power off   | manageable         | False       |
| 1c86615b-eefd-42f2-ab1e-c7a26179df2b | controller-0 | None          | power off   | manageable         | False       |
| 3084e9f4-d71a-49f1-bfa1-af20c80b17f7 | ironic-0     | None          | power on    | manageable         | False       |
| f6c1413f-09d8-46db-a190-8efe9ee7f0af | ironic-1     | None          | power off   | manageable         | False       |
| 0e4dde97-4558-4602-88b1-16d32f73bd30 | controller-2 | None          | None        | enroll             | False       |
+--------------------------------------+--------------+---------------+-------------+--------------------+-------------+
(undercloud) [stack@undercloud-0 ~]$ 



Expected result:
Validation should run and exit with error - pm_user and pm_password are mandatory for ipmi, idrac, ilo

Comment 1 Alexander Chuzhoy 2018-10-18 20:51:00 UTC
Using validation arg doesn't help
openstack overcloud node import --run-validations in.json 
Waiting for messages on queue 'tripleo' with no timeout.

[{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}]
{u'status': u'FAILED', u'message': [{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}], u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=32b6f7df-f71f-4f27-aa0e-38c6cbbee0a8] -> Workflow failed due to message status\n    [wf_ex_id=70b93303-2656-495d-a130-53c6cac3b833, idx=0]: Workflow failed due to message status\n'}
Exception registering nodes: {u'status': u'FAILED', u'message': [{u'result': u'Node 0e4dde97-4558-4602-88b1-16d32f73bd30 did not reach state "manageable", the state is "enroll", error: Failed to get power state for node 0e4dde97-4558-4602-88b1-16d32f73bd30. Error: IPMI call failed: power status.'}], u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=32b6f7df-f71f-4f27-aa0e-38c6cbbee0a8] -> Workflow failed due to message status\n    [wf_ex_id=70b93303-2656-495d-a130-53c6cac3b833, idx=0]: Workflow failed due to message status\n'}

Comment 2 Dmitry Tantsur 2018-10-19 14:29:13 UTC
IPMI password is not required by design. It's not mandatory in the protocol, and seems like Power systems may not have it: https://github.com/openstack/tripleo-common/commit/ca290cf4afcfcabd3e678fdba9e0099cc477739d#diff-3688d09e985d7d7eef061d725f66c20c

Comment 3 Alexander Chuzhoy 2018-10-19 14:35:46 UTC
confirm that ilo and idrac demand pm_user/pm_password:


ilo:
(undercloud) [stack@undercloud ~]$ openstack overcloud node import in.json 
Waiting for messages on queue 'tripleo' with no timeout.
Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user
{u'status': u'FAILED', u'message': u'Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user', u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=d7ee5dcb-740c-4f40-853c-63c67f383470] -> Workflow failed due to message status\n    [wf_ex_id=12b64400-0fc3-4194-a747-dd2f705e4c5d, idx=0]: Workflow failed due to message status\n'}
Exception registering nodes: {u'status': u'FAILED', u'message': u'Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user', u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=d7ee5dcb-740c-4f40-853c-63c67f383470] -> Workflow failed due to message status\n    [wf_ex_id=12b64400-0fc3-4194-a747-dd2f705e4c5d, idx=0]: Workflow failed due to message status\n'}
(undercloud) [stack@undercloud ~]$ echo $?
1

idrac:
(undercloud) [stack@undercloud ~]$ openstack overcloud node import in.json 
Waiting for messages on queue 'tripleo' with no timeout.
Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user
{u'status': u'FAILED', u'message': u'Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user', u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=22c94a8c-c797-47a2-aa8b-1828adcdcf20] -> Workflow failed due to message status\n    [wf_ex_id=c1867658-5fc9-4070-8cff-d24ceb682358, idx=0]: Workflow failed due to message status\n'}
Exception registering nodes: {u'status': u'FAILED', u'message': u'Invalid node data: node #0: Invalid node data: The following fields are missing: pm_password, pm_user', u'result': u'Failure caused by error in tasks: send_message\n\n  send_message [task_ex_id=22c94a8c-c797-47a2-aa8b-1828adcdcf20] -> Workflow failed due to message status\n    [wf_ex_id=c1867658-5fc9-4070-8cff-d24ceb682358, idx=0]: Workflow failed due to message status\n'}