Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def run_test():
check_dimm_mem_device_xml(
{init_alias_name: init_xpath_list, plug_alias_name: plug_xpath_list})

virsh.managedsave(vm_name, **virsh_dargs)
Copy link
Copy Markdown
Contributor

@iccaszhulili iccaszhulili Mar 25, 2026

Choose a reason for hiding this comment

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

Hi, I checked the managedsave function in libvirt_vm.py.

def managedsave(self):
"""
Managed save of VM's state
"""
if self.is_dead():
raise virt_vm.VMStatusError("Cannot save a VM that is %s" % self.state())
LOG.debug("Managed saving VM %s" % self.name)
result = virsh.managedsave(self.name, uri=self.connect_uri)
if result.exit_status:
raise virt_vm.VMError(
"Managed save VM failed.\n" "Detail: %s." % result.stderr_text
)
if self.is_alive():
raise virt_vm.VMStatusError("VM not shut off after managed save")
self.cleanup_serial_console()

There is no option for debug. For the virsh object. its debug option is default to false
`class VirshBase(propcan.PropCanBase):
"""
Base Class storing libvirt Connection & state to a host
"""

__slots__ = ("uri", "ignore_status", "debug", "virsh_exec", "readonly")

def __init__(self, *args, **dargs):
    """
    Initialize instance with virsh_exec always set to something
    """
    init_dict = dict(*args, **dargs)
    init_dict["virsh_exec"] = init_dict.get("virsh_exec", VIRSH_EXEC)
    init_dict["uri"] = init_dict.get("uri", None)
    init_dict["debug"] = init_dict.get("debug", False)
    init_dict["ignore_status"] = init_dict.get("ignore_status", False)
    init_dict["readonly"] = init_dict.get("readonly", False)
    super(VirshBase, self).__init__(init_dict)

`

In the original code, virsh_dargs = {"debug": True, "ignore_status": False}. How can we replace virsh.managedsave to vm.managedsave while enabling debug?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for vm.managedsave(), we don't need any parameter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes. There is no way to enable debug. Do we need to add a parameter to vm.managedsave in avocado-vt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not very necessary, vm.managedsave() handles error scenarios, I think that's enough.

vm.managedsave()
vm.start()
check_dimm_mem_device_xml(
{init_alias_name: init_xpath_list, plug_alias_name: plug_xpath_list})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def run_test():
virsh.restore(state_file, ignore_status=False, debug=True)
check_virtio_mem_device_xml({init_alias_name: init_xpath_list, plug_alias_name: plug_xpath_list})

virsh.managedsave(vm_name, ignore_status=False, debug=True)
vm.managedsave()
vm.start()
check_virtio_mem_device_xml({init_alias_name: init_xpath_list, plug_alias_name: plug_xpath_list})

Expand Down
Loading