[libvirt] [PATCH tck] 202-numa-set-parameters.t: use AFFECT_CONFIG when changing nodeset

Mike Latimer mlatimer at suse.com
Wed Apr 9 21:12:47 UTC 2014


The 202-numa-set-parameters.t test sets NUMA_NODESET using AFFECT_LIVE on a
running domain, destroys and starts the domain, then verifies the NUMA_NODESET
setting. As AFFECT_LIVE does not write the setting to the domain xml file,
the new nodeset setting is lost when the domain is destroyed and the test
fails.

This patch adds AFFECT_CONFIG to set_numa_parameters, so both the live
environment and the xml file are updated with the new setting. An additional
test was also added, before the domain is destroyed, to ensure the nodeset
change is seen on the live domain.

---
 scripts/domain/202-numa-set-parameters.t | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/domain/202-numa-set-parameters.t b/scripts/domain/202-numa-set-parameters.t
index 886a979..f5ed871 100644
--- a/scripts/domain/202-numa-set-parameters.t
+++ b/scripts/domain/202-numa-set-parameters.t
@@ -28,7 +28,7 @@ after the API call to set NUMA parameters for a domain.
 use strict;
 use warnings;
 
-use Test::More tests => 12;
+use Test::More tests => 13;
 
 use Sys::Virt::TCK;
 use Test::Exception;
@@ -57,8 +57,12 @@ my %params = (
     Sys::Virt::Domain::NUMA_NODESET => '0',
 );
 
-diag "Set numa parameters, affects live config";
-lives_ok(sub {$dom->set_numa_parameters(\%params, Sys::Virt::Domain::AFFECT_LIVE)}, "set_numa_parameters");
+diag "Set numa parameters, affects live and config";
+lives_ok(sub {$dom->set_numa_parameters(\%params, Sys::Virt::Domain::AFFECT_LIVE | Sys::Virt::Domain::AFFECT_CONFIG)}, "set_numa_parameters");
+
+diag "Get numa parameters";
+my $params = $dom->get_numa_parameters(Sys::Virt::Domain::AFFECT_LIVE);
+ok($params->{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset');
 
 diag "Destroy the domain";
 $dom->destroy;
@@ -68,7 +72,7 @@ $dom->create;
 ok($dom->get_id > 0, "running domain with ID > 0");
 
 diag "Get numa parameters";
-my $params = $dom->get_numa_parameters(Sys::Virt::Domain::AFFECT_LIVE);
+$params = $dom->get_numa_parameters(Sys::Virt::Domain::AFFECT_LIVE);
 ok($params->{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset');
 
 diag "Destroy the domain";
-- 
1.8.4.5




More information about the libvir-list mailing list