From f9aaf16c515333bf653cf00793b54b159e86e1ac Mon Sep 17 00:00:00 2001 From: Dehan Meng Date: Wed, 11 Sep 2024 13:58:03 +0800 Subject: [PATCH] qemu_guest_agent: Report message changed for api qga-freeze The fsfreeze commands are already written to report an error if vss_init() fails. Reporting a more specific error message is more helpful than a generic "command is disabled" message Signed-off-by: Dehan Meng --- qemu/tests/qemu_guest_agent.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qemu/tests/qemu_guest_agent.py b/qemu/tests/qemu_guest_agent.py index cf7a94b4b4..98f202cc7d 100644 --- a/qemu/tests/qemu_guest_agent.py +++ b/qemu/tests/qemu_guest_agent.py @@ -2600,13 +2600,19 @@ def gagent_check_freeze_frozen(self, test, params, env): :param params: Dictionary with the test parameters :param env: Dictionary with test environment. """ + # Since Qemu9.1, the report message changes. + qga_ver = self.gagent.guest_info()["version"].split('.') + main_qga_ver = float("{}.{}".format(qga_ver[0], qga_ver[1])) + expected = ( + "Command guest-fsfreeze-freeze has been disabled: " + f"{'the command is not allowed' if 9.1 <= main_qga_ver or main_qga_ver >= 109.0 else 'the agent is in frozen state'}" + ) + self.gagent.fsfreeze() error_context.context("Freeze the frozen FS", LOG_JOB.info) try: self.gagent.fsfreeze(check_status=False) except guest_agent.VAgentCmdError as e: - expected = ("Command guest-fsfreeze-freeze has been disabled: " - "the agent is in frozen state") if expected not in e.edata["desc"]: test.fail(e) else: