autotest / tp-qemu

Virt Test Provider for qemu and other related virtualization backends
Other
48 stars 173 forks source link

[qemu] save_restore test case got ERROR: module 'virttest.qemu_migration' has no attribute 'monitor' #3357

Closed nhanldtn closed 2 years ago

nhanldtn commented 2 years ago

Hi,

Please help me check the issue

I got the issue when running the test case save_restore with --vt-type qemu, please see below:

[root@sut test-providers.d]# avocado run --vt-type qemu --vt-guest-os Fedora.36.aarch64 --vt-machine-type arm64-mmio type_specific.io-github-autotest-qemu.save_restore_vm
JOB ID     : c41f3fa3143c03376ffa118e1c39f16342978746
JOB LOG    : /root/avocado/job-results/job-2022-06-14T20.04-c41f3fa/job.log
 (1/2) type_specific.io-github-autotest-qemu.save_restore_vm: STARTED
 (1/2) type_specific.io-github-autotest-qemu.save_restore_vm: ERROR: module 'virttest.qemu_migration' has no attribute 'monitor' (683.79 s)

Debug:

[stdlog] 2022-06-14 20:16:00,345 avocado.virttest.storage DEBUG| Copying /home/avocado/data/avocado-vt/images/f36-aarch64.qcow2.backup -> /home/avocado/data/avocado-vt/images/f36-aarch64.qcow2
[stdlog] 2022-06-14 20:16:01,874 avocado.virttest.env_process WARNI| registers is not alive. Can't query the avocado-vt-vm1 status
[stdlog] 2022-06-14 20:16:03,674 avocado.virttest.env_process DEBUG| Thread quit. Used to failed to get registers info from guest 20220614-200441-BXAGPFFY for 2 times.
[stdlog] 2022-06-14 20:16:04,110 avocado.virttest.env_process WARNI| Could not get host cpu family
[stderr] Traceback (most recent call last):
[stderr]   File "/usr/local/lib/python3.10/site-packages/avocado_vt/plugins/vt_runner.py", line 54, in runTest
[stderr]     raise self.__status  # pylint: disable-msg=E0702
[stderr]   File "/usr/local/lib/python3.10/site-packages/avocado_vt/test.py", line 147, in setUp
[stderr]     self._runTest()
[stderr]   File "/usr/local/lib/python3.10/site-packages/avocado_vt/test.py", line 264, in _runTest
[stderr]     run_func(self, params, env)
[stderr]   File "/usr/local/lib/python3.10/site-packages/virttest/error_context.py", line 135, in new_fn
[stderr]     return fn(*args, **kwargs)
[stderr]   File "/home/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-qemu/qemu/tests/save_restore_vm.py", line 38, in run
[stderr]     vm.save_to_file(save_file)
[stderr]   File "/usr/local/lib/python3.10/site-packages/virttest/qemu_vm.py", line 4739, in save_to_file
[stderr]     qemu_migration.monitor.set_downtime(self, 0.03)
[stderr] AttributeError: module 'virttest.qemu_migration' has no attribute 'monitor'

But, this test is PASS with --vt-type libvirt

[root@sut~]# avocado run --vt-type libvirt --vt-guest-os Fedora.36.aarch64 --vt-machine-type arm64-mmio  io-github-autotest-qemu.save_restore.lifecycle_short
JOB ID     : 8aac6bf492f52e92da1161267ed94822e1e5bc1e
JOB LOG    : /root/avocado/job-results/job-2022-06-14T19.28-8aac6bf/job.log
 (1/1) io-github-autotest-qemu.save_restore.lifecycle_short: STARTED
 (1/1) io-github-autotest-qemu.save_restore.lifecycle_short: PASS (579.41 s)

Thanks,

PaulYuuu commented 2 years ago

It should be a typo in https://github.com/avocado-framework/avocado-vt/blob/master/virttest/qemu_vm.py#L4796

        # Restore the speed and downtime to default values
        qemu_migration.set_speed(self, str(32 << 20))
        qemu_migration.monitor.set_downtime(self, 0.03).   <-------- here
        # Base class defines VM must be off after a save
        self.monitor.cmd("system_reset")
PaulYuuu commented 2 years ago

Can refer to this: https://github.com/avocado-framework/avocado-vt/pull/3488

nhanldtn commented 2 years ago

Thank you for your support!!