update key-revocation image failed due to importing firmware: 'int' object has no attribute 'encode'

Bug #1890355 reported by Difu Hu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
High
Al Bailey

Bug Description

Brief Description
-----------------
dcmanager fw-update-strategy apply key-revocation image failed due to importing firmware: 'int' object has no attribute 'encode'

Severity
--------
Major

Steps to Reproduce
------------------
on subcloud3: system host-device-label-assign controller-0 0000:b4:00.0 subcloud3=11
system --os-region-name SystemController device-image-upload ssl_csk1_cancel.bin key-revocation 8086 0b30 --revoke-key-id 1
system --os-region-name SystemController device-image-apply 3cc0ad4f-7e3a-432a-bb97-2c4328656635 subcloud3=11
dcmanager fw-update-strategy create --max-parallel-subclouds 4
dcmanager fw-update-strategy apply

Expected Behavior
------------------
subcloud3 updates ssl_csk1_cancel.bin successfully.

Actual Behavior
----------------
update failed due to failed due to importing firmware: 'int' object has no attribute 'encode'

Reproducibility
---------------
not sure

System Configuration
--------------------
Lab-name: DC-3

Branch/Pull Time/Commit
-----------------------
2020-07-31_20-00-00

Last Pass
---------
N/A

Timestamp/Logs
--------------
on subcloud3:
[sysadmin@controller-0 ~(keystone_admin)]$ system host-device-label-assign controller-0 0000:b4:00.0 subcloud3=11
+-------------+--------------------------------------+
| Property | Value |
+-------------+--------------------------------------+
| uuid | 36bee9f7-fa23-4620-9bd0-726d5ad6f021 |
| label_key | subcloud3 |
| label_value | 11 |
+-------------+--------------------------------------+

on SystemController:
[sysadmin@controller-0 ~(keystone_admin)]$ system --os-region-name SystemController device-image-upload ssl_csk1_cancel.bin key-revocation 8086 0b30 --revoke-key-id 1
+----------------+--------------------------------------+
| Property | Value |
+----------------+--------------------------------------+
| uuid | 3cc0ad4f-7e3a-432a-bb97-2c4328656635 |
| bitstream_type | key-revocation |
| pci_vendor | 8086 |
| pci_device | 0b30 |
| bitstream_id | None |
| key_signature | None |
| revoke_key_id | 1 |
| name | None |
| description | None |
| image_version | None |
| applied | False |
| applied_labels | |
+----------------+--------------------------------------+

[sysadmin@controller-0 ~(keystone_admin)]$ system --os-region-name SystemController device-image-apply 3cc0ad4f-7e3a-432a-bb97-2c4328656635 subcloud3=11
+----------------+--------------------------------------+
| Property | Value |
+----------------+--------------------------------------+
| uuid | 3cc0ad4f-7e3a-432a-bb97-2c4328656635 |
| bitstream_type | key-revocation |
| pci_vendor | 8086 |
| pci_device | 0b30 |
| bitstream_id | None |
| key_signature | None |
| revoke_key_id | 1 |
| name | None |
| description | None |
| image_version | None |
| applied | True |
| applied_labels | [{u'subcloud3': u'11'}] |
+----------------+--------------------------------------+

[sysadmin@controller-0 ~(keystone_admin)]$ dcmanager fw-update-strategy create --max-parallel-subclouds 4
+------------------------+----------------------------+
| Field | Value |
+------------------------+----------------------------+
| strategy type | firmware |
| subcloud apply type | None |
| max parallel subclouds | 4 |
| stop on failure | False |
| state | initial |
| created_at | 2020-08-04T23:57:48.707718 |
| updated_at | None |
+------------------------+----------------------------+

[sysadmin@controller-0 ~(keystone_admin)]$ dcmanager fw-update-strategy apply
+------------------------+----------------------------+
| Field | Value |
+------------------------+----------------------------+
| strategy type | firmware |
| subcloud apply type | None |
| max parallel subclouds | 4 |
| stop on failure | False |
| state | applying |
| created_at | 2020-08-04T23:57:48.707718 |
| updated_at | 2020-08-04T23:58:58.766179 |
+------------------------+----------------------------+

[sysadmin@controller-0 ~(keystone_admin)]$ dcmanager strategy-step list
+-----------+-------+-----------------------------+------------------------------------------------------------+----------------------------+----------------------------+
| cloud | stage | state | details | started_at | finished_at |
+-----------+-------+-----------------------------+------------------------------------------------------------+----------------------------+----------------------------+
| subcloud1 | 3 | applying fw update strategy | apply phase is 16% complete | 2020-08-04 23:59:04.558906 | None |
| subcloud3 | 3 | failed | importing firmware: 'int' object has no attribute 'encode' | 2020-08-04 23:59:04.564468 | 2020-08-04 23:59:06.111814 |
| subcloud2 | 4 | initial | | None | None |
| subcloud4 | 4 | initial | | None | None |
+-----------+-------+-----------------------------+------------------------------------------------------------+----------------------------+----------------------------+

Test Activity
-------------
Functional Testing

Revision history for this message
Al Bailey (albailey1974) wrote :
Download full text (4.5 KiB)

This is a stacktrace in the logs that may be related to this:

2020-08-04 23:59:05.982 428684 INFO dcmanager.manager.states.base [req-bfa9924a-60ed-4dbf-8740-55b624a8cec5 - - - - -] Stage: 3, State: importing firmware, Subcloud: subcloud3, Details: Uploading image:3cc0ad4f-7e3a-432a-bb97-2c4328656635
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread [req-bfa9924a-60ed-4dbf-8740-55b624a8cec5 - - - - -] Failed! Stage: 3, State: importing firmware, Subcloud: subcloud3: AttributeError: 'int' object has no attribute 'encode'
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread Traceback (most recent call last):
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib/python2.7/site-packages/dcmanager/manager/fw_update_orch_thread.py", line 391, in perform_state_action
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread next_state = state_operator.perform_state_action(strategy_step)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib/python2.7/site-packages/dcmanager/manager/states/firmware/importing_firmware.py", line 119, in perform_state_action
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread region).upload_device_image(bitstreamfile, fields)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib/python2.7/site-packages/dccommon/drivers/openstack/sysinv_v1.py", line 796, in upload_device_image
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread **fields)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib64/python2.7/site-packages/cgtsclient/v1/device_image.py", line 46, in upload
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread return self._upload_multipart(self._path(), dict(file=file), data=data)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib64/python2.7/site-packages/cgtsclient/common/base.py", line 62, in _upload_multipart
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread 'POST', url, body=body, data=data)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib64/python2.7/site-packages/cgtsclient/common/http.py", line 307, in upload_request_with_multipart
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread enc = MultipartEncoder(fields)
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib64/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 125, in __init__
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread self._prepare_parts()
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread File "/usr/lib64/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 246, in _prepare_parts
2020-08-04 23:59:06.109 428684 ERROR dcmanager.manager.fw_update_orch_thread self.parts = [Part.from_field(f, enc) for f in self._iter_fields()]
2020-08-04 23:59:06.10...

Read more...

Revision history for this message
Al Bailey (albailey1974) wrote :

The image that was attempting to be uploaded is a key revocation image.

/var/log/sysinv-api.log:sysinv 2020-08-04 23:53:09.661 429795 INFO sysinv.api.hooks.auditor [req-4344da8f-6d39-44fb-9486-cf51aa4e370e bda4e829167d457d9e8ba108f33611c9 da52004c202d4aec9dc0cf08f3d72e0c] fd01:11::2 "POST /v1/device_images HTTP/1.0" status: 200 len: 415 time: 0.00962901115417 POST: NestedMultiDict([('pci_device', u'0b30'), ('bitstream_type', u'key-revocation'), ('pci_vendor', u'8086'), ('file', FieldStorage('file', u'ssl_csk1_cancel.bin')), ('revoke_key_id', u'1')]) host:fd01:11::2:6385 agent:python-requests/2.21.0 user: admin tenant: admin domain: Default

later removed
/var/log/dcorch/dcorch.log:2020-08-04 23:53:09.662 430502 INFO dcorch.api.proxy.apps.controller [-] copied /scratch/device_image_Y40fWH/ssl_csk1_cancel.bin to /opt/dc-vault/device_images/key-revocation-8086-0b30-3cc0ad4f-7e3a-432a-bb97-2c4328656635.bit
/var/log/dcorch/dcorch.log:2020-08-05 01:43:18.962 430499 INFO dcorch.api.proxy.apps.controller [-] Device image (key-revocation-8086-0b30-3cc0ad4f-7e3a-432a-bb97-2c4328656635.bit) removed from vault.

Revision history for this message
Al Bailey (albailey1974) wrote :

The issue ends up being the revoke_key_id
It is treated as an integer while converting from the GET to the POST.

https://github.com/starlingx/distcloud/blob/master/distributedcloud/dcmanager/manager/states/firmware/utils.py#L105

This needs to change from
    fields = dict((k, v) for (k, v) in vars(image).items()
                  if k in field_list and not (v is None))

to
    fields = dict((k, str(v)) for (k, v) in vars(image).items()
                  if k in field_list and not (v is None))

Revision history for this message
Al Bailey (albailey1974) wrote :

Issue being addressed as part of https://review.opendev.org/#/c/744787

Revision history for this message
Ghada Khalil (gkhalil) wrote :

Marking as stx.5.0 - issue related to DC FPGA Orchestration feature

Changed in starlingx:
assignee: nobody → Al Bailey (albailey1974)
tags: added: stx.5.0 stx.distcloud
Changed in starlingx:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to distcloud (master)

Reviewed: https://review.opendev.org/744787
Committed: https://git.openstack.org/cgit/starlingx/distcloud/commit/?id=663fcf0f8868c57540e682d47b93aab3d7a0c12c
Submitter: Zuul
Branch: master

commit 663fcf0f8868c57540e682d47b93aab3d7a0c12c
Author: albailey <email address hidden>
Date: Fri Jul 31 16:12:46 2020 -0500

    Fixes for DC firmware orchestration related to labels and upload

    The applied image labels on the system controller should be the labels
    used when applying the image on the subcloud.

    The stage that removes images now uses all the applied labels
    for the image when removing them.

    The code that converts image fields for upload was passing an integer
    for the revoke_key_id. It now converts to a string to prevent an
    encode exception.

    This commit also enables some unit tests for DC firmware
    orchestration that were being skipped.

    Closes-Bug: 1890355
    Closes-Bug: 1890340
    Closes-Bug: 1890324
    Change-Id: I1a730b01c0bbaeb5f3e1f6ecfb19f649911da453
    Signed-off-by: albailey <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
Revision history for this message
Difu Hu (difuhu) wrote :

Verified on build 2020-08-07_20-00-00.

tags: removed: stx.retestneeded
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to distcloud (f/centos8)

Fix proposed to branch: f/centos8
Review: https://review.opendev.org/c/starlingx/distcloud/+/792298

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on distcloud (f/centos8)

Change abandoned by "Chuck Short <email address hidden>" on branch: f/centos8
Review: https://review.opendev.org/c/starlingx/distcloud/+/792298
Reason: Updated merge soon

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to distcloud (f/centos8)

Fix proposed to branch: f/centos8
Review: https://review.opendev.org/c/starlingx/distcloud/+/793405

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on distcloud (f/centos8)

Change abandoned by "Chuck Short <email address hidden>" on branch: f/centos8
Review: https://review.opendev.org/c/starlingx/distcloud/+/793405

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to distcloud (f/centos8)

Fix proposed to branch: f/centos8
Review: https://review.opendev.org/c/starlingx/distcloud/+/796528

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to distcloud (f/centos8)
Download full text (105.0 KiB)

Reviewed: https://review.opendev.org/c/starlingx/distcloud/+/796528
Committed: https://opendev.org/starlingx/distcloud/commit/4c5344f8765b372cb84d2b1181589c16db2ae6e4
Submitter: "Zuul (22348)"
Branch: f/centos8

commit cb979811017bd193fc1f06e53bb7830fd3184859
Author: Yuxing Jiang <email address hidden>
Date: Wed Jun 9 11:11:27 2021 -0400

    Format the IP addresses in payload before adding a subcloud

    The IPv6 addresses can be represented in multiple formats. As IP
    addresses are stored as text in database, ansible inventory and
    overrides, this commit converts the IP addresses in payload to
    standard text format of IPv6 address during adding a new subcloud.

    Tested with installing and bootstrapping a new subcloud(RVMC
    configured) with the correct IPv6 address values, but with
    unrecommended upper case letters and '0'. The addresses are
    converted to standard format in database, ansible inventory and
    overrides files.

    Partial-Bug: 1931459
    Signed-off-by: Yuxing Jiang <email address hidden>
    Change-Id: I6c26e749941f1ea2597f91886ad8f7da64521f0d

commit 2cf5d6d5cef0808c354f7575336aec34253993b3
Author: albailey <email address hidden>
Date: Thu May 20 14:19:24 2021 -0500

    Delete existing vim strategy from subcloud during patch orch

    When dcmanager creates a patch strategy, if a subcloud has an
    existing vim patch strategy, it will attempt to re-use
    that strategy during its patching phase, which may result in an
    error.

    This commit deletes the existing vim patch strategy in
    a subcloud, if it exists, so it can be re-created.
    If the strategy cannot be deleted, orchestration fails.

    Change-Id: Id35ef26ed3ddae6d71874fc6bac11df147f72323
    Closes-Bug: 1929221
    Signed-off-by: albailey <email address hidden>

commit 9e14c83f0162549a2a94cb8bc1e73dbc4f4d4887
Author: albailey <email address hidden>
Date: Tue Jun 1 14:37:14 2021 -0500

    Adding activation retry to upgrade orchestration

    When performing an activation, the keystone endpoints may not
    be accessible in the subcloud due to the asyncronous way that
    cert-mon can trigger a restart of keystone.

    This would have occasionally resulted in the upgrade activation
    failing to be initiated, and orchestration needing to be invoked
    again to resume.

    This 'hack' adds retries and sleeps to the initial
    activation action.

    Change-Id: Ic757521dec7bdc248a51a70b5463caafe7927360
    Partial-Bug: 1927550
    Signed-off-by: albailey <email address hidden>

commit bb604c0a9b872efd65fa45f1e2269995818c6262
Author: Tee Ngo <email address hidden>
Date: Thu May 27 22:17:16 2021 -0400

    Fix subcloud show --detail command related issues

    If the subcloud is offline, the command stalls and eventually returns
    the "ERROR (app)" output. If the subcloud is online, the oam_floating_ip
    info is excluded from the output when the subcloud id instead of subcloud
    name is specified.

    This commit fixes both of the above issues.

    Closes-Bug: 1929893
    Change-Id: I995591368564539b0e6af185b1adba2db73e0e46
    Sign...

tags: added: in-f-centos8
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.