Debian: sw-manager patch-strategy create returns 500 error

Bug #1974475 reported by Al Bailey
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Al Bailey

Bug Description

Brief Description
-----------------
Invoking sw-manager patch-strategy create fails on Debian and reports a 500 error, and causes a stacktrace in the vim

Severity
--------
Minor

Steps to Reproduce
------------------
sw-manager patch-strategy create

Expected Behavior
------------------
Should create a patch strategy (or at least try)

Actual Behavior
----------------
sw-manager patch-strategy create
Operation failed: The server has either erred or is incapable of performing the requested operation
Rest-API status=500, POST, http://192.168.204.1:4545/api/orchestration/sw-patch/strategy, headers={'Content-Type': 'application/json', 'X-User': 'admin', 'X-Tenant': 'admin', 'X-User-Domain-Name': 'Default', 'X-Auth-Token': 'gAAAAABih-JEiMzYJlNB1SLwstsq1qurADtTtC4NYJU27jA3OnI59ur5X0CN7klXdZ6a3-zKKvFTm08_76wYgStb8DfS9ZXZkRokfGaENrkktRxR66ujmHN4q2NzL1496h3d30Wam6FrlJvnJaTaOBcRmRInlc0QhoENOYdNPxz1Oi4fWiN88mo'}, payload={"controller-apply-type": "serial", "swift-apply-type": "ignore", "default-instance-action": "stop-start", "storage-apply-type": "serial", "worker-apply-type": "serial", "alarm-restrictions": "strict"}, response=b'{"faultcode": "Server", "faultstring": "The server has either erred or is incapable of performing the requested operation.", "debuginfo": null}'
HTTP Error 500: Internal Server Error

Reproducibility
---------------
100%

System Configuration
--------------------
AIO-SX Debian

Branch/Pull Time/Commit
-----------------------
May 20, 2022

Last Pass
---------
Never invoked on debian

Timestamp/Logs
--------------
2022-05-20T19:01:21.505 controller-0 VIM_Thread[66682] ERROR a bytes-like object is required, not 'str'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/nfv_vim/vim.py", line 167, in process_main
    selobj.selobj_dispatch(PROCESS_TICK_INTERVAL_IN_MS)
  File "/usr/lib/python3/dist-packages/nfv_common/selobj/_selobj_module.py", line 105, in selobj_dispatch
    callback.send(selobj)
  File "/usr/lib/python3/dist-packages/nfv_common/tcp/_tcp_server.py", line 77, in dispatch
    self._message_handler(client_connection, msg)
  File "/usr/lib/python3/dist-packages/nfv_vim/events/_vim_api_events.py", line 188, in _vim_api_message_handler
    vim_sw_update_api_create_strategy(connection, msg)
  File "/usr/lib/python3/dist-packages/nfv_vim/events/_vim_sw_update_api_events.py", line 96, in vim_sw_update_api_create_strategy
    uuid, reason = sw_mgmt_director.create_sw_patch_strategy(
  File "/usr/lib/python3/dist-packages/nfv_vim/directors/_sw_mgmt_director.py", line 73, in create_sw_patch_strategy
    schedule.schedule_function_call(callback, success, reason,
  File "/usr/lib/python3/dist-packages/nfv_common/schedule/_schedule_module.py", line 25, in schedule_function_call
    """
TypeError: a bytes-like object is required, not 'str'

Test Activity
-------------
Feature Testing

Workaround
----------
None, but I know what the fix is.

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

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

Changed in starlingx:
status: New → In Progress
Al Bailey (albailey1974)
Changed in starlingx:
assignee: nobody → Al Bailey (albailey1974)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nfv (master)

Reviewed: https://review.opendev.org/c/starlingx/nfv/+/842798
Committed: https://opendev.org/starlingx/nfv/commit/3e6c2d41e199d6f78ed10d6b8724dbbe3dbc0f18
Submitter: "Zuul (22348)"
Branch: master

commit 3e6c2d41e199d6f78ed10d6b8724dbbe3dbc0f18
Author: Al Bailey <email address hidden>
Date: Fri May 20 19:13:32 2022 +0000

    Debian: Fix sw-manager commands

    sw-manager strategy creation commands trigger
    a python3 error. The issue is that python2 supports
    a string, but python3 expects bytes.

    The fix is to send the appropriate message
    based on the whether we are in python2 or python3.

    Test Plan:
      Debian: verify sw-manager patch-strategy create works
      Centos: verify sw-manager patch-strategy create works

    Closes-Bug: 1974475
    Signed-off-by: Al Bailey <email address hidden>
    Change-Id: I94800fa870f1a444df6e95ba2f206803a4acfc18

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
importance: Low → Medium
tags: added: stx.7.0 stx.debian stx.update
tags: added: stx.nfv
removed: stx.update
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nfv (master)

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

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

Reviewed: https://review.opendev.org/c/starlingx/nfv/+/843540
Committed: https://opendev.org/starlingx/nfv/commit/37159ae8bd2b6d7e91ebd7c4278ae02609907d4e
Submitter: "Zuul (22348)"
Branch: master

commit 37159ae8bd2b6d7e91ebd7c4278ae02609907d4e
Author: Al Bailey <email address hidden>
Date: Thu May 26 19:14:29 2022 +0000

    Debian: Fix ugly error deleting a patch strategy

    A JSONDecodeError is raised when deleting a patch strategy
    that exists. (the error is not seen if no strategy exists)

    sw-manager patch-strategy delete
    Expecting value: line 1 column 1 (char 0)

    The issue is the JSON decoder does not handle an empty
    string. The empty string is a byte string on debian which
    runs on python3 so the comparison check needed to be
    updated.

    Test Plan:
      Verify that a patch strategy can be deleted on Debian
    without ugly messages.
      Verify that a non existant patch strategy can be deleted
    on Debian without ugly messages.

    Partial-Bug: 1974475
    Signed-off-by: Al Bailey <email address hidden>
    Change-Id: I18f84e20abf43a342e996c4752654bad3261e5a6

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nfv (master)

Reviewed: https://review.opendev.org/c/starlingx/nfv/+/864109
Committed: https://opendev.org/starlingx/nfv/commit/60b161b9c28cb5100c9e41267678595a72068c30
Submitter: "Zuul (22348)"
Branch: master

commit 60b161b9c28cb5100c9e41267678595a72068c30
Author: Al Bailey <email address hidden>
Date: Wed Nov 9 12:27:57 2022 +0000

    Fix kube-upgrade-orchestration on debian

    During kube-upgrade orchestration, the final cleanup
    step returns an empty result body. The orchestrator
    was not handling this properly on Debian.

    In Debian, the API results are returned as bytes.
    The code that looks for an empty string needed to
    handle an empty byte string.

    Test Plan:
     PASS: Debian AIO-SX sw-manager kube-upgrade-strategy apply

    Closes-Bug: #1996057
    Related-Bug: #1974475

    Signed-off-by: Al Bailey <email address hidden>
    Change-Id: I37849f25fc908fb06b3e40cedfaa5690f45b289d

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.