Bug 1274579

Summary: [Docs] [Director] pxe_ucs Ironic drivers not working
Product: Red Hat OpenStack Reporter: Dave Cain <dcain>
Component: documentationAssignee: Dan Macpherson <dmacpher>
Status: CLOSED CURRENTRELEASE QA Contact: Radek Bíba <rbiba>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0 (Kilo)CC: adahms, anande, bnemec, dmacpher, mburns, rhel-osp-director-maint, rkharya, rtweed, srevivo, tpmcsweeney, vcojot
Target Milestone: gaKeywords: Documentation
Target Release: 8.0 (Liberty)   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1290338 (view as bug list) Environment:
Last Closed: 2016-04-26 01:20:00 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:
Attachments:
Description Flags
debug output from baremetal import command none

Description Dave Cain 2015-10-23 03:58:20 UTC
Description of problem:
When trying to run "openstack baremetal import --json ~/instackdev.json", getting:

MissingParameterValue: cisco driver requries these parameter to be set.. Missing are: ['ucs_address']
 (HTTP 400)

Here is the JSON:

{
    "nodes":[
        {
            "mac":[
            "00:07:00:AA:00:01"
            ],
            "cpu":"40",
            "memory":"524288",
            "disk":"50",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "pm_user":"admin",
            "pm_password":"blah",
            "pm_addr":"172.21.11.14",
            "pm_service_profile":"OSP7-Test1"
        },
        {
            "mac":[
            "00:07:00:AA:00:02"
            ],
            "cpu":"40",
            "memory":"524288",
            "disk":"50",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "pm_user":"admin",
            "pm_password":"blah",
            "pm_addr":"172.21.11.14",
            "pm_service_profile":"OSP7-Test2"
        }
    ]
}

Documentation only states the following parameters in the JSON:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-UCS.html

Please see attachment of debug output and advise.

Version-Release number of selected component (if applicable): OSP Director GA, installed 10/22 with latest updates.


How reproducible:
Always

Steps to Reproduce:
1. Install UcsSdk > 0.8.2.2 via pip install
2. Add pxe_ucs to list of enabled drivers in /etc/ironic/ironic.conf
3. Launch baremetal import against JSON

Comment 1 Dave Cain 2015-10-23 04:00:08 UTC
Created attachment 1085698 [details]
debug output from baremetal import command

Comment 3 chris alfonso 2015-10-23 16:11:54 UTC
Although the driver isn't slated until Liberty (OSP8), this may just be a matter of updating instackenv.json to include the missing setting for ucs_address.

Comment 4 Ben Nemec 2015-11-16 20:19:21 UTC
Unfortunately I don't think it's that simple.  There's no mapping from the JSON names to the ucs_address parameter for the driver.  I don't believe os-cloud-config has the ability to pass arbitrary params either, so it would need to be fixed in the code there.

I'm actually thinking we should drop the largely useless abstraction layer in os-cloud-config and have Ironic just be able to bulk register nodes natively which would mean we don't have to explicitly add support for drivers like this, but that's probably a separate discussion.

Comment 5 Anand Nande 2015-11-26 16:10:50 UTC
This also fails irrespective of 'ucs_address' being used with:

KeyError: 'pm_addr'


Please see attachment.

The instack.json looks like below:

[stack@osp7 ~]$ cat instackenv.json 
{
    "nodes":[
        {
            "mac":[
                "00:25:b5:11:4a:00"
            ],
	    "cpu":"8",
	    "memory":"16384",
	    "disk":"100",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "ucs_user":"admin",
            "ucs_password":"Wipro@123",
            "ucs_addr":"172.16.4.176",
            "ucs_service_profile":"OPENDCKVMHOST-01"
        },

................(snipped)..........
    ]
}

Comment 7 Rajesh 2015-11-26 16:39:17 UTC
There are 3 dependancies to get the pxe_ucs ironic driver to work correctly on ucs gears -

1. python-UcsSdk.noarch rpm needs to be installed on the installer/director node. This package is part for rhel-7-server-openstack-7.0 repo

2. python/site_package/os_cloud_config should include modified 'nodes.py' which has been already been committed upstream -

https://review.openstack.org/gitweb?p=openstack/os-cloud-config.git;a=commit;h=64a4ff33c2a30641637a851f7f916af4b4f885b3

Diff between the working node.py and what's available today with os_cloud_config python package is as below -


3. instack.json should use following syntax for service_profile -

[root@ospd7 ~]# diff /usr/lib/python2.7/site-packages/os_cloud_config/nodes.py /usr/lib/python2.7/site-packages/os_cloud_config/nodes.py.org
69a70
>     driver_info = {}
97a99,102
>     elif node["pm_type"] == "fake_pxe":
>         # The fake_pxe driver doesn't need any credentials since there's
>         # no power management
>         pass
99c104
<         driver_info = {"ucs_address": node["pm_addr"],
---
>         driver_info = {"ucs_hostname": node["pm_addr"],
107c112
<             driver_info["pxe_deploy_kernel"] = node["kernel_id"]
---
>             driver_info["deploy_kernel"] = node["kernel_id"]
109c114
<             driver_info["pxe_deploy_ramdisk"] = node["ramdisk_id"]
---
>             driver_info["deploy_ramdisk"] = node["ramdisk_id"]
122c127
<                   (node["pm_addr"], count))
---
>                   (node.get("pm_addr", ''), count))
160c165
<             if node_details.driver == 'pxe_ssh':
---
>             if node_details.driver in ('pxe_ssh', 'fake_pxe'):
182c187
<     if node['pm_type'] == 'pxe_ssh':
---
>     if node['pm_type'] in ('pxe_ssh', 'fake_pxe'):
229,233d233
<     elif node['pm_type'] == 'pxe_ucs':
<         massage_map.update({'pm_addr': '/driver_info/ucs_address',
<                             'pm_user': '/driver_info/ucs_username',
<                             'pm_password': '/driver_info/ucs_password',
<                             'pm_service_profile': '/driver_info/ucs_service_profile'})
281c281
<     for node in nodes_list['nodes']:
---
>     for node in nodes_list:
289d288
<             print nodes_list

Comment 8 Anand Nande 2015-11-30 10:02:33 UTC
Current 'python-UcsSdk' and 'os-collect' version is : 

python-UcsSdk-0.8.2.5-1.el7ost
os-collect-config-0.1.35-2.el7ost.noarch

Getting error : 

DEBUG: openstackclient.shell clean_up ImportBaremetal
DEBUG: openstackclient.shell got an error: 'pm_addr'
ERROR: openstackclient.shell Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/openstackclient/shell.py", line 176, in run
    return super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 230, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 295, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/command.py", line 53, in run
    self.take_action(parsed_args)
  File "/usr/lib/python2.7/site-packages/rdomanager_oscplugin/v1/baremetal.py", line 181, in take_action
    keystone_client=self.app.client_manager.identity)
  File "/usr/lib/python2.7/site-packages/os_cloud_config/nodes.py", line 326, in register_all_nodes
    glance_ids['kernel'], glance_ids['ramdisk'])
  File "/usr/lib/python2.7/site-packages/os_cloud_config/nodes.py", line 290, in _register_list_of_nodes
    client=client, blocking=blocking)
  File "/usr/lib/python2.7/site-packages/os_cloud_config/nodes.py", line 213, in _update_or_register_ironic_node
    node_uuid = _get_node_id(node, node_map)
  File "/usr/lib/python2.7/site-packages/os_cloud_config/nodes.py", line 192, in _get_node_id
    if node['pm_addr'] in node_map['pm_addr']:
KeyError: 'pm_addr'

Is this file part of an older_code?

Comment 9 Andrew Dahms 2016-02-23 14:19:07 UTC
Assigning to Dan for review.

Comment 10 Dan Macpherson 2016-03-01 03:14:47 UTC
@bnemec: Hey, I'm not sure what the documentation impact is here. Any chance you can let me know what requires modification? It seems like I've got all the prereqs, which are mentioned in comment #7, but not sure if there's anything else. Is this just a question of whether UCS is supported or not in director?

Comment 11 Ben Nemec 2016-03-01 20:40:08 UTC
I think the only documentation need would be what to fill in to instackenv.json for this driver.  Unfortunately, it looks like there is some missing information in comment 7 regarding the service_profile (see point 3 in that comment).  Since that's really the major unique part of the configuration (the rest of the keys are pretty standard), I'm not sure how much we can do without it.

I'm adding a needinfo for Rajesh to provide details on service_profile.

Comment 12 Rajesh 2016-03-02 04:39:36 UTC
There was a typo and missing info on Comment 7. Providing the same below -

<corrected>
2. python/site_package/os_cloud_config should include modified 'nodes.py' which has been already been committed upstream -

https://review.openstack.org/gitweb?p=openstack/os-cloud-config.git;a=commit;h=64a4ff33c2a30641637a851f7f916af4b4f885b3

Diff between the working node.py and what's available today with os_cloud_config python package is as below -

[root@ospd7 ~]# diff /usr/lib/python2.7/site-packages/os_cloud_config/nodes.py /usr/lib/python2.7/site-packages/os_cloud_config/nodes.py.org
69a70
>     driver_info = {}
97a99,102
>     elif node["pm_type"] == "fake_pxe":
>         # The fake_pxe driver doesn't need any credentials since there's
>         # no power management
>         pass
99c104
<         driver_info = {"ucs_address": node["pm_addr"],
---
>         driver_info = {"ucs_hostname": node["pm_addr"],
107c112
<             driver_info["pxe_deploy_kernel"] = node["kernel_id"]
---
>             driver_info["deploy_kernel"] = node["kernel_id"]
109c114
<             driver_info["pxe_deploy_ramdisk"] = node["ramdisk_id"]
---
>             driver_info["deploy_ramdisk"] = node["ramdisk_id"]
122c127
<                   (node["pm_addr"], count))
---
>                   (node.get("pm_addr", ''), count))
160c165
<             if node_details.driver == 'pxe_ssh':
---
>             if node_details.driver in ('pxe_ssh', 'fake_pxe'):
182c187
<     if node['pm_type'] == 'pxe_ssh':
---
>     if node['pm_type'] in ('pxe_ssh', 'fake_pxe'):
229,233d233
<     elif node['pm_type'] == 'pxe_ucs':
<         massage_map.update({'pm_addr': '/driver_info/ucs_address',
<                             'pm_user': '/driver_info/ucs_username',
<                             'pm_password': '/driver_info/ucs_password',
<                             'pm_service_profile': '/driver_info/ucs_service_profile'})
281c281
<     for node in nodes_list['nodes']:
---
>     for node in nodes_list:
289d288
<             print nodes_list

<corrected>

3. instack.json should use following syntax for service_profile -

[stack@ospd7 ~]$ cat instackenv.json
{
	"nodes":[
		{
			"mac":[
				"00:25:b5:77:00:3f"
			],
			"cpu":"16",
			"memory":"262144",
			"disk":"92",
			"arch":"x86_64",
			"pm_type":"pxe_ucs", <<<<<<<<<<<<<
			"pm_user":"admin", <<<<<<<<<<<<<<<
			"pm_password":"Nbv12345!", <<<<<<<<<<
			"pm_addr":"10.65.122.187", <<<<<<<<<<<<
                        "pm_service_profile":"org-root/ls-Cntrl-1" <<<<<<<<<<
		},
		{
			"mac":[
				"00:25:b5:77:00:2d"
			],
			"cpu":"24",
			"memory":"262144",
			"disk":"930",
			"arch":"x86_64",
			"pm_type":"pxe_ucs", <<<<<<<<<<<<
			"pm_user":"admin", <<<<<<<<<<<<
			"pm_password":"Nbv12345!", <<<<<<<<<<<
			"pm_addr":"10.65.122.187", <<<<<<<<<
                        "pm_service_profile":"org-root/ls-Nova-1" <<<<<<<<
		}
	]
}

Let me know if there are need for any further inputs to this. Apologies for delay in response, some how could respond soon due to mail filter issue.

Thanks,
~ Rajesh.

Comment 13 Dan Macpherson 2016-03-02 06:32:13 UTC
I think I've got the pm_service_profile param included in the docs:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-UCS.html

Rajesh, Ben -- Anything else I should add to this page?

Comment 14 Rajesh 2016-03-02 06:49:00 UTC
Pls. include exact syntax as an example, as syntax has hard dependancies on pxe_ucs driver's functionality. 

"pm_service_profile":"org-root/ls-<service_profile_name>"

Also if someone confirm the changes in 'nodes.py' are included downstream. 

Thanks,
~ Rajesh.

Comment 15 Ben Nemec 2016-03-02 17:32:44 UTC
The os-cloud-config changes are in the downstream code, so everything should be in place for this to work.  It sounds like the only changed needed is to document the format of the service_profile value.

Comment 17 Tim McSweeney 2016-03-13 13:28:41 UTC
I updated instackenv.json to include pm_service_profile but I'm getting the following error. 

[stack@undercloud ~]$ openstack baremetal import --json ~/instackenv.json
WARNING: ironicclient.common.http Request returned failure status.
ERROR: openstack cisco driver requries these parameter to be set.. Missing are: ['ucs_address']
Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 142, in inner
    return func(*args, **kwargs)

  File "/usr/lib/python2.7/site-packages/ironic/conductor/manager.py", line 435, in change_node_power_state
    task.driver.power.validate(task)

  File "/usr/lib/python2.7/site-packages/ironic/drivers/modules/ucs/power.py", line 105, in validate
    ucs_helper.parse_driver_info(task.node)

  File "/usr/lib/python2.7/site-packages/ironic/drivers/modules/ucs/helper.py", line 82, in parse_driver_info
    deploy_utils.check_for_missing_params(info, error_msg)

  File "/usr/lib/python2.7/site-packages/ironic/drivers/modules/deploy_utils.py", line 788, in check_for_missing_params
    {'error_msg': error_msg, 'missing_info': missing_info})

MissingParameterValue: cisco driver requries these parameter to be set.. Missing are: ['ucs_address']
 (HTTP 400)
[stack@undercloud ~]$

[stack@undercloud ~]$ sudo yum info python-UcsSdk
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Installed Packages
Name        : python-UcsSdk
Arch        : noarch
Version     : 0.8.2.5
Release     : 1.el7ost
Size        : 43 M
Repo        : installed
From repo   : rhel-7-server-openstack-7.0-rpms
Summary     : Python SDK for Cisco UCS Manager
URL         : https://pypi.python.org/pypi/UcsSdk
License     : ASL 2.0
Description : Python development kit for Cisco UCS

[stack@undercloud ~]$ sudo yum info os-collect-config
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Installed Packages
Name        : os-collect-config
Arch        : noarch
Version     : 0.1.35
Release     : 5.el7ost
Size        : 242 k
Repo        : installed
From repo   : rhel-7-server-openstack-7.0-director-rpms
Summary     : Collect and cache metadata running hooks on changes
URL         : http://pypi.python.org/pypi/os-collect-config
License     : ASL 2.0
Description : Service to collect openstack heat metadata.

[stack@undercloud ~]$

{
    "nodes":[
        {
            "mac":[
                "00:25:B5:99:99:6F"
            ],
            "cpu":"8",
            "memory":"196608",
            "disk":"600",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "pm_user":"foo",
            "pm_password":"bar",
            "pm_addr":"192.168.1.7",
	    "pm_service_profile":"org-root/ls-OS1_Control1"
        },
        {
            "mac":[
                "00:25:B5:99:99:4F"
            ],
            "cpu":"8",
            "memory":"196608",
            "disk":"600",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "pm_user":"foo",
            "pm_password":"bar",
            "pm_addr":"192.168.1.7",
	    "pm_service_profile":"org-root/ls-OS1_Compute1"

        },
        {
            "mac":[
                "00:25:B5:99:99:2F"
            ],
            "cpu":"8",
            "memory":"196608",
            "disk":"600",
            "arch":"x86_64",
            "pm_type":"pxe_ucs",
            "pm_user":"foo",
            "pm_password":"bar",
            "pm_addr":"192.168.1.7",
	    "pm_service_profile":"org-root/ls-OS1_Compute2"
        }
    ]
}

Comment 18 Dan Macpherson 2016-03-13 23:15:26 UTC
@tpmcsweeney -- I think the engineering side of this issue is being tracked in https://bugzilla.redhat.com/show_bug.cgi?id=1290338. I've logged a comment on that BZ regarding the issue you're experiencing.

Comment 19 Dan Macpherson 2016-03-16 03:41:15 UTC
@Rajesh, this change is now live on the Red Hat Customer Portal:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux_OpenStack_Platform/7/html/Director_Installation_and_Usage/sect-UCS.html

Did I get the format correct? Were there any further changes required to this section?

Comment 20 Rajesh 2016-04-25 11:10:27 UTC
@Dan

This look good. 

Thanks,
~ Rajesh.

Comment 21 Dan Macpherson 2016-04-26 01:20:00 UTC
Thanks, Rajesh!