sysinv mgmt_mac attribute update is case-sensitive

Bug #1973071 reported by John Kung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
John Kung

Bug Description

*Description of failure: *
sysinv mgmt_mac attribute update is case-sensitive, thus restricting other valid updates

Timestamp when failure occurred:
03/04 18:42:59.993015

Is the issue intermittent or is it 100% Reproducible? Frequency of Occurrence?
100% Reporducible

Events leading up to failure:
Set upper case characters in the host definition for mgmt_mac/bootMac attribute.

Key Logs entrys:

{

**When upper case characters are used in the host update, even though it would've matched in a case-insensitive comparison:
{
   ***Bash.log shows sysinv erroring out when upper case used and then cli output.
2022-03-04T19:05:58.000 controller-0 -sh: info HISTORY: PID=2056903 UID=42425 system host-update controller-1 mgmt_mac=48:Df:37:3D:B1:14
Change ['mgmt_mac'] contains restricted set(['mgmt_mac']).

***Sysinv.log.3 showing error for upper case
sysinv.log.3:53381:sysinv 2022-03-04 19:05:59.908 303966 WARNING wsme.api [-] Client-side error: Change ['mgmt_mac'] contains restricted set(['mgmt_mac']).: ClientSideError: Change ['mgmt_mac'] contains restricted set(['mgmt_mac']).

**Bash.log showing lower case success and cli output.
2022-03-04T19:06:06.000 controller-0 -sh: info HISTORY: PID=2056903 UID=42425 system host-update controller-1 mgmt_mac=48:df:37:3d:b1:14

+-----------------------+-------------------------------------------------+
| Property | Value |
+-----------------------+-------------------------------------------------+
| action | none |
| administrative | unlocked |
| availability | available |
| bm_ip | 2607:f160:0010:920f:00ce:0fe0:0000:8064 |
| bm_type | redfish |
| bm_username | redacted |
| boot_device | /dev/disk/by-path/pci-0000:5c:00.0-scsi-0:1:0:0 |
| capabilities | {} |
| clock_synchronization | ntp |
| config_applied | 2a1993e3-1ba9-41b5-829f-eab61d7089d2 |
| config_status | None |
| config_target | 2a1993e3-1ba9-41b5-829f-eab61d7089d2 |
| console | ttyS0,115200 |
| created_at | 2021-11-19T19:52:11.832339+00:00 |
| device_image_update | None |
| hostname | controller-1 |
| id | 2 |
| install_output | text |
| install_state | completed |
| install_state_info | None |
| inv_state | inventoried |
| invprovision | provisioned |
| location | {} |
| mgmt_ip | 2607:f160:10:9105:ce:290:0:1002 |
| mgmt_mac | 48:df:37:3d:b1:14 |
| operational | enabled |
| personality | controller |
| reboot_needed | False |
| reserved | False |
| rootfs_device | /dev/disk/by-path/pci-0000:5c:00.0-scsi-0:1:0:0 |
| serialid | None |
| software_load | 21.05 |
| task | |
| tboot | false |
| ttys_dcd | None |
| updated_at | 2022-03-04T19:03:33.934381+00:00 |
| uptime | 2773576 |
| uuid | fa957919-bde9-4a45-b9d6-a6b09435a510 |
| vim_progress_status | services-enabled |
+-----------------------+-------------------------------------------------+

}
Impact of Failure:

When upper case characters are used in the host definition, errors occur as show below:
E0304 18:42:59.993015 1 common.go:138] controller/host "msg"="user error" "error"="failed to update host attributes: 4cfc8b5e-79ba-4d34-9fe4-f13a8bc91b63,

{\"mgmt_mac\":\"B4:96:91:B4:D9:38\"}
: Bad request with: [PATCH http://[2607:f160:0:303e:ce:40a::]:6385/v1/ihosts/4cfc8b5e-79ba-4d34-9fe4-f13a8bc91b63], error message: {\"error_message\": \"

{\\\"debuginfo\\\": null, \\\"faultcode\\\": \\\"Client\\\", \\\"faultstring\\\": \\\"Change ['mgmt_mac'] contains restricted set(['mgmt_mac']).\\\"}
\"}" "request"=

Did the system automatically recover?
No

*Log/File location:
See logs above

*Triage:
Was the issue reproduced internally?*
yes

Workaround:
redeploy with lower case mgmt_mac

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to config (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/starlingx/config/+/841607

Changed in starlingx:
status: New → In Progress
John Kung (john-kung)
Changed in starlingx:
assignee: nobody → John Kung (john-kung)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/841607
Committed: https://opendev.org/starlingx/config/commit/24ecd22ae104842443acabf26aa17797cb67378c
Submitter: "Zuul (22348)"
Branch: master

commit 24ecd22ae104842443acabf26aa17797cb67378c
Author: John Kung <email address hidden>
Date: Thu May 12 10:29:10 2022 -0400

    Update sysinv-api to perform case-insensitive mgmt_mac check

    Orchestrators or admin may attempt to perform host-update to a host
    provisioned with an upper case mgmt_mac.
    This was being rejected by the api as it was not considering
    a match as the mgmt_mac is only stored as lower case.

    This commit updates the api to match on a case-insensitive
    basis the mgmt_mac.

    Align host api _patch() to safer method to get passed
    in patch value.

    Remove a null-effect loop in updated host api _patch() method
    that was left from host hardware profile removal
    story https://storyboard.openstack.org/#!/story/2009163

    Closes-Bug: 1973071

    Test Plan:
    PASSED added tox unit tests for mgmt_mac case
    PASSED host-add with upper case mgmt_mac accepted
    PASSED host-update with upper case mgmt_mac accepted
    PASSED host-update with lower case mgmt_mac accepted
    PASSED host-update with upper case matching lower case mgmt_mac accepted
    PASSED host-ptp-instance-assign verifying get of value

    Signed-off-by: John Kung <email address hidden>
    Change-Id: Ibcd2efbb41e42cf140c5d602585aa34fa30cf4e1

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.7.0 stx.config
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.