Debian: Patch State not reflected properly

Bug #1980153 reported by Jessica Castelino
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Jessica Castelino

Bug Description

Brief Description
-----------------------------------------------------
Patch remove causes the patch to go to PARTIAL-REMOVE state. If we restart the patch controller at this point, the transient state is lost and it moves the patch to AVAILABLE state. Same behavior is noticed for PARTIAL-APPLY state. It moves to APPLIED state when the patch controller is restarted.

Moreover, if we remove the patch, it goes to PARTIAL-REMOVE state. Then when we try to delete it, it gives an error as you can't delete a patch which is not in the available state. It then moves the patch to AVAILABLE state. Now if we attempt a delete again, we are able to delete the patch.

Severity
-----------------------------------------------------
standard

Steps to Reproduce
-----------------------------------------------------
sw-patch upload <PATCH FILE>
sw-patch apply <PATCH-ID>
sw-patch query
systemctl restart sw-patch-controller-daemon
sw-patch query

Expected Behavior
-----------------------------------------------------
Transient states should be maintained irrespective of restarts and errors.

Actual Behavior
-----------------------------------------------------
Transient states are not maintained when we restart patch controller or run in to errors.

Reproducibility
-----------------------------------------------------
yes

System Configuration
-----------------------------------------------------
Debian simplex

Branch/Pull Time/Commit
-----------------------------------------------------
2022-06-19_22-01-00

Last Pass
-----------------------------------------------------
new feature

Timestamp/Logs
-----------------------------------------------------
root@controller-0:/var/home/sysadmin# sw-patch query
  Patch ID RR Release Patch State
============= == ======= ==============
DEBIAN_RR Y 22.06 Applied
DEBIAN_RR_NEW Y 22.06 Partial-Remove

root@controller-0:/var/home/sysadmin# systemctl restart sw-patch-controller-daemon

root@controller-0:/var/home/sysadmin# sw-patch query
  Patch ID RR Release Patch State
============= == ======= ===========
DEBIAN_RR Y 22.06 Applied
DEBIAN_RR_NEW Y 22.06 Available

Alarms
-----------------------------------------------------
N/A

Test Activity
-----------------------------------------------------
Developer Testing

Workaround
-----------------------------------------------------
N/A

Changed in starlingx:
assignee: nobody → Jessica Castelino (jcasteli)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to update (master)

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

Changed in starlingx:
status: New → In Progress
Ghada Khalil (gkhalil)
tags: added: stx.debian stx.update
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to update (master)

Reviewed: https://review.opendev.org/c/starlingx/update/+/848028
Committed: https://opendev.org/starlingx/update/commit/b160fdd18586e3cd31a18b16845c404179f08280
Submitter: "Zuul (22348)"
Branch: master

commit b160fdd18586e3cd31a18b16845c404179f08280
Author: Jessica Castelino <email address hidden>
Date: Tue Jun 28 20:17:19 2022 +0000

    Debian: Fix partial patch states logic

    When patch controller is restarted, the interim states list
    is re-initialized and all patches move from the partial states
    to their next state. This commit adds additional logic to
    check_patch_states() to restore the correct patch states after
    the patch controller has been restarted.

    Test Cases:
    1) Apply a patch and restart sw-patch-controller-daemon.
    2) Remove a patch and restart sw-patch-controller-daemon.
    3) Apply patch1 and patch2 such that patch2 requires patch1.
       Remove patch2 while keeping patch1 applied.
    4) Apply patch1 and patch2 such that patch2 requires patch1.
       Remove patch2 and patch1.
    5) Remove patch, verify delete is rejected and verify that the
       patchstate is Partial-Remove.
    6) Apply a RR patch, lock/unlock host and verify that the
       patchstate of RR patch is "Applied". Then upload and apply
       an in-service patch and verify that the patchstate is
       "Partial-Apply". Restart the patch controller to ensure
       that the query-hosts output says "Reboot Required=No".

    Closes-Bug: 1980153
    Signed-off-by: Jessica Castelino <email address hidden>
    Change-Id: I6a6a2bf70b77623f6533f9aff3b4b15f646fc79c

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.7.0
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.