RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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:
Embargoed:


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>
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.