Bug 873203 - pm_suspend_for_duration and pm_wakeup parameters flags are not optional
Summary: pm_suspend_for_duration and pm_wakeup parameters flags are not optional
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: perl-Sys-Virt
Version: 6.4
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Daniel Berrangé
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 881827
TreeView+ depends on / blocked
 
Reported: 2012-11-05 10:48 UTC by weizhang
Modified: 2013-02-21 09:52 UTC (History)
6 users (show)

Fixed In Version: perl-Sys-Virt-0.10.2-4.el6
Doc Type: Bug Fix
Doc Text:
Cause: The flags parameters for several methods was missing its default value Consequence: Callers of the API had to supply the flags parameter even though it should be optional Fix: The default values were added Result: The flags method is now optional for pm_suspend_for_duration and pm_wakeup
Clone Of:
Environment:
Last Closed: 2013-02-21 09:52:33 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0377 0 normal SHIPPED_LIVE perl-Sys-Virt bug fix and enhancement update 2013-02-20 20:52:18 UTC

Description weizhang 2012-11-05 10:48:51 UTC
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:

Comment 1 Daniel Berrangé 2012-11-16 14:38:08 UTC
commit 7ac766c88f87b3e98a03d2f610b8228e802c50b7
Author: Daniel P. Berrange <berrange@redhat.com>
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

Comment 3 weizhang 2012-11-20 05:59:38 UTC
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

Comment 5 errata-xmlrpc 2013-02-21 09:52:33 UTC
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


Note You need to log in before you can comment on or make changes to this bug.