Bug 848309

Summary: Can not set device_weight with set_blkio_parameters
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: perl-Sys-VirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3CC: ajia, dyuan, mzhan, ydu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: perl-Sys-Virt-0.10.2-2.el6 Doc Type: Bug Fix
Doc Text:
Cause: The Perl binding was setting an incompatible flag for the set_blkio_parameters API Consequence: It was not possible to use the set_blkio_parameters API to apply block tuning Fix: The incorrect flag was removed Result: The set_blkio_parameters API can be used
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 09:52:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description weizhang 2012-08-15 08:52:59 UTC
Description of problem:
When try to setting device_weight with set_blkio_parameters, it reports error
libvirt error code: 8, message: unsupported flags (0x4) in function qemuDomainSetBlkioParameters

Version-Release number of selected component (if applicable):
libvirt-0.10.0-0rc0.el6.x86_64
perl-Sys-Virt-0.9.10-4.el6.x86_64
kernel-2.6.32-289.el6.x86_64
qemu-kvm-0.12.1.2-2.302.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
1.# cat perl-example.pl
#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;

my $uri = "qemu:///system";
my $domname = "vr-rhel6u3-x86_64-kvm";
my $flags = 0;
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my $weight = 600;
my $device_weight = '/dev/sda,500';
my %blkio = (Sys::Virt::Domain::BLKIO_WEIGHT => $weight, Sys::Virt::Domain::BLKIO_DEVICE_WEIGHT => $device_weight);
$dom->set_blkio_parameters(\%blkio);
my $current_weight = $dom->get_blkio_parameters();
print $current_weight->{weight},"\n";
print $current_weight->{device_weight},"\n";

# perl perl-example.pl

Actual results:
libvirt error code: 8, message: unsupported flags (0x4) in function qemuDomainSetBlkioParameters

Expected results:
Blkio_device_weight can be set successfully, script executed without error.

Additional info:

Comment 1 weizhang 2012-08-20 11:35:41 UTC
I also can not set flag for get_blkio_parameters/set_blkio_parameters which include
VIR_DOMAIN_AFFECT_CURRENT = 0	 : Affect current domain state.
VIR_DOMAIN_AFFECT_LIVE	= 1	: Affect running domain state.
VIR_DOMAIN_AFFECT_CONFIG = 2	: Affect persistent domain state.


Usage get from man page
$dom->set_blkio_parameters($params, $flags=0)
my $params = $dom->get_blkio_parameters($flags=0)

%params = (Sys::Virt::Domain::BLKIO_WEIGHT => 600);
When I call
$dom->set_blkio_parameters(\%params, 1);
it will report usage error
Usage: Sys::Virt::Domain::set_blkio_parameters(dom, newparams)

When I call
$dom->get_blkio_parameters(1);
it will report usage error
Usage: Sys::Virt::Domain::get_blkio_parameters(dom)

Without flag, it works fine.

Comment 2 Daniel Berrangé 2012-09-26 11:11:45 UTC
The missing flags parameters are fixed in

commit e5b0948d4037c836b76bbfe22d7f91c8ce597362
Author: Osier Yang <jyang>
Date:   Tue Aug 28 23:52:24 2012 +0800

    Fix several APIs
    
    These APIs accept one more argument (flags), which was ignored in
    the XS implementations.

Comment 4 weizhang 2012-09-29 06:46:55 UTC
Hi DB,

What about the Description problem in https://bugzilla.redhat.com/show_bug.cgi?id=848309#c0 ? Is that won't fix, or not a bug?

Comment 5 Daniel Berrangé 2012-10-12 08:02:45 UTC
> libvirt error code: 8, message: unsupported flags (0x4) in function qemuDomainSetBlkioParameters

Oh, i missed that. This is another problem. The perl binding should not be setting the VIR_TYPED_PARAM_STRING_OKAY flag here.

Comment 7 weizhang 2012-10-15 07:10:25 UTC
Verify pass on perl-Sys-Virt-0.10.2-2.el6.x86_64

with the following scripts
#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;

my $uri = "qemu:///system";
my $domname = "vr-rhel6u3-x86_64-kvm";
my $flags = 0;
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
my $weight = 800;
my $device_weight = '/dev/sda,800';
my $weight2 = 700;
my $device_weight2 = '/dev/sda,700';
my %blkio = (Sys::Virt::Domain::BLKIO_WEIGHT => $weight, Sys::Virt::Domain::BLKIO_DEVICE_WEIGHT => $device_weight);
$dom->set_blkio_parameters(\%blkio, 1);

my %blkio2 = (Sys::Virt::Domain::BLKIO_WEIGHT => $weight2, Sys::Virt::Domain::BLKIO_DEVICE_WEIGHT => $device_weight2);
$dom->set_blkio_parameters(\%blkio2, 2);

my $current_weight = $dom->get_blkio_parameters(1);
print "current weight, $current_weight->{weight}\n";
print "current device weight, $current_weight->{device_weight}\n";

my $config_weight = $dom->get_blkio_parameters(2);
print "config weight, $config_weight->{weight} \n";
print "config device weight, $config_weight->{device_weight} \n";


result is
current weight, 800
current device weight, /dev/sda,800
config weight, 700 
config device weight, /dev/sda,700 

as expected

Comment 9 errata-xmlrpc 2013-02-21 09:52:19 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