Description of problem: 'rss' field is missing in dom->memory_stats(). It is undef now. The problem only happens in RHEL-AV 8.1 build. It works with perl-Sys-Virt-5.0.0-1.module+el8.1.0+3164+94495c71.x86_64 and perl-Sys-Virt-4.5.0-4.module+el8.1.0+2983+b2ae9c0a.x86_64 , but does not work with perl-Sys-Virt-5.0.0-1.module+el8.1.0+3258+4c45705b.x86_64. So it is a regression. Version-Release number of selected component (if applicable): perl-Sys-Virt-5.0.0-1.module+el8.1.0+3258+4c45705b.x86_64 How reproducible: 100% Steps to Reproduce: 1. Using APIs to create and start domain and get memory statistic. my $xml = $tck->generic_domain(name => "tck", fullos => 1)->as_xml; my $dom; ok_domain(sub { $dom = $conn->define_domain($xml) }, "created persistent domain object"); $dom->create; my $rss = $dom->memory_stats()->{rss}; diag "rss:$rss"; ... my $qemu_rss = `ps -u qemu -o rss | awk -F \[\\ \] '{print \$1}'`; diag $qemu_rss; $qemu_rss =~ s/^\s+|\n+$//g; is($qemu_rss, $rss, "Get 'rss' is $rss"); # libvirt-tck --testdir scripts/domain/111-memory-stats.t -v --force # rss: <=== This is a problem not ok 13 - Get 'rss' is # Failed test 'Get 'rss' is ' # at scripts/domain/111-memory-stats.t line 84. # got: '498168' <=== This is a correct value # expected: undef <=== This is a problem 2. Using virsh to get the value # virsh dommemstat tck actual 1048576 swap_in 0 swap_out 0 major_fault 625 minor_fault 230108 unused 549948 available 840980 usable 591224 last_update 1560743234 disk_caches 155056 hugetlb_pgalloc 0 hugetlb_pgfail 0 rss 498168 <=== It is correct value 3. Actual results: 'rss' can not be achieved from the API $dom->memory_stats() Expected results: 'rss' can be achieved from the API $dom->memory_stats() as before Additional info:
I finally figured out whats wrong here. The memory stats API requires the caller to preallocate an array to hold stats. The array size is given by the VIR_DOMAIN_MEMORY_STAT_NR constant. In libvirt 5.4.0 a new memory stat was created, meaning VIR_DOMAIN_MEMORY_STAT_NR increased in size. The perl-Sys-Virt binding was still compiled against older libvirt 5.0.0, so the VIR_DOMAIN_MEMORY_STAT_NR value its passing is too small. This means the perl binding was missing 1 memory stat, which happened to be the 'rss' field since that is the last value to be added to the array. IOW, this will be fixed when we rebase.
Package: perl-Sys-Virt-5.6.0-1.module+el8.1.0+3908+8a8c5ed4.x86_64 libvirt-5.6.0-2.module+el8.1.0+4015+63576633.x86_64 /var/tmp/libvirt-ci/runtest/libvirt-tck/libvirt-tck/scripts/domain/111-memory-stats.t .. 1..13 current perl-Sys-Virt version:5.6.0 ok 1 - created persistent domain object # Start domain ok 2 - running domain has an ID > 0 # Waiting 30 seconds for guest to finish booting # Set period on which guests memory stats are refreshed ok 3 - Set period to 10 # Get memory statistic when domain is active ok 4 - Get 'swap_in' is 0 ok 5 - Get 'swap_out' is 0 ... ok 13 - Get 'rss' is 551644 <=== Fixed Verified.
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. https://access.redhat.com/errata/RHBA-2019:3723