Bug 1028846 - $dom->get_block_job_info get wrong type and end
$dom->get_block_job_info get wrong type and end
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-10 22:31 EST by weizhang
Modified: 2014-06-17 20:58 EDT (History)
7 users (show)

See Also:
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 07:39:19 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description weizhang 2013-11-10 22:31:08 EST
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 Berrange 2013-12-02 11:58:47 EST
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 04:23:26 EST
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 07:39:19 EDT
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.

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