Package: qemu-guest-agent
Version: 1:10.0.2+ds-1

Dear qemu maintainer(s),

it seems the qemu-guest-agent package (at least the one shipped in
Debian trixie) contains a logic bug that can prevent a suspend-to-mem or
suspend-to-disk command from executing.


The VM in question is a freshly installed Debian trixie guest with
qemu-guest-agent version 1:10.0.2+ds-1 installed.


What I did
----------
I called "virsh dompmsuspend <vm-name> --target disk" on the hypervisor.


What I expected to happen
-------------------------
guest suspends to disk


What actually happened
----------------------

guest did not suspend, and instead I got this error output:

error: Domain '<vm-name>' could not be suspended
error: guest agent command failed: unable to execute QEMU agent command
'guest-suspend-disk': suspend: cannot write to '/sys/power/state':
Failed to create file “/sys/power/state.36DK82”: Permission denied


Suggested Fix/Workaround
------------------------

I believe the actual write attempt is performed in this location:
  qga/commands-linux.c at line 1412 [1].

It is possible the g_file_set_contents() function internally tries to
create a temporary file in the same folder as the target file, probably
to prevent losing the original file contents in case of any error during
write.

I suggest changing this to a plain old fopen() -> fwrite() -> fclose()
call sequence since there is no danger of data loss on sysfs writes.


Thank you for your time,

- Danny Edel


[1]:
https://sources.debian.org/src/qemu/1:10.0.2+ds-1/qga/commands-linux.c/?hl=1412#L1412

Reply via email to