Skip to content

CA-406020: parse dnf5 output in pool_update plugins#7078

Merged
stephenchengCloud merged 2 commits into
xapi-project:masterfrom
stephenchengCloud:private/stephenche/CA-406020
May 21, 2026
Merged

CA-406020: parse dnf5 output in pool_update plugins#7078
stephenchengCloud merged 2 commits into
xapi-project:masterfrom
stephenchengCloud:private/stephenche/CA-406020

Conversation

@stephenchengCloud
Copy link
Copy Markdown
Collaborator

dnf was upgraded to dnf5, which prints transaction errors in a new format. The existing parsers in pool_update.precheck and pool_update.apply were written against dnf4 and silently fell through to a generic "unknown error" for every failure mode, hiding the real reason from XAPI.

Tested and passed:
4648126 updatenegative.seq
4648212 supppackduringhostinstall.seq
4648128 supppackduringhostupgrade.seq

Also did manual tests for typical dnf5 transaction errors (conflict, non-existent pacakge, missing provides)

dnf was upgraded to dnf5, which prints transaction errors in a new
format. The existing parsers in pool_update.precheck and pool_update.apply
were written against dnf4 and silently fell through to a generic
"unknown error" for every failure mode, hiding the real reason from
XAPI.

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
INVALID_UPDATE = "INVALID_UPDATE"
ERROR_MESSAGE_DOWNLOAD_PACKAGE = "Error downloading packages:\n"
ERROR_MESSAGE_START = "Error: "
ERROR_MESSAGE_END = "You could try "
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this block as it's duplicate with line 28-37.

YUM_CMD = '/usr/bin/yum'
ERROR_MESSAGE_DOWNLOAD_PACKAGE = 'Failed to download packages'
DNF_CMD = '/usr/bin/dnf'
PKG_MGR = DNF_CMD if os.path.exists(DNF_CMD) else YUM_CMD
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also removed yum related code.

'The package is not signed.',
'GPG signature verification error',
)
ERROR_XML_START = '<error errorcode='
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the output of dnf program totally different?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, by checking the dnf5 source code, the error messages are totally different.

@liulinC
Copy link
Copy Markdown
Collaborator

liulinC commented May 20, 2026

Is it possible to unittest the code with example dnf output?

@stephenchengCloud
Copy link
Copy Markdown
Collaborator Author

Is it possible to unittest the code with example dnf output?

Yes, it is. In fact, i did the test locally. I can include the test in this PR.

Signed-off-by: Stephen Cheng <stephen.cheng@citrix.com>
@stephenchengCloud stephenchengCloud force-pushed the private/stephenche/CA-406020 branch from 162e5d2 to b2ca8b7 Compare May 20, 2026 05:48
@stephenchengCloud stephenchengCloud added this pull request to the merge queue May 21, 2026
Merged via the queue into xapi-project:master with commit efe7739 May 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants