Description of problem: In perl-Sys-Virt doc, it said that $dom->pm_wakeup() Wakeup the guest from power management suspend state $dom->pm_suspend_for_duration($target, $duration, $flags=0) The $flags parameter is optional and defaults to zero. But in real test, this 2 function can not be used without flags parameter and report error Usage: Sys::Virt::Domain::pm_suspend_for_duration(dom, target, duration, flags) at perl-pmsus.pl line 12. Usage: Sys::Virt::Domain::pm_wakeup(dom, flags) at perl-pmsus.pl line 15 Version-Release number of selected component (if applicable): perl-Sys-Virt-0.10.2-3.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. Prepare a guest named rhel6u3 with qemu-guest-agent running in guest and with xml ... <os> <type arch='x86_64' machine='rhel6.4.0'>hvm</type> <loader>/usr/share/seabios/bios-pm.bin</loader> <boot dev='hd'/> </os> ... <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/rhel6u3.agent'/> <target type='virtio' name='org.qemu.guest_agent.0'/> <alias name='channel0'/> <address type='virtio-serial' controller='0' bus='0' port='1'/> </channel> ... 2. Run script # perl perl-pmsus.pl #!/usr/bin/perl use warnings; use strict; use Sys::Virt; my $uri = "qemu:///system"; my $domname = "rhel6u3"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $dom = $con->get_domain_by_name($domname); $dom->pm_suspend_for_duration(Sys::Virt::NODE_SUSPEND_TARGET_MEM, 0); $dom->pm_wakeup(); 3. Change above $dom->pm_suspend_for_duration(Sys::Virt::NODE_SUSPEND_TARGET_MEM, 0); to $dom->pm_suspend_for_duration(Sys::Virt::NODE_SUSPEND_TARGET_MEM, 0, 0); and run again Actual results: failed with error 2. Usage: Sys::Virt:omain:m_suspend_for_duration(dom, target, duration, flags) at perl-pmsus.pl line 12. 3. Usage: Sys::Virt:omain:m_wakeup(dom, flags) at perl-pmsus.pl line 15 Expected results: All succeed Additional info:
commit 7ac766c88f87b3e98a03d2f610b8228e802c50b7 Author: Daniel P. Berrange <berrange> Date: Fri Nov 16 13:27:19 2012 +0000 Ensure flags default to 0 for PM suspend/wakeup APIs The $conn->node_suspend_for_duration method also had the same mistake
Verify pass on perl-Sys-Virt-0.10.2-4.el6.x86_64 use the script #!/usr/bin/perl use warnings; use strict; use Sys::Virt; my $uri = "qemu:///system"; my $domname = "rhel6u3"; my $con = Sys::Virt->new(address => $uri, readonly => 0); my $dom = $con->get_domain_by_name($domname); $dom->pm_suspend_for_duration(Sys::Virt::NODE_SUSPEND_TARGET_MEM, 0); $dom->pm_wakeup(); $con->node_suspend_for_duration(Sys::Virt::NODE_SUSPEND_TARGET_MEM, 60); no error occurred, so verify pass
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-0377.html