Bug 1028846

Summary: $dom->get_block_job_info get wrong type and end
Product: Red Hat Enterprise Linux 7 Reporter: weizhang <weizhan>
Component: libvirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, berrange, dyuan, jmiao, mzhan, weizhan, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.1.1-14.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:39: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 2013-11-11 03:31:08 UTC
Description of problem:
$dom->get_block_job_info can not get correct value for type and end

Version-Release number of selected component (if applicable):
perl-Sys-Virt-1.1.1-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.cat test.pl
#!/usr/bin/perl
use warnings;
use strict;
use Sys::Virt;
 
my $uri = "qemu:///system";
my $domname = "tck";
my $con = Sys::Virt->new(address => $uri, readonly => 0);
my $dom = $con->get_domain_by_name($domname);
 
my $jobinfo;
my $pathmain = "/var/cache/libvirt-tck/storage-fs/tck/tck-main";

$jobinfo = $dom->get_block_job_info($pathmain, 0);
while(my ($k, $v) = each %{$jobinfo}) {
    print "$k => $v\n";
}

2. Start a guest with xml
<domain type="kvm">
   <name>tck</name>
   <memory>65536</memory>
   <currentMemory>65536</currentMemory>
   <os>
     <type>hvm</type>
     <kernel>/var/cache/libvirt-tck/os-x86_64-hvm/vmlinuz</kernel>
     <initrd>/var/cache/libvirt-tck/os-x86_64-hvm/initrd</initrd>
   </os>
   <features>
     <acpi />
     <apic />
   </features>
   <devices>
     <disk type="file">
       <source file="/var/cache/libvirt-tck/os-x86_64-hvm/disk.img" />
       <target dev="vda" />
     </disk>
     <disk type="file">
       <driver name="qemu" type="qcow2" />
       <source file="/var/cache/libvirt-tck/storage-fs/tck/tck-main" />
       <target dev="vdb" />
     </disk>
     <console type="pty" />
   </devices>
</domain>

3. run #perl test.pl

Actual results:
cur => 0
bandwidth => 16302096
type => 18577664
end => 16746808

Expected results:
"type" and "end" should be 0 when no block job, and not sure if bandwidth is right because it is different from rhel6 test result

Additional info:

Comment 1 Daniel Berrangé 2013-12-02 16:58:47 UTC
This is a libvirt bug - it isn't zero'ing out the fields of the block job info struct

https://www.redhat.com/archives/libvir-list/2013-December/msg00101.html

Comment 4 Jincheng Miao 2013-12-09 09:23:26 UTC
In libvirt-1.1.1-13.el7.x86_64, the get_block_job_info will output random numbers, even if there is no block job performed:
# while true; do perl test.pl; sleep 1;done
cur => 0
bandwidth => 30175248
type => 31177832
end => 30738240

cur => 0
bandwidth => 21766160
type => 22768744
end => 22329152

cur => 0
bandwidth => 26107920
type => 27110504
end => 26670912

cur => 0
bandwidth => 10289168
type => 11291752
end => 10852160

And this bug is fixed in libvirt-1.1.1-14.el7. The job info will show the right number when block copy occurs, like:
cur => 0
bandwidth => 0
type => 0
end => 0

cur => 9346875392
bandwidth => 0
type => 2
end => 10737418240

cur => 9438035968
bandwidth => 0
type => 2
end => 10737418240

cur => 9591455744
bandwidth => 0
type => 2
end => 10737418240

So I will set this bug as VERIFIED.

Comment 5 Ludek Smid 2014-06-13 11:39:19 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.