Re: [libvirt] [libvirt-tck PATCH] New test to test numa parameters tuning APIs
On 2012年08月29日 16:15, Guannan Ren wrote: On 08/29/2012 12:01 AM, Osier Yang wrote: To make sure the domain config is not broken after the API calls. --- This depends on https://www.redhat.com/archives/libvir-list/2012-August/msg01792.html --- scripts/domain/202-numa-set-parameters.t | 99 ++ 1 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 scripts/domain/202-numa-set-parameters.t diff --git a/scripts/domain/202-numa-set-parameters.t b/scripts/domain/202-numa-set-parameters.t new file mode 100644 index 000..fd96866 --- /dev/null +++ b/scripts/domain/202-numa-set-parameters.t @@ -0,0 +1,99 @@ +# -*- perl -*- +# +# Copyright (C) 2009-2012 Red Hat, Inc. +# Copyright (C) 2012 Osier Yang +# +# This program is free software; You can redistribute it and/or modify +# it under the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any +# later version +# +# The file LICENSE distributed along with this file provides full +# details of the terms and conditions +# + +=pod + +=head1 NAME + +domain/212-set-numa-parameters.t - Set NUMA parameters + +=head1 DESCRIPTION + +The test case validates the internal data structure is consistent +after the API call to set NUMA parameters for a domain. + +=cut + +use strict; +use warnings; + +use Test::More tests = 10; + +use Sys::Virt::TCK; +use Test::Exception; + +my $tck = Sys::Virt::TCK-new(); +my $conn = eval { $tck-setup(); }; +BAIL_OUT failed to setup test harness: $@ if $@; +END { + $tck-cleanup if $tck; + unlink tck.img if -f tck.img; +} + + +my $xml = $tck-generic_domain(tck)-as_xml; + +diag Creating a new persistent domain; +my $dom; +ok_domain(sub { $dom = $conn-define_domain($xml) }, created persistent domain object); + +diag Starting inactive domain; +$dom-create; +ok($dom-get_id 0, running domain with ID 0); + +# NUMA mode can't be changed for a live domain +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 Destroy the domain; +$dom-destroy; + +diag Make sure the domain can be started after setting numa parameters; +$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); +ok($params-{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset'); + +diag Destroy the domain; +$dom-destroy; + +$params{Sys::Virt::Domain::NUMA_MODE} = Sys::Virt::Domain::NUMATUNE_MEM_STRICT; + +diag Set numa parameters, affects next boot; +lives_ok(sub {$dom-set_numa_parameters(\%params, Sys::Virt::Domain::AFFECT_CONFIG)}, set_numa_parameters); + +diag Get numa parameters; +my $params = $dom-get_numa_parameters(Sys::Virt::Domain::AFFECT_LIVE); it should be Sys::Virt::Domain::AFFECT_CURRENT? ACK with this fixed Guannan Thanks, pushed. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-tck PATCH] New test to test numa parameters tuning APIs
On 08/29/2012 12:01 AM, Osier Yang wrote: To make sure the domain config is not broken after the API calls. --- This depends on https://www.redhat.com/archives/libvir-list/2012-August/msg01792.html --- scripts/domain/202-numa-set-parameters.t | 99 ++ 1 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 scripts/domain/202-numa-set-parameters.t diff --git a/scripts/domain/202-numa-set-parameters.t b/scripts/domain/202-numa-set-parameters.t new file mode 100644 index 000..fd96866 --- /dev/null +++ b/scripts/domain/202-numa-set-parameters.t @@ -0,0 +1,99 @@ +# -*- perl -*- +# +# Copyright (C) 2009-2012 Red Hat, Inc. +# Copyright (C) 2012 Osier Yang +# +# This program is free software; You can redistribute it and/or modify +# it under the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any +# later version +# +# The file LICENSE distributed along with this file provides full +# details of the terms and conditions +# + +=pod + +=head1 NAME + +domain/212-set-numa-parameters.t - Set NUMA parameters + +=head1 DESCRIPTION + +The test case validates the internal data structure is consistent +after the API call to set NUMA parameters for a domain. + +=cut + +use strict; +use warnings; + +use Test::More tests = 10; + +use Sys::Virt::TCK; +use Test::Exception; + +my $tck = Sys::Virt::TCK-new(); +my $conn = eval { $tck-setup(); }; +BAIL_OUT failed to setup test harness: $@ if $@; +END { +$tck-cleanup if $tck; +unlink tck.img if -f tck.img; +} + + +my $xml = $tck-generic_domain(tck)-as_xml; + +diag Creating a new persistent domain; +my $dom; +ok_domain(sub { $dom = $conn-define_domain($xml) }, created persistent domain object); + +diag Starting inactive domain; +$dom-create; +ok($dom-get_id 0, running domain with ID 0); + +# NUMA mode can't be changed for a live domain +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 Destroy the domain; +$dom-destroy; + +diag Make sure the domain can be started after setting numa parameters; +$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); +ok($params-{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset'); + +diag Destroy the domain; +$dom-destroy; + +$params{Sys::Virt::Domain::NUMA_MODE} = Sys::Virt::Domain::NUMATUNE_MEM_STRICT; + +diag Set numa parameters, affects next boot; +lives_ok(sub {$dom-set_numa_parameters(\%params, Sys::Virt::Domain::AFFECT_CONFIG)}, set_numa_parameters); + +diag Get numa parameters; +my $params = $dom-get_numa_parameters(Sys::Virt::Domain::AFFECT_LIVE); it should be Sys::Virt::Domain::AFFECT_CURRENT? ACK with this fixed Guannan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-tck PATCH] New test to test numa parameters tuning APIs
To make sure the domain config is not broken after the API calls. --- This depends on https://www.redhat.com/archives/libvir-list/2012-August/msg01792.html --- scripts/domain/202-numa-set-parameters.t | 99 ++ 1 files changed, 99 insertions(+), 0 deletions(-) create mode 100644 scripts/domain/202-numa-set-parameters.t diff --git a/scripts/domain/202-numa-set-parameters.t b/scripts/domain/202-numa-set-parameters.t new file mode 100644 index 000..fd96866 --- /dev/null +++ b/scripts/domain/202-numa-set-parameters.t @@ -0,0 +1,99 @@ +# -*- perl -*- +# +# Copyright (C) 2009-2012 Red Hat, Inc. +# Copyright (C) 2012 Osier Yang +# +# This program is free software; You can redistribute it and/or modify +# it under the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any +# later version +# +# The file LICENSE distributed along with this file provides full +# details of the terms and conditions +# + +=pod + +=head1 NAME + +domain/212-set-numa-parameters.t - Set NUMA parameters + +=head1 DESCRIPTION + +The test case validates the internal data structure is consistent +after the API call to set NUMA parameters for a domain. + +=cut + +use strict; +use warnings; + +use Test::More tests = 10; + +use Sys::Virt::TCK; +use Test::Exception; + +my $tck = Sys::Virt::TCK-new(); +my $conn = eval { $tck-setup(); }; +BAIL_OUT failed to setup test harness: $@ if $@; +END { +$tck-cleanup if $tck; +unlink tck.img if -f tck.img; +} + + +my $xml = $tck-generic_domain(tck)-as_xml; + +diag Creating a new persistent domain; +my $dom; +ok_domain(sub { $dom = $conn-define_domain($xml) }, created persistent domain object); + +diag Starting inactive domain; +$dom-create; +ok($dom-get_id 0, running domain with ID 0); + +# NUMA mode can't be changed for a live domain +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 Destroy the domain; +$dom-destroy; + +diag Make sure the domain can be started after setting numa parameters; +$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); +ok($params-{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset'); + +diag Destroy the domain; +$dom-destroy; + +$params{Sys::Virt::Domain::NUMA_MODE} = Sys::Virt::Domain::NUMATUNE_MEM_STRICT; + +diag Set numa parameters, affects next boot; +lives_ok(sub {$dom-set_numa_parameters(\%params, 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_MODE} == Sys::Virt::Domain::NUMATUNE_MEM_STRICT, 'Check mode'); +ok($params-{Sys::Virt::Domain::NUMA_NODESET} eq '0', 'Check nodeset'); + +diag Make sure the domain can be started after setting numa parameters; +$dom-create; +ok($dom-get_id 0, running domain with ID 0); + +diag Destroying the persistent domain; +$dom-destroy; +$dom-undefine; + +diag Checking that transient domain has gone away; +ok_error(sub { $conn-get_domain_by_name(tck) }, NO_DOMAIN error raised from missing domain, +Sys::Virt::Error::ERR_NO_DOMAIN); + +# end -- 1.7.7.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list