Re: 答复: I'm now looking into kvm-unit-tests and encounted with some problems.

2015-09-08 Thread Lucas Meneghel Rodrigues

Paolo,

I did try with unrestricted_guest=0, and I'm still getting the failure.

On Mon, Sep 7, 2015 at 9:32 AM, Paolo Bonzini <pbonz...@redhat.com> 
wrote:



On 02/09/2015 05:33, Guoyanjuan wrote:

 Hi,  I found my code is old and I git the latest code from
 
<https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git>https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git,

 some problems are solved but one.

 when I run emulate unittest, it failed.

 command:
 qemu-kvm --enable-kvm -device pc-testdev -device
 isa-debug-exit,iobase=0xf4,iosize=0x4 -serial stdio -device
 pci-testdev -kernel x86/emulator.flat -vnc none

 logs:
 FAIL: mov null, %ss


Lucas Meneghel Rodrigues also reproduced this, it seems to be 
processor

dependent.  I haven't debugged it yet because it doesn't reproduce on
the two systems I've tested on (Ivy Bridge i7 and Haswell Xeon E5).

Can you please also try loading the kvm-intel module with the
"unrestricted_guest=0" parameter, and see if it also reproduce?

It might be a processor bug too.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] updated: kvm networking todo wiki

2013-05-23 Thread Lucas Meneghel Rodrigues

On 23/05/13 05:50 AM, Michael S. Tsirkin wrote:

Hey guys,
I've updated the kvm networking todo wiki with current projects.
Will try to keep it up to date more often.
Original announcement below.



I've put up a wiki page with a kvm networking todo list,
mainly to avoid effort duplication, but also in the hope
to draw attention to what I think we should try addressing
in KVM:

http://www.linux-kvm.org/page/NetworkingTodo

This page could cover all networking related activity in KVM,
currently most info is related to virtio-net.

Note: if there's no developer listed for an item,
this just means I don't know of anyone actively working
on an issue at the moment, not that no one intends to.

I would appreciate it if others working on one of the items on this list
would add their names so we can communicate better.  If others like this
wiki page, please go ahead and add stuff you are working on if any.

It would be especially nice to add autotest projects:
there is just a short test matrix and a catch-all
'Cover test matrix with autotest', currently.


Ok, I'll take a look and fill in with currently available networking tests.


Currently there are some links to Red Hat bugzilla entries,
feel free to add links to other bugzillas.

Thanks!



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unittests v2 1/4] Add run_tests.sh

2013-04-12 Thread Lucas Meneghel Rodrigues
On Fri, 2013-04-12 at 13:27 +0200, Kevin Wolf wrote:
 This adds a convenient way to run all tests without having to set up
 Autotest.
 
 Signed-off-by: Kevin Wolf kw...@redhat.com
 ---
  run_tests.sh  | 123 
 ++
  x86-run   |   9 +++-
  x86/unittests.cfg |   2 +
  3 files changed, 132 insertions(+), 2 deletions(-)
  create mode 100755 run_tests.sh
 
 diff --git a/run_tests.sh b/run_tests.sh
 new file mode 100755
 index 000..55ecac5
 --- /dev/null
 +++ b/run_tests.sh
 @@ -0,0 +1,123 @@
 +#!/bin/bash
 +
 +testroot=x86
 +config=$testroot/unittests.cfg
 +qemu=${qemu:-qemu-system-x86_64}
 +verbose=0
 +
 +function run()
 +{
 +local testname=$1
 +local groups=$2
 +local smp=$3
 +local kernel=$4
 +local opts=$5
 +local arch=$6
 +
 +if [ -z $testname ]; then
 +return
 +fi
 +
 +if [ -n $only_group ]  ! grep -q $only_group $groups; then
 +return
 +fi
 +
 +if [ -n $arch ]  [ $arch != $ARCH ]; then
 +echo skip $1 ($arch only)
 +return
 +fi
 +
 +   cmdline=./x86-run $kernel -smp $smp -display none $opts
 +if [ $verbose != 0 ]; then
 +echo $cmdline
 +fi
 +
 +# extra_params in the config file may contain backticks that need to be
 +# expanded, so use eval to start qemu
 +eval $cmdline  test.log
 +
 +if [ $? -le 1 ]; then
 +echo -e \e[32mPASS\e[0m $1
 +else
 +echo -e \e[31mFAIL\e[0m $1
 +fi
 +}
 +
 +function run_all()
 +{
 +local config=$1
 +local testname
 +local smp
 +local kernel
 +local opts
 +local groups
 +local arch
 +
 +exec {config_fd}$config
 +
 +while read -u $config_fd line; do
 +if [[ $line =~ ^\[(.*)\]$ ]]; then
 +run $testname $groups $smp $kernel $opts $arch
 +testname=${BASH_REMATCH[1]}
 +smp=1
 +kernel=
 +opts=
 +groups=
 +arch=
 +elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then
 +kernel=$testroot/${BASH_REMATCH[1]}
 +elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then
 +smp=${BASH_REMATCH[1]}
 +elif [[ $line =~ ^extra_params\ *=\ *(.*)$ ]]; then
 +opts=${BASH_REMATCH[1]}
 +elif [[ $line =~ ^groups\ *=\ *(.*)$ ]]; then
 +groups=${BASH_REMATCH[1]}
 +elif [[ $line =~ ^arch\ *=\ *(.*)$ ]]; then
 +arch=${BASH_REMATCH[1]}
 +fi
 +done

^ This looks good to me, although using python and the ConfigParser
library would be less work (no need to explicitly use regexp based
parsing).

I'm currently taking a look at the new fields and how autotest could
make use of them... Thanks!


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] kvm-unit-test: more documentation and runner script

2013-02-28 Thread Lucas Meneghel Rodrigues

On 02/28/2013 06:51 AM, Gleb Natapov wrote:

On Thu, Feb 28, 2013 at 11:45:33AM +0200, Michael S. Tsirkin wrote:

On Thu, Feb 28, 2013 at 11:06:20AM +0200, Gleb Natapov wrote:

On Wed, Feb 27, 2013 at 11:40:37PM +0200, Michael S. Tsirkin wrote:

On Wed, Feb 27, 2013 at 06:03:41PM -0300, Lucas Meneghel Rodrigues wrote:

On 02/27/2013 05:44 PM, Michael S. Tsirkin wrote:

+Using qemu (supported since qemu 1.3):
+qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio -device 
isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel ./x86/msr.flat


I think it is worth here to point out that with new qemu, after the
unittest is done, the exit status of qemu is 1, different from the
'old style', whose exit status in successful completion is 0.


^ comment above




+exec ${command} $@


^ What about checking the exit status of qemu here and print
something like test $@ PASS or test $@ FAIL?


How do we know how to interpret it?
Overall I think it's best to rely on test output
than on return status.


See comment above. Well, test output may be good for humans, but it
is really not good for machines [1], that's why when the test suite
was developed, the convention was to make qemu to exit with a given
return code on success and others on failure.


Right but given a qemu binary, how do I find out what it is on success
and what it is on failure?


Since you know what device you are using you know expected value for
successful/failure.


So exit status is 1 for success 0 for failure?


For qemu-kvm, 0 success, non 0 for failure
For qemu upstream, shift that 1 bit.


As Lucas said above upstream is different from qemu-kvm unfortunately.
On upstream you need to shift return value right for 1 bit to get to
the tests return value (why?) and then 0 will be success otherwise failure.


On the why, It was Anthony's call. See, as the upstream test device 
doesn't have any ports we can write to to make qemu exit, we used 
another device that can do that. I vaguely remember he argued for the 
exit code to be shifted by 1 on that other device, and said it wasn't a 
problem for test suites, since they can define what is a success and 
what is a failure.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] kvm-unit-test: more documentation and runner script

2013-02-27 Thread Lucas Meneghel Rodrigues

On 02/27/2013 12:55 PM, Michael S. Tsirkin wrote:

Add documentation about using qemu-system for unit tests.
Add runner script to select the correct binary and flags.

Signed-off-by: Michael S. Tsirkin m...@redhat.com
---
  README  | 10 +-
  x86-run | 27 +++
  2 files changed, 36 insertions(+), 1 deletion(-)
  create mode 100755 x86-run

diff --git a/README b/README
index 4ceb869..214397c 100644
--- a/README
+++ b/README
@@ -10,10 +10,18 @@ To create the tests' images just type 'make' in this 
directory.
  Tests' images created in ./ARCH/*.flat

  An example of a test invocation:
-qemu-system-x86_64 -device testdev,chardev=testlog -chardev 
file,id=testlog,path=msr.out -serial stdio -kernel ./x86/msr.flat
+Using qemu-kvm:
+
+qemu-kvm -device testdev,chardev=testlog -chardev file,id=testlog,path=msr.out 
-serial stdio -kernel ./x86/msr.flat
  This invocation runs the msr test case. The test outputs to stdio.

+Using qemu (supported since qemu 1.3):
+qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio -device 
isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel ./x86/msr.flat


I think it is worth here to point out that with new qemu, after the 
unittest is done, the exit status of qemu is 1, different from the 'old 
style', whose exit status in successful completion is 0.



+Or use a runner script to detect the correct invocation:
+./x86-run ./x86/msr.flat
+To select a specific qemu binary, specify the QEMU=path environment:
+QEMU=/tmp/qemu/x86_64-softmmu/qemu-system-x86_64 ./x86-run ./x86/msr.flat

  Directory structure:
  .:  Makefile and config files for the tests
diff --git a/x86-run b/x86-run
new file mode 100755
index 000..cf1d38a
--- /dev/null
+++ b/x86-run
@@ -0,0 +1,27 @@
+#!/usr/bin/bash
+
+qemukvm=${QEMU:-qemu-kvm}
+qemusystem=${QEMU:-qemu-system-x86_64}
+if
+   ${qemukvm} -device '?' 21 | fgrep -e \testdev\ -e \pc-testdev\  
/dev/null;
+then
+   qemu=${qemukvm}
+else
+   if
+   ${qemsystem} -device '?' 21 | fgrep -e \testdev\ -e 
\pc-testdev\  /dev/null;
+   then
+   qemu=${qemusystem}
+   else
+   echo QEMU binary ${QEMU} has no support for test device. 
Exiting.
+   exit 1
+   fi
+fi
+
+if
+   ${qemu} -device '?' 21 | fgrep pc-testdev  /dev/null;
+then
+   command=${qemu} -enable-kvm -device pc-testdev -serial stdio -device 
isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
+else
+   command=${qemu} -device testdev,chardev=testlog -chardev 
file,id=testlog,path=msr.out -serial stdio -kernel ./x86/msr.flat
+fi
+exec ${command} $@


^ What about checking the exit status of qemu here and print something 
like test $@ PASS or test $@ FAIL?


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] kvm-unit-test: more documentation and runner script

2013-02-27 Thread Lucas Meneghel Rodrigues

On 02/27/2013 05:44 PM, Michael S. Tsirkin wrote:

+Using qemu (supported since qemu 1.3):
+qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio -device 
isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel ./x86/msr.flat


I think it is worth here to point out that with new qemu, after the
unittest is done, the exit status of qemu is 1, different from the
'old style', whose exit status in successful completion is 0.


^ comment above




+exec ${command} $@


^ What about checking the exit status of qemu here and print
something like test $@ PASS or test $@ FAIL?


How do we know how to interpret it?
Overall I think it's best to rely on test output
than on return status.


See comment above. Well, test output may be good for humans, but it is 
really not good for machines [1], that's why when the test suite was 
developed, the convention was to make qemu to exit with a given return 
code on success and others on failure. Anyway, it was just a suggestion, 
feel free to disregard it.


[1] having to parse the output and try to guess what is a pass or fail 
is a mess at best, and should be avoided unless we positively have no 
saner way of doing it.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH kvm-unit-test] get memory size from fwcfg

2013-02-11 Thread Lucas Meneghel Rodrigues

On 02/11/2013 11:10 AM, Gleb Natapov wrote:

Upstream test device does not implement port 0xd1.


I remember sending a similar patch a while ago, but it seems like it 
didn't get applied.


One thing that does occur to me - we will have to keep testing RHEL5, 
RHEL6 and Fedora with their old test devices. This change seems 
backwards compatible, since instead of using port 0xd1 we're getting RAM 
size from the firmware, which should work for both cases.


Given all that, this patch looks good to me. ACK.

Reviewed-by: Lucas Meneghel Rodrigues l...@redhat.com


Signed-off-by: Gleb Natapov g...@redhat.com
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 71b70fd..2852c6c 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -1,3 +1,4 @@
+#include fwcfg.h
  #include vm.h
  #include libcflat.h

@@ -185,16 +186,9 @@ static void setup_mmu(unsigned long len)
  printf(cr4 = %x\n, read_cr4());
  }

-static unsigned int inl(unsigned short port)
-{
-unsigned int val;
-asm volatile(inl %w1, %0 : =a(val) : Nd(port));
-return val;
-}
-
  void setup_vm()
  {
-end_of_memory = inl(0xd1);
+end_of_memory = fwcfg_get_u64(FW_CFG_RAM_SIZE);
  free_memory(edata, end_of_memory - (unsigned long)edata);
  setup_mmu(end_of_memory);
  }
diff --git a/x86/rmap_chain.c b/x86/rmap_chain.c
index 9add9b8..0df1bcb 100644
--- a/x86/rmap_chain.c
+++ b/x86/rmap_chain.c
@@ -1,6 +1,7 @@
  /* test long rmap chains */

  #include libcflat.h
+#include fwcfg.h
  #include vm.h
  #include smp.h

@@ -21,7 +22,7 @@ int main (void)

  setup_vm();

-nr_pages = inl(0xd1) / PAGE_SIZE;
+nr_pages = fwcfg_get_u64(FW_CFG_RAM_SIZE) / PAGE_SIZE;
  nr_pages -= 1000;
  target_page = alloc_page();

--
Gleb.



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] virt: Repairs Migration_multi_host_fd test Pylint correction.

2012-10-11 Thread Lucas Meneghel Rodrigues

On 10/11/2012 09:30 AM, Jiří Župka wrote:

Pylint correction makes migration_multi_host_fd test dysfunctional.


Ops, I'm sorry about that, applied!


pull-request: https://github.com/autotest/virt-test/pull/55

Signed-off-by: Jiří Župka jzu...@redhat.com
---
  kvm/tests/migration_multi_host_fd.py |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kvm/tests/migration_multi_host_fd.py 
b/kvm/tests/migration_multi_host_fd.py
index ec9210a..7f08205 100644
--- a/kvm/tests/migration_multi_host_fd.py
+++ b/kvm/tests/migration_multi_host_fd.py
@@ -105,7 +105,7 @@ def run_migration_multi_host_fd(test, params, env):
  s = self._create_server(mig_port)
  try:
  conn, _ = s.accept()
-fd = s.fileno()
+fd = conn.fileno()
  logging.debug(File descrtiptor %d used for
 migration. % (fd))




--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-04 Thread Lucas Meneghel Rodrigues

On 10/04/2012 07:48 AM, Jan Kiszka wrote:

On 2012-10-03 15:19, Paolo Bonzini wrote:

Il 03/10/2012 12:57, Lucas Meneghel Rodrigues ha scritto:

Yep, I did send patches with the testdev device present on qemu-kvm.git
to qemu.git a while ago, but there were many comments on the review, I
ended up not implementing everything that was asked and the patches were
archived.

If nobody wants to step up to port it, I'll re-read the original thread
and will spin up new patches (and try to go through the end with it).
Executing the KVM unittests is something that we can't afford to lose,
so I'd say it's important on this last mile effort to get rid of qemu-kvm.


Absolutely, IIRC the problem was that testdev did a little bit of
everything... let's see what's the functionality of testdev:

- write (port 0xf1), can be replaced in autotest with:
-device isa-debugcon,iobase=0xf1,chardev=...

- exit code (port 0xf4), see this series:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

- ram size (port 0xd1).  If we can also patch kvm-unittests, the memory
is available in the CMOS or in fwcfg.  Here is the SeaBIOS code:

 u32 rs = ((inb_cmos(0x34)  16) | (inb_cmos(0x35)  24));
 if (rs)
 rs += 16 * 1024 * 1024;
 else
 rs = (((inb_cmos(0x30)  10) | (inb_cmos(0x31)  18))
   + 1 * 1024 * 1024);

The rest (ports 0xe0..0xe7, 0x2000..0x2017, MMIO) can be left in testdev.


IIRC, one of the biggest problem with testdev was its hack to inject
interrupts.


Jan, I assume this commit helps to fix this, right?

commit b334ec567f1de9a60349991e7b75083d569ddb0a
Author: Jan Kiszka jan.kis...@siemens.com
Date:   Fri Mar 2 10:30:47 2012 +0100

qemu-kvm: Use upstream kvm-i8259

Drop the qemu-kvm version in favor of the equivalent upstream
implementation. This allows to move the i8259 back into the hwlib.

Note that this also drops the testdev hack and restores proper
isa_get_irq. If testdev scripts exist that inject  IRQ15, they need
fixing. Testing for these interrupts on the PIIX3 makes no practical
sense anyway as those lines are unused.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
Signed-off-by: Avi Kivity a...@redhat.com


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-04 Thread Lucas Meneghel Rodrigues

On 10/04/2012 09:27 AM, Jan Kiszka wrote:

On 2012-10-04 14:10, Lucas Meneghel Rodrigues wrote:

On 10/04/2012 07:48 AM, Jan Kiszka wrote:

On 2012-10-03 15:19, Paolo Bonzini wrote:

Il 03/10/2012 12:57, Lucas Meneghel Rodrigues ha scritto:

Yep, I did send patches with the testdev device present on qemu-kvm.git
to qemu.git a while ago, but there were many comments on the review, I
ended up not implementing everything that was asked and the patches were
archived.

If nobody wants to step up to port it, I'll re-read the original thread
and will spin up new patches (and try to go through the end with it).
Executing the KVM unittests is something that we can't afford to lose,
so I'd say it's important on this last mile effort to get rid of qemu-kvm.


Absolutely, IIRC the problem was that testdev did a little bit of
everything... let's see what's the functionality of testdev:

- write (port 0xf1), can be replaced in autotest with:
-device isa-debugcon,iobase=0xf1,chardev=...

- exit code (port 0xf4), see this series:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

- ram size (port 0xd1).  If we can also patch kvm-unittests, the memory
is available in the CMOS or in fwcfg.  Here is the SeaBIOS code:

  u32 rs = ((inb_cmos(0x34)  16) | (inb_cmos(0x35)  24));
  if (rs)
  rs += 16 * 1024 * 1024;
  else
  rs = (((inb_cmos(0x30)  10) | (inb_cmos(0x31)  18))
+ 1 * 1024 * 1024);

The rest (ports 0xe0..0xe7, 0x2000..0x2017, MMIO) can be left in testdev.


IIRC, one of the biggest problem with testdev was its hack to inject
interrupts.


Jan, I assume this commit helps to fix this, right?

commit b334ec567f1de9a60349991e7b75083d569ddb0a
Author: Jan Kiszka jan.kis...@siemens.com
Date:   Fri Mar 2 10:30:47 2012 +0100

  qemu-kvm: Use upstream kvm-i8259

  Drop the qemu-kvm version in favor of the equivalent upstream
  implementation. This allows to move the i8259 back into the hwlib.

  Note that this also drops the testdev hack and restores proper
  isa_get_irq. If testdev scripts exist that inject  IRQ15, they need
  fixing. Testing for these interrupts on the PIIX3 makes no practical
  sense anyway as those lines are unused.

  Signed-off-by: Jan Kiszka jan.kis...@siemens.com
  Signed-off-by: Avi Kivity a...@redhat.com


Yes, this improved it a lot as we no longer depend on additional
changes. I'm not sure if there was resistance beyond that.

When cleaning up the code: register_ioport_read must be replaced with
the memory API.


I did look at the MemoryRegionOps/memory_region_init_io and still did 
not figure out how to port things. I'll send a v2 addressing all the 
comments made so far but this one, just to see if people are OK with the 
direction of the full patch, then if you could give me some pointers of 
how to do this conversion, it'd be great.


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-03 Thread Lucas Meneghel Rodrigues

On 10/03/2012 06:55 AM, Gleb Natapov wrote:

On Mon, Oct 01, 2012 at 03:26:05PM +0200, Jan Kiszka wrote:

On 2012-10-01 15:19, Anthony Liguori wrote:

Jan Kiszka jan.kis...@siemens.com writes:


On 2012-10-01 11:31, Marcelo Tosatti wrote:

It's not just about default configs. We need to validate if the
migration formats are truly compatible (qemu-kvm - QEMU, the other way
around definitely not). For the command line switches, we could provide
a wrapper script that translates them into upstream format or simply
ignores them. That should be harmless to carry upstream.


qemu-kvm has:

  -no-kvm
  -no-kvm-irqchip
  -no-kvm-pit
  -no-kvm-pit-reinjection
  -tdf - does nothing

There are replacements for all of the above.  If we need to add them to
qemu.git, it's not big deal to add them.


But I don't think we should add them to the source code. This can
perfectly be handled my a (disposable) script layer on top of
qemu-system-x86_64 - the namespace (qemu-kvm in most cases) is also free.



  -drive ...,boot= - this is ignored

cpu_set command for CPU hotplug which is known broken in qemu-kvm.


Right, so nothing is lost when migrating to QEMU.



testdev which is nice but only used for development


Jan, do you have a plan for testdev device? It would be a pity to have
qemu-kvm just for that.


Yep, I did send patches with the testdev device present on qemu-kvm.git 
to qemu.git a while ago, but there were many comments on the review, I 
ended up not implementing everything that was asked and the patches were 
archived.


If nobody wants to step up to port it, I'll re-read the original thread 
and will spin up new patches (and try to go through the end with it). 
Executing the KVM unittests is something that we can't afford to lose, 
so I'd say it's important on this last mile effort to get rid of qemu-kvm.


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] hw: Add test device for unittests execution

2012-10-03 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite [1].

Usage:

qemu -device testdev

1) Removed port 0xf1, since now kvm-unit-tests use
   serial

2) Removed exit code port 0xf4, since that can be
   replaced by

-device isa-debugexit,iobase=0xf4,access-size=2

3) Removed ram size port 0xd1, since guest memory
   size can be retrieved from firmware, there's a
   patch for kvm-unit-tests including an API to
   retrieve that value.

[1] Preliminary versions of this patch were posted
to the mailing list about a year ago, I re-read the
comments of the thread, and had guidance from
Paolo about which ports to remove from the test
device.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |   1 +
 hw/testdev.c  | 131 ++
 2 files changed, 132 insertions(+)
 create mode 100644 hw/testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..64d2787 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/testdev.c b/hw/testdev.c
new file mode 100644
index 000..44070f2
--- /dev/null
+++ b/hw/testdev.c
@@ -0,0 +1,131 @@
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+
+struct testdev {
+ISADevice dev;
+MemoryRegion iomem;
+CharDriverState *chr;
+};
+
+#define TYPE_TESTDEV testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct testdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct testdev *dev = opaque;
+
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static uint32 test_device_ioport_data;
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+test_device_ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+return test_device_ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
+{
+return iomem_buf[addr];
+}
+
+static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
+{
+return *(uint16_t*)(iomem_buf + addr);
+}
+
+static uint32_t test_iomem_readl(void *opaque, target_phys_addr_t addr)
+{
+return *(uint32_t*)(iomem_buf + addr);
+}
+
+static void test_iomem_writeb(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+iomem_buf[addr] = val;
+}
+
+static void test_iomem_writew(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint16_t*)(iomem_buf + addr) = val;
+}
+
+static void test_iomem_writel(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint32_t*)(iomem_buf + addr) = val;
+}
+
+static const MemoryRegionOps test_iomem_ops = {
+.old_mmio = {
+.read = { test_iomem_readb, test_iomem_readw, test_iomem_readl, },
+.write = { test_iomem_writeb, test_iomem_writew, test_iomem_writel, },
+},
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int init_test_device(ISADevice *isa)
+{
+struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
+
+register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
+register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
+register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
+iomem_buf = g_malloc0(0x1);
+memory_region_init_io(dev-iomem, test_iomem_ops, dev,
+  testdev, 0x1);
+memory_region_add_subregion(isa_address_space(dev-dev), 0xff00,
+  dev-iomem);
+return 0;
+}
+
+static Property testdev_isa_properties[] = {
+DEFINE_PROP_CHR(chardev, struct testdev, chr),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void testdev_class_init(ObjectClass *klass, void *data)
+{
+DeviceClass *dc

Re: [PATCH] hw: Add test device for unittests execution

2012-10-03 Thread Lucas Meneghel Rodrigues

On 10/04/2012 12:49 AM, Lucas Meneghel Rodrigues wrote:

Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite [1].

Usage:

qemu -device testdev

1) Removed port 0xf1, since now kvm-unit-tests use
serial

2) Removed exit code port 0xf4, since that can be
replaced by

-device isa-debugexit,iobase=0xf4,access-size=2


I forgot to mention that this would work *if* the isa-debugexit device 
gets upstream. Paolo pointed this thread:


http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

But it appears that no consensus was reached.


3) Removed ram size port 0xd1, since guest memory
size can be retrieved from firmware, there's a
patch for kvm-unit-tests including an API to
retrieve that value.

[1] Preliminary versions of this patch were posted
to the mailing list about a year ago, I re-read the
comments of the thread, and had guidance from
Paolo about which ports to remove from the test
device.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
  hw/i386/Makefile.objs |   1 +
  hw/testdev.c  | 131 ++
  2 files changed, 132 insertions(+)
  create mode 100644 hw/testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..64d2787 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
  obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o 
xen_pt_msi.o
  obj-y += kvm/
  obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += testdev.o

  obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/testdev.c b/hw/testdev.c
new file mode 100644
index 000..44070f2
--- /dev/null
+++ b/hw/testdev.c
@@ -0,0 +1,131 @@
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+
+struct testdev {
+ISADevice dev;
+MemoryRegion iomem;
+CharDriverState *chr;
+};
+
+#define TYPE_TESTDEV testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct testdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct testdev *dev = opaque;
+
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static uint32 test_device_ioport_data;
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+test_device_ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+return test_device_ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
+{
+return iomem_buf[addr];
+}
+
+static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
+{
+return *(uint16_t*)(iomem_buf + addr);
+}
+
+static uint32_t test_iomem_readl(void *opaque, target_phys_addr_t addr)
+{
+return *(uint32_t*)(iomem_buf + addr);
+}
+
+static void test_iomem_writeb(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+iomem_buf[addr] = val;
+}
+
+static void test_iomem_writew(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint16_t*)(iomem_buf + addr) = val;
+}
+
+static void test_iomem_writel(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint32_t*)(iomem_buf + addr) = val;
+}
+
+static const MemoryRegionOps test_iomem_ops = {
+.old_mmio = {
+.read = { test_iomem_readb, test_iomem_readw, test_iomem_readl, },
+.write = { test_iomem_writeb, test_iomem_writew, test_iomem_writel, },
+},
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int init_test_device(ISADevice *isa)
+{
+struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
+
+register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
+register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
+register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
+iomem_buf = g_malloc0(0x1);
+memory_region_init_io(dev-iomem, test_iomem_ops, dev,
+  testdev, 0x1);
+memory_region_add_subregion(isa_address_space(dev-dev), 0xff00

Re: qemu.git/qemu-kvm.git bugs during migrate + reboot

2012-09-25 Thread Lucas Meneghel Rodrigues

On 09/25/2012 09:59 AM, Anthony Liguori wrote:

Lucas Meneghel Rodrigues l...@redhat.com writes:


Hi guys,

We're seeing the following problem during upstream testing:

qemu: VQ 0 size 0x80 Guest index 0x2d6
  inconsistent with Host index 0x18: delta 0x2be
  qemu: warning:  error while loading state for
  instance 0x0 of device ':00:04.0/virtio-blk'
  load of migration failed

This is happening consistently with qemu and qemu-kvm. Test case is
simple, while the vm goes through a reboot loop, a parallel ping-pong
migration loop happens.

I'm happy to provide more details and logs.


Can you provide the full command line?


Sure. The problem happens with *all* migration protocols, let's use as 
an example the protocol fd. The vm is started with:


09/22 07:26:19 INFO |kvm_vm:1605| /usr/local/autotest/tests/kvm/qemu
09/22 07:26:19 INFO |kvm_vm:1605| -S
09/22 07:26:19 INFO |kvm_vm:1605| -name 'vm1'
09/22 07:26:19 INFO |kvm_vm:1605| -nodefaults
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20120922-072139-HDnHgnLh,path=/tmp/serial-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20120922-072139-HDnHgnLh
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20120922-072139-HDnHgnLh,path=/tmp/seabios-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20120922-072139-HDnHgnLh,iobase=0x402

09/22 07:26:19 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1
09/22 07:26:19 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0
09/22 07:26:19 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idPQlGQt,mac='9a:4b:4c:4d:4e:4f',id='id01mORp'

09/22 07:26:19 INFO |kvm_vm:1605| -netdev tap,id=idPQlGQt,fd=24
09/22 07:26:19 INFO |kvm_vm:1605| -m 2048
09/22 07:26:19 INFO |kvm_vm:1605| -smp 
2,cores=1,threads=1,sockets=2
09/22 07:26:19 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1

09/22 07:26:19 INFO |kvm_vm:1605| -vnc :0
09/22 07:26:19 INFO |kvm_vm:1605| -vga std
09/22 07:26:19 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none

09/22 07:26:19 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off
09/22 07:26:19 INFO |kvm_vm:1605| -enable-kvm
09/22 07:26:19 INFO |kvm_vm:1605| -enable-kvm

Then the state will be migrated to a new process:

09/22 07:26:48 INFO |kvm_vm:1605| /usr/local/autotest/tests/kvm/qemu
09/22 07:26:48 INFO |kvm_vm:1605| -S
09/22 07:26:48 INFO |kvm_vm:1605| -name 'vm1'
09/22 07:26:48 INFO |kvm_vm:1605| -nodefaults
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20120922-072648-g6gL8thp,path=/tmp/serial-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20120922-072648-g6gL8thp
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20120922-072648-g6gL8thp,path=/tmp/seabios-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20120922-072648-g6gL8thp,iobase=0x402

09/22 07:26:48 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1
09/22 07:26:48 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0
09/22 07:26:48 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idSld9kt,mac='9a:4b:4c:4d:4e:4f',id='idFBA7Vj'

09/22 07:26:48 INFO |kvm_vm:1605| -netdev tap,id=idSld9kt,fd=45
09/22 07:26:48 INFO |kvm_vm:1605| -m 2048
09/22 07:26:48 INFO |kvm_vm:1605| -smp 
2

qemu.git/qemu-kvm.git bugs during migrate + reboot

2012-09-20 Thread Lucas Meneghel Rodrigues

Hi guys,

We're seeing the following problem during upstream testing:

qemu: VQ 0 size 0x80 Guest index 0x2d6
inconsistent with Host index 0x18: delta 0x2be
qemu: warning:  error while loading state for
instance 0x0 of device ':00:04.0/virtio-blk'
load of migration failed

This is happening consistently with qemu and qemu-kvm. Test case is 
simple, while the vm goes through a reboot loop, a parallel ping-pong 
migration loop happens.


I'm happy to provide more details and logs.

Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Biweekly upstream qemu-kvm test report (using autotest) - Week 35

2012-08-30 Thread Lucas Meneghel Rodrigues
On Thu, Aug 30, 2012 at 8:37 AM, santwana santw...@linux.vnet.ibm.com wrote:
 Hi All,

 Please find the results of upstream testing.

 We are evaluating the failures and will be raising the issues with the
 appropriate community.

 Environment:
 Host Kernel: 3.5.0-rc6
 KVM Version: 1.1.90
 Date: Thu Aug 30 15:29:06 2012
 Stats: 41 tests executed (26 tests passed, 15 tests failed)

 Tests Passed:

 ...

 TestName
 ...
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.balloon_check
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.balloon_check.balloon-migrate
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.balloon_check.balloon-shutdown_enlarge
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.balloon_check.balloon-shutdown_evict
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.dd_test.readonly.disk2null
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.dd_test.readonly.zero2disk
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.dd_test.readwrite.disk2null
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.dd_test.readwrite.zero2disk
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.disktest
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.ebizzy
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.ffsb
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.hackbench
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.iozone
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.sleeptest

^ You might remove sleeptest from the set of tests, as it's more of a
sanity check of autotest

 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.autotest.stress
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.block_stream
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.boot
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.blkio_bandwidth
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.cpuset_cpus_switching
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.cpu_share
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.devices_access
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.freezer
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.memory_move
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.jumbo
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.shutdown
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.unattended_install.cdrom.extra_cdrom_ks
 ...

 Tests Failed:

 ...

 TestName
 ...

 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.cpuflags.boot_guest.qemu_boot_fail_cpu_model
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.cpuflags.boot_guest.qemu_warn_boot_check_cpu_model
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.cpuflags.interface.qemu_cpu_cpuid
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.cpuflags.interface.qemu_cpu_dump
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.64.cpuflags.interface.qemu_cpu_model
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.blkio_throttle
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.blkio_throttle_multi
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.cpuset_cpus
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cgroup.memory_limit
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cpuflags.boot_guest.qemu_boot_cpu_model
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cpuflags.boot_guest.qemu_boot_cpu_model_and_flags
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cpuflags.stress_guest.qemu_test_boot_guest_and_try_flags_under_load
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cpuflags.stress_guest.qemu_test_migration_with_additional_flags
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.cpuflags.stress_guest.qemu_test_online_offline_guest_CPUs
 kvm.qed.virtio_blk.smp4.virtio_net.RHEL.6.2.x86_64.linux_s3

Interesting thing here is that you guys are using qed as the default
image type. Is this part of the test plan? (internally we only use
qcow2)

 Regards,
 Santwana

 --
 To unsubscribe from this list: send the line unsubscribe kvm in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.kvm_monitor: Future proof migration handling on QMP monitor

2012-08-22 Thread Lucas Meneghel Rodrigues
With d46ad35c74, the exception handling for migrations
happening when using a single QMP monitor relies on
an exception class that's going to disappear in future
versions of QEMU, being replaced by the GenericError
class. So let's also handle this exception class.

CC: Luiz Capitulino lcapitul...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_monitor.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index 9d8ed87..932725b 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -1155,7 +1155,7 @@ class QMPMonitor(Monitor):
 try:
 return self.cmd(migrate, args)
 except QMPCmdError, e:
-if e.data['class'] == 'SockConnectInprogress':
+if e.data['class'] in ['SockConnectInprogress', 'GenericError']:
 logging.debug(Migrate socket connection still 
initializing...)
 else:
 raise e
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.netperf: Use ssh_key lib rather than off limits server lib

2012-08-22 Thread Lucas Meneghel Rodrigues
When running the kvm autotest tests on a given host through
the autotest server, it's important to remember that only
the autotest client is copied to machines, making anything
that is not on the autotest.client namespace *off-limits*.

So, replace usage of SSHHost server class (here used only
to get ssh key setup) to use the ssh_key module, recently
split out due to a similar mistake made by test authors.

CC: Amos Kong ak...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/netperf.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/client/virt/tests/netperf.py b/client/virt/tests/netperf.py
index c054c10..e137d45 100644
--- a/client/virt/tests/netperf.py
+++ b/client/virt/tests/netperf.py
@@ -1,6 +1,6 @@
 import logging, os, commands, threading, re, glob
-from autotest.server.hosts.ssh_host import SSHHost
 from autotest.client import utils
+from autotest.client.shared import ssh_key
 from autotest.client.virt import utils_test, utils_misc, remote
 
 
@@ -60,7 +60,8 @@ def run_netperf(test, params, env):
 
 def env_setup(ip):
 logging.debug(Setup env for %s % ip)
-SSHHost(ip, user=username, port=shell_port, password=password)
+ssh_key.setup_ssh_key(hostname=ip, user=username, port=shell_port,
+  password=password)
 ssh_cmd(ip, service iptables stop)
 ssh_cmd(ip, echo 1  /proc/sys/net/ipv4/conf/all/arp_ignore)
 
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.kvm: Handle migrate errors using QMP monitor properly

2012-08-21 Thread Lucas Meneghel Rodrigues
When using QMP monitor as the sole monitor on KVM autotest
(something that we sadly did not exercise on our test farms),
starting qemu with -S and then issuing 'cont' will cause
errors, since the error treatment with QMP monitors is more
strict [1]. Take advantage of the fact that error treatment
with the QMP json structures is much easier, and handle
failures during migration accordingly.

With this patch, migration works properly using only QMP
monitors.

[1] This means we probably should be more rigorous treating
Human Monitor errors, but that's going to be handled later.

CC: Qingtang Zhou qz...@redhat.com
CC: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_monitor.py |  8 +++-
 client/virt/kvm_vm.py  | 10 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index 8b5e251..9d8ed87 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -1152,7 +1152,13 @@ class QMPMonitor(Monitor):
 args = {uri: uri,
 blk: full_copy,
 inc: incremental_copy}
-return self.cmd(migrate, args)
+try:
+return self.cmd(migrate, args)
+except QMPCmdError, e:
+if e.data['class'] == 'SockConnectInprogress':
+logging.debug(Migrate socket connection still 
initializing...)
+else:
+raise e
 
 
 def migrate_set_speed(self, value):
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 871b824..19d018d 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -1743,7 +1743,15 @@ class VM(virt_vm.BaseVM):
 output_params=(outfile,))
 
 # start guest
-self.monitor.cmd(cont)
+if self.monitor.verify_status(paused):
+try:
+self.monitor.cmd(cont)
+except kvm_monitor.QMPCmdError, e:
+if ((e.data['class'] == MigrationExpected) and
+(migration_mode is not None)):
+logging.debug(Migration did not start yet...)
+else:
+raise e
 
 finally:
 fcntl.lockf(lockfile, fcntl.LOCK_UN)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.kvm_vm: Autodetect whenever bootindex should be used

2012-08-21 Thread Lucas Meneghel Rodrigues
Also, avoid checking twice and use the result when to
add boot=on/off to the command line.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_vm.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 19d018d..35e12b6 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -474,7 +474,7 @@ class VM(virt_vm.BaseVM):
   lun=None):
 name = None
 dev = 
-if self.params.get(use_bootindex) in ['yes', 'on', True]:
+if not re.search(boot=on\|off, help, re.MULTILINE):
 if boot in ['yes', 'on', True]:
 bootindex = 1
 boot = unused
@@ -550,7 +550,8 @@ class VM(virt_vm.BaseVM):
 cmd += _add_option(werror, werror)
 cmd += _add_option(serial, serial)
 cmd += _add_option(snapshot, snapshot, bool)
-if re.search(boot=on\|off, help, re.MULTILINE):
+# Only add boot=on/off if necessary (deprecated in newer qemu)
+if boot != unused:
 cmd += _add_option(boot, boot, bool)
 cmd += _add_option(id, name)
 cmd += _add_option(readonly, readonly, bool)
-- 
1.7.11.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: Add Fedora 17 to the list of guests

2012-05-30 Thread Lucas Meneghel Rodrigues
Also, make it the default guest for KVM autotest.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests.cfg.sample |   18 -
 client/tests/libvirt/tests.cfg.sample |   21 ++--
 client/virt/guest-os.cfg.sample   |   28 ++
 client/virt/unattended/Fedora-17.ks   |   35 +
 client/virt/virt_utils.py |6 +++---
 5 files changed, 86 insertions(+), 22 deletions(-)
 create mode 100644 client/virt/unattended/Fedora-17.ks

diff --git a/client/tests/kvm/tests.cfg.sample 
b/client/tests/kvm/tests.cfg.sample
index 9329a05..912232e 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -57,8 +57,8 @@ variants:
 # Subtest choice. You can modify that line to add more subtests
 only unattended_install.cdrom, boot, shutdown
 
-# Runs qemu, f16 64 bit guest OS, install, boot, shutdown
-- @qemu_f16_quick:
+# Runs qemu, f17 64 bit guest OS, install, boot, shutdown
+- @qemu_f17_quick:
 # We want qemu for this run
 qemu_binary = /usr/bin/qemu
 qemu_img_binary = /usr/bin/qemu-img
@@ -72,13 +72,13 @@ variants:
 only no_9p_export
 only no_pci_assignable
 only smallpages
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.extra_cdrom_ks, boot, shutdown
 # qemu needs -enable-kvm on the cmdline
 extra_params += ' -enable-kvm'
 
-# Runs qemu-kvm, f16 64 bit guest OS, install, boot, shutdown
-- @qemu_kvm_f16_quick:
+# Runs qemu-kvm, f17 64 bit guest OS, install, boot, shutdown
+- @qemu_kvm_f17_quick:
 # We want qemu-kvm for this run
 qemu_binary = /usr/bin/qemu-kvm
 qemu_img_binary = /usr/bin/qemu-img
@@ -90,10 +90,10 @@ variants:
 only no_9p_export
 only no_pci_assignable
 only smallpages
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.extra_cdrom_ks, boot, shutdown
 
-# Runs qemu-kvm, f16 64 bit guest OS, install, starts qemu-kvm
+# Runs qemu-kvm, f17 64 bit guest OS, install, starts qemu-kvm
 # with 9P support and runs 9P CI tests
 - @qemu_kvm_9p_export:
 qemu_binary = /usr/bin/qemu-kvm
@@ -106,7 +106,7 @@ variants:
 only no_pci_assignable
 only smallpages
 only 9p_export
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.extra_cdrom_ks, boot, 9p.9p_ci, shutdown
 
 # Runs your own guest image (qcow2, can be adjusted), all migration tests
@@ -129,4 +129,4 @@ variants:
 only migrate
 
 # Choose your test list from the testsets defined
-only qemu_kvm_f16_quick
+only qemu_kvm_f17_quick
diff --git a/client/tests/libvirt/tests.cfg.sample 
b/client/tests/libvirt/tests.cfg.sample
index 548caf8..2b17d50 100644
--- a/client/tests/libvirt/tests.cfg.sample
+++ b/client/tests/libvirt/tests.cfg.sample
@@ -6,8 +6,8 @@
 include tests-shared.cfg
 
 variants:
-# Runs virt-install, f16 64 bit guest OS, install, boot, shutdown
-- @libvirt_f16_quick:
+# Runs virt-install, f17 64 bit guest OS, install, boot, shutdown
+- @libvirt_f17_quick:
 virt_install_binary = /usr/bin/virt-install
 qemu_img_binary = /usr/bin/qemu-img
 hvm_or_pv = hvm
@@ -18,11 +18,12 @@ variants:
 only no_9p_export
 only no_pci_assignable
 only smallpages
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.extra_cdrom_ks, boot, reboot, shutdown, 
remove_guest.with_disk
 
-# Runs virt-install, f16 64 as a 64 bit PV guest OS, install, boot, 
shutdown
-- @libvirt_xenpv_f16_quick:
+
+# Runs virt-install, f17 64 as a 64 bit PV guest OS, install, boot, 
shutdown
+- @libvirt_xenpv_f17_quick:
 virt_install_binary = /usr/bin/virt-install
 qemu_img_binary = /usr/bin/qemu-img
 hvm_or_pv = pv
@@ -34,12 +35,12 @@ variants:
 only no_9p_export
 only no_pci_assignable
 only smallpages
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.http_ks, boot, reboot, shutdown, 
remove_guest.with_disk
 
-# Runs virt-install, f16 64 as a 64 bit HVM (full virt) guest OS,
+# Runs virt-install, f17 64 as a 64 bit HVM (full virt) guest OS,
 # install, boot, shutdown
-- @libvirt_xenhvm_f16_quick:
+- @libvirt_xenhvm_f17_quick:
 virt_install_binary = /usr/bin/virt-install
 qemu_img_binary = /usr/bin/qemu-img
 hvm_or_pv = hvm
@@ -52,7 +53,7 @@ variants:
 only no_9p_export
 only no_pci_assignable
 only smallpages
-only Fedora.16.64
+only Fedora.17.64
 only unattended_install.cdrom.in_cdrom_ks, boot, reboot, shutdown, 
remove_guest.with_disk
 
 # Runs virt-install, RHEL 6.0 64 bit guest OS, install, boot

Re: [Autotest] [PATCH] KVM test: use new functions in cdrom_test

2012-05-30 Thread Lucas Meneghel Rodrigues
By the way, looks good, applied to next.

On Wed, May 30, 2012 at 11:51 AM, Lukáš Doktor ldok...@redhat.com wrote:
 I forgot add pull request link:
 https://github.com/autotest/autotest/pull/368

 Dne 30.5.2012 16:43, Lukáš Doktor napsal(a):
 Use get_block and other framework functions in cdrom test. Also
 don't fail the whole test when tray-status reporting is not supported
 by qemu and other cleanups.

 Signed-off-by: Lukáš Doktorldok...@redhat.com
 ---
   client/tests/kvm/tests/cdrom.py |  118 
 ---
   client/virt/subtests.cfg.sample |    2 +
   2 files changed, 50 insertions(+), 70 deletions(-)

 diff --git a/client/tests/kvm/tests/cdrom.py 
 b/client/tests/kvm/tests/cdrom.py
 index 089150b..4390796 100644
 --- a/client/tests/kvm/tests/cdrom.py
 +++ b/client/tests/kvm/tests/cdrom.py
 @@ -21,7 +21,7 @@ def run_cdrom(test, params, env):
       3) * If cdrom_test_autounlock is set, verifies that device is unlocked
          300s after boot
       4) Eject cdrom using monitor and change with another iso several times.
 -    5) Eject cdrom in guest and check tray status reporting.
 +    5) * If cdrom_test_tray_status = yes, tests tray reporting.
       6) Try to format cdrom and check the return string.
       7) Mount cdrom device.
       8) Copy file from cdrom and compare files using diff.
 @@ -35,6 +35,10 @@ def run_cdrom(test, params, env):
                                           eject CDROM directly after insert
       @param cfg: cdrom_test_autounlock - Test whether guest OS unlocks cdrom
                                           after boot (300s after VM is 
 booted)
 +    @param cfg: cdrom_test_tray_status - Test tray reporting (eject and 
 insert
 +                                         CD couple of times in guest).
 +
 +    @warning: Check dmesg for block device failures
       
       def master_cdroms(params):
            Creates 'new' cdrom with one file on it 
 @@ -43,7 +47,7 @@ def run_cdrom(test, params, env):
           cdrom_cd1 = params.get(cdrom_cd1)
           if not os.path.isabs(cdrom_cd1):
               cdrom_cd1 = os.path.join(test.bindir, cdrom_cd1)
 -        cdrom_dir = os.path.realpath(os.path.dirname(cdrom_cd1))
 +        cdrom_dir = os.path.dirname(cdrom_cd1)
           utils.run(dd if=/dev/urandom of=orig bs=10M count=1)
           utils.run(dd if=/dev/urandom of=new bs=10M count=1)
           utils.run(mkisofs -o %s/orig.iso orig % cdrom_dir)
 @@ -55,57 +59,27 @@ def run_cdrom(test, params, env):
           error.context(cleaning up temp cdrom images)
           os.remove(%s/new.iso % cdrom_dir)

 -    def get_block_info(re_device='[^\n][^:]+'):
 -         Gets device string and file from kvm-monitor 
 -        blocks = vm.monitor.info(block)
 -        devices = []
 -        files = []
 -        if isinstance(blocks, str):
 -            devices = re.findall('(%s): .*' % re_device, blocks)
 -            if devices:
 -                for dev in devices:
 -                    cdfile = re.findall('%s: .*file=(\S*) ' % dev, blocks)
 -                    if cdfile:
 -                        cdfile = os.path.realpath(cdfile[0])
 -                    else:
 -                        cdfile = None
 -                    files.append(cdfile)
 -        else:
 -            for block in blocks:
 -                if re.match(re_device, block['device']):
 -                    devices.append(block['device'])
 -                    try:
 -                        cdfile = block['inserted']['file']
 -                        if cdfile:
 -                            cdfile = os.path.realpath(cdfile)
 -                    except KeyError:
 -                        cdfile = None
 -                    files.append(cdfile)
 -        return (devices, files)
 -
 -    def get_cdrom_info(device):
 +    def get_cdrom_file(device):
           
           @param device: qemu monitor device
           @return: file associated with $device device
           
 -        (_, cdfile) = get_block_info(device)
 -        logging.debug(Device name: %s, ISO: %s, device, cdfile[0])
 -        return cdfile[0]
 -
 -    def check_cdrom_locked(cdrom):
 -         Checks whether the cdrom is locked 
           blocks = vm.monitor.info(block)
 +        cdfile = None
           if isinstance(blocks, str):
 -            lock_str = locked=1
 -            for block in blocks.splitlines():
 -                if cdrom in block and lock_str in block:
 -                    return True
 +            cdfile = re.findall('%s: .*file=(\S*) ' % device, blocks)
 +            if not cdfile:
 +                return None
 +            else:
 +                cdfile = cdfile[0]
           else:
               for block in blocks:
 -                if ('inserted' in block.keys() and
 -                    block['inserted']['file'] == cdrom):
 -                    return block['locked']
 -        return False
 +                if block['device'] == device:
 +                    try:
 +                     

Re: KVM test: Cdrom test

2012-05-26 Thread Lucas Meneghel Rodrigues
On Sat, 2012-05-26 at 09:59 +0200, Lukáš Doktor wrote:
 Hello guys,
 
 this is a repaired version of cdrom_test, the problems were mainly device 
 names and symlinks.
 
 As a bonus it fixes bugs in virtio_scsi and usb_cdrom cdrom device definition 
 in qemu_cmd.
 
 tested on F16 using ide, virtio_scsi, ahci and usb_cdrom, using QMP and 
 humanmonitor. (virtio_scsi and usb_stick are failing with IO errors in dmesg)
 
 See the pull request:
 https://github.com/autotest/autotest/pull/361

As noted on github, this looks good and was applied to next. Thanks
Lukas!

 Regards,
 Lukáš
 


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] kvm-unit-tests - unittests.cfg: Make extra_params specification uniform

2012-05-14 Thread Lucas Meneghel Rodrigues
Currently, extra_params is using : rather than =
on unittests.cfg. Let's fix this and make all configuration
assignments uniform on that file.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 x86/unittests.cfg |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 065020a..83489d0 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -7,7 +7,7 @@
 [apic]
 file = apic.flat
 smp = 2
-extra_params: -cpu qemu64,+x2apic
+extra_params = -cpu qemu64,+x2apic
 
 [smptest]
 file = smptest.flat
-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] vmexit: Update unittests.cfg with list of vmexit subtests

2012-05-14 Thread Lucas Meneghel Rodrigues
vmexit takes a parameter to run appropriate subtests, but
unittests.cfg was not updated to reflect that. As this
config file is used by automated test harnesses such as
autotest, this will make the appropriate tests not
executed.

Tested successfuly with qemu-kvm shipped in Fedora 17
and RHEL 6.3. I've found problems with qemu-kvm compiled
from master HEAD, but it's not related to this patch, as
all other unittests are failing (currently under investigation).

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 x86/unittests.cfg |   32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 83489d0..10067c4 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -17,9 +17,39 @@ smp = 2
 file = smptest.flat
 smp = 3
 
-[vmexit]
+[vmexit_cpuid]
+file = vmexit.flat
+extra_params = -append 'cpuid'
+
+[vmexit_vmcall]
+file = vmexit.flat
+extra_params = -append 'vmcall'
+
+[vmexit_mov_from_cr8]
+file = vmexit.flat
+extra_params = -append 'mov_from_cr8'
+
+[vmexit_mov_to_cr8]
+file = vmexit.flat
+extra_params = -append 'mov_to_cr8'
+
+[vmexit_inl_pmtimer]
+file = vmexit.flat
+extra_params = -append 'inl_from_pmtimer'
+
+[vmexit_ipi]
 file = vmexit.flat
 smp = 2
+extra_params = -append 'ipi'
+
+[vmexit_ipi_halt]
+file = vmexit.flat
+smp = 2
+extra_params = -append 'ipi_halt'
+
+[vmexit_ple_round_robin]
+file = vmexit.flat
+extra_params = -append 'ple_round_robin'
 
 [access]
 file = access.flat
-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] virt: Miscelaneous fixes

2012-05-14 Thread Lucas Meneghel Rodrigues
Here are some fixes found while working on kvm unittests
and the multi_disk changes by Lukas.

Lucas Meneghel Rodrigues (2):
  virt.kvm_installer: Don't fail a test if virtfs_proxy is not defined
  virt.virt_env_process: Reorganize screendump thread termination

 client/virt/kvm_installer.py|2 +-
 client/virt/virt_env_process.py |   11 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] virt.kvm_installer: Don't fail a test if virtfs_proxy is not defined

2012-05-14 Thread Lucas Meneghel Rodrigues
This userspace program is not shipped on a regular qemu source
code checkout, so its absence doesn't need to fail a test.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_installer.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index a5c2747..b975f31 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -209,7 +209,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 if qemu_fs_proxy_bin is not None:
 os.symlink(qemu_fs_proxy_bin, qemu_fs_proxy_dst)
 else:
-raise error.TestError('Invalid qemu fs proxy path')
+logging.warning('Qemu fs proxy path %s not found on source dir')
 
 
 def _install_phase_init(self):
-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] virt.virt_env_process: Reorganize screendump thread termination

2012-05-14 Thread Lucas Meneghel Rodrigues
Simplify the check for screendump termination thread event,
and also avoid a bug where we try to set a delay to a None
object.

Fixes the following bug that happens when running the
multi-disk test:

 Exception in thread Thread-1:
 Traceback (most recent call last):
   File /usr/lib64/python2.7/threading.py, line 551, in
__bootstrap_inner
 self.run()
   File /usr/lib64/python2.7/threading.py, line 504, in run
 self.__target(*self.__args, **self.__kwargs)
   File
/home/lmr/Code/autotest.git/autotest/client/virt/virt_env_process.py,
line 549, in _take_screendumps
 _screendump_thread_termination_event.wait(delay)
 AttributeError: 'NoneType' object has no attribute 'wait'

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_env_process.py |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 816e0f7..4f9e19f 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -542,8 +542,9 @@ def _take_screendumps(test, params, env):
 except NameError:
 pass
 os.unlink(temp_filename)
-if (_screendump_thread_termination_event is not None and
-_screendump_thread_termination_event.isSet()):
-_screendump_thread_termination_event = None
-break
-_screendump_thread_termination_event.wait(delay)
+
+if _screendump_thread_termination_event is not None:
+if _screendump_thread_termination_event.isSet():
+_screendump_thread_termination_event = None
+break
+_screendump_thread_termination_event.wait(delay)
-- 
1.7.10.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] virt: Assorted bugfixes

2012-04-26 Thread Lucas Meneghel Rodrigues
Fixes for a bunch of bugs I've noticed on our internal
test farm.

Lucas Meneghel Rodrigues (3):
  Fix wrong reference to image functions
  virt.qemu_io: Make QemuIO inherit from object
  kvm.tests.qemu_io_blkdebug: Fix up use of python  2.4 construct

 client/tests/kvm/tests/enospc.py   |2 +-
 client/tests/kvm/tests/pci_hotplug.py  |4 ++--
 client/tests/kvm/tests/physical_resources_check.py |4 ++--
 client/tests/kvm/tests/qemu_img.py |4 ++--
 client/tests/kvm/tests/qemu_io_blkdebug.py |   11 ---
 client/virt/qemu_io.py |2 +-
 6 files changed, 16 insertions(+), 11 deletions(-)

-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] Fix wrong reference to image functions

2012-04-26 Thread Lucas Meneghel Rodrigues
Now that they were moved to virt_utils.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/enospc.py   |2 +-
 client/tests/kvm/tests/pci_hotplug.py  |4 ++--
 client/tests/kvm/tests/physical_resources_check.py |4 ++--
 client/tests/kvm/tests/qemu_img.py |4 ++--
 client/tests/kvm/tests/qemu_io_blkdebug.py |2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/client/tests/kvm/tests/enospc.py b/client/tests/kvm/tests/enospc.py
index b4740a4..a011091 100644
--- a/client/tests/kvm/tests/enospc.py
+++ b/client/tests/kvm/tests/enospc.py
@@ -145,7 +145,7 @@ def run_enospc(test, params, env):
 for image_name in vm.params.objects(images):
 image_params = vm.params.object_params(image_name)
 try:
-virt_vm.check_image(image_params, test.bindir)
+virt_utils.check_image(image_params, test.bindir)
 except (virt_vm.VMError, error.TestWarn), e:
 logging.error(e)
 logging.info(Guest paused, extending Logical Volume size)
diff --git a/client/tests/kvm/tests/pci_hotplug.py 
b/client/tests/kvm/tests/pci_hotplug.py
index 6908134..4316d51 100644
--- a/client/tests/kvm/tests/pci_hotplug.py
+++ b/client/tests/kvm/tests/pci_hotplug.py
@@ -66,7 +66,7 @@ def run_pci_hotplug(test, params, env):
 pci_add_cmd = pci_add pci_addr=auto nic model=%s % tested_model
 elif test_type == block:
 image_params = params.object_params(stg)
-image_filename = virt_vm.get_image_filename(image_params,
+image_filename = virt_utils.get_image_filename(image_params,
test.bindir)
 pci_add_cmd = (pci_add pci_addr=auto storage file=%s,if=%s %
(image_filename, tested_model))
@@ -89,7 +89,7 @@ def run_pci_hotplug(test, params, env):
 
 elif test_type == block:
 image_params = params.object_params(stg)
-image_filename = virt_vm.get_image_filename(image_params,
+image_filename = virt_utils.get_image_filename(image_params,
test.bindir)
 controller_model = None
 if tested_model == virtio:
diff --git a/client/tests/kvm/tests/physical_resources_check.py 
b/client/tests/kvm/tests/physical_resources_check.py
index 4e0bb72..076139c 100644
--- a/client/tests/kvm/tests/physical_resources_check.py
+++ b/client/tests/kvm/tests/physical_resources_check.py
@@ -1,6 +1,6 @@
 import re, string, logging
 from autotest.client.shared import error
-from autotest.client.virt import kvm_monitor, virt_vm
+from autotest.client.virt import kvm_monitor, virt_utils
 
 
 def run_physical_resources_check(test, params, env):
@@ -98,7 +98,7 @@ def run_physical_resources_check(test, params, env):
 n_fail = []
 
 # We will check HDs with the image name
-image_name = virt_vm.get_image_filename(params, test.bindir)
+image_name = virt_utils.get_image_filename(params, test.bindir)
 
 # Check cpu count
 logging.info(CPU count check)
diff --git a/client/tests/kvm/tests/qemu_img.py 
b/client/tests/kvm/tests/qemu_img.py
index 47ae20f..bf108bc 100644
--- a/client/tests/kvm/tests/qemu_img.py
+++ b/client/tests/kvm/tests/qemu_img.py
@@ -18,7 +18,7 @@ def run_qemu_img(test, params, env):
 raise error.TestError(Binary of 'qemu-img' not found)
 image_format = params.get(image_format)
 image_size = params.get(image_size, 10G)
-image_name = virt_vm.get_image_filename(params, test.bindir)
+image_name = virt_utils.get_image_filename(params, test.bindir)
 
 
 def _check(cmd, img):
@@ -402,7 +402,7 @@ def run_qemu_img(test, params, env):
 sn_fmt = params.get(snapshot_format, qcow2)
 sn1 = params.get(image_name_snapshot1)
 sn1 = virt_utils.get_path(test.bindir, sn1) + .%s % sn_fmt
-base_img = virt_vm.get_image_filename(params, test.bindir)
+base_img = virt_utils.get_image_filename(params, test.bindir)
 _create(cmd, sn1, sn_fmt, base_img=base_img, base_img_fmt=image_format)
 
 # Create snapshot2 based on snapshot1
diff --git a/client/tests/kvm/tests/qemu_io_blkdebug.py 
b/client/tests/kvm/tests/qemu_io_blkdebug.py
index 01830e3..b838225 100644
--- a/client/tests/kvm/tests/qemu_io_blkdebug.py
+++ b/client/tests/kvm/tests/qemu_io_blkdebug.py
@@ -32,7 +32,7 @@ def run_qemu_io_blkdebug(test, params, env):
 blkdebug_default = params.get(blkdebug_default)
 
 error.context(Create image, logging.info)
-image_name = virt_vm.create_image(params.object_params(image), test.bindir)
+image_name = virt_utils.create_image(params.object_params(image), 
test.bindir)
 
 template_name =  virt_utils.get_path(test.virtdir, blkdebug_default)
 template = ConfigParser.ConfigParser()
-- 
1.7.10

[PATCH 2/3] virt.qemu_io: Make QemuIO inherit from object

2012-04-26 Thread Lucas Meneghel Rodrigues
Constructs like

MyClass():

Without explicit inheritance are not allowed on py 2.4.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/qemu_io.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/client/virt/qemu_io.py b/client/virt/qemu_io.py
index 8f56f4d..7c0b10a 100644
--- a/client/virt/qemu_io.py
+++ b/client/virt/qemu_io.py
@@ -12,7 +12,7 @@ class QemuIOParamError(Exception):
 pass
 
 
-class QemuIO():
+class QemuIO(object):
 
 A class for execute qemu-io command
 
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] kvm.tests.qemu_io_blkdebug: Fix up use of python 2.4 construct

2012-04-26 Thread Lucas Meneghel Rodrigues
Replace it with a larger, more boring, but nevertheless,
working python 2.4 implementation.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/qemu_io_blkdebug.py |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/tests/qemu_io_blkdebug.py 
b/client/tests/kvm/tests/qemu_io_blkdebug.py
index b838225..6a057f4 100644
--- a/client/tests/kvm/tests/qemu_io_blkdebug.py
+++ b/client/tests/kvm/tests/qemu_io_blkdebug.py
@@ -45,9 +45,14 @@ def run_qemu_io_blkdebug(test, params, env):
 template.set(inject-error, event, '%s' % err_event)
 template.set(inject-error, errno, '%s' % errn)
 
-with open(blkdebug_cfg, 'w') as blkdebug:
+error.context(Write blkdebug config file, logging.info)
+blkdebug = None
+try:
+blkdebug = open(blkdebug_cfg, 'w')
 template.write(blkdebug)
-blkdebug.close()
+finally:
+if blkdebug is not None:
+blkdebug.close()
 
 error.context(Operate in qemu-io to trigger the error, logging.info)
 session = qemu_io.QemuIOShellSession(test, params, image_name,
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Biweekly upstream qemu-kvm test report (using autotest) - Week 16

2012-04-19 Thread Lucas Meneghel Rodrigues
On Thu, 2012-04-19 at 14:59 +0530, Prem Karat wrote:
 Folks,
  
 This is a test report on upstream qemu-kvm testing (24853eece248d4a58d705c).
 Tests were executed using latest autotest git (6a15572d5307fa0b).
 
 This time we have tested 3 guests.
 
 We are analysing the test results further to find out if the failure is in
 autotest or in qemu-kvm. Will post the analysis asap and report bugs to
 appropriate community.

Ok, great initiative! I have a similar job here, but we use the block
virtio drivers only, and qcow 2. I need to go over your results and see
if they match mine.

Thanks, will keep in touch,

Lucas

 Host Kernel level: 3.4.0-rc2+ (git: 923e9a1399b620d063cd8853).
 Guest OS: Windows 7 64 SP1, Fedora 16 x86-64, RHEL 6.2 x86-64
 
 Please find the detailed report below for all the 3 guests.
 
 
 Host Kernel: Kernel: 3.4.0-rc2+
 KVM Version:  1.0.50 (qemu-kvm-devel)
 Guest OS: Windows 7 64 SP1
 Date: Mon Apr 16 22:14:02 2012
 Stat: From 13 tests executed, 5 have passed (61% failures)
 
 Tests Failed:
 
 
  Test Name   
 ResultRun time
 
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.default.nic_virtio   
 FAIL  108
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.additional.nic_8139  
 FAIL   75
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.additional.nic_virtio
 FAIL   17
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.additional.nic_e1000 
 FAIL  214
 kvm.qed.smp4.Win7.64.sp1.block_hotplug.fmt_qcow2.block_virtio 
 FAIL  115
 kvm.qed.smp4.Win7.64.sp1.block_hotplug.fmt_qcow2.block_scsi   
 FAIL  161
 kvm.qed.smp4.Win7.64.sp1.block_hotplug.fmt_raw.block_virtio   
 FAIL  160
 kvm.qed.smp4.Win7.64.sp1.block_hotplug.fmt_raw.block_scsi 
 FAIL  160
 
 
 Tests Passed:
 
 
  Test Name   
 ResultRun time
 
 kvm.qed.smp4.Win7.64.sp1.boot 
 PASS   70
 kvm.qed.smp4.Win7.64.sp1.reboot   
 PASS   62
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.default.nic_8139 
 PASS  119
 kvm.qed.smp4.Win7.64.sp1.nic_hotplug.default.nic_e1000
 PASS  184
 kvm.qed.smp4.Win7.64.sp1.shutdown 
 PASS  122
 
 *
 
 Host Kernel: Kernel: 3.4.0-rc2+
 KVM Version:  1.0.50 (qemu-kvm-devel)
 Guest OS: Fedora 16 x86-64
 Date: Sat Apr 14 02:02:50 2012
 Stat: From 28 tests executed, 20 have passed (28% failures)
 
 Tests Failed:
 
 
  Test Name   
 ResultRun time
 
 kvm.raw.smp4.Fedora.16.64.autotest.bonnie 
 FAIL  179
 kvm.raw.smp4.Fedora.16.64.balloon_check 
 FAIL   91 
 kvm.raw.smp4.Fedora.16.64.balloon_check.balloon-migrate 
 FAIL  151
 kvm.raw.smp4.Fedora.16.64.cgroup.blkio_bandwidth  
 FAIL  189
 kvm.raw.smp4.Fedora.16.64.cgroup.blkio_throttle_multi 
 FAIL  348
 kvm.raw.smp4.Fedora.16.64.cgroup.cpuset_cpus  
 FAIL8
 kvm.raw.smp4.Fedora.16.64.cgroup.memory_move  
 FAIL   50
 kvm.raw.smp4.Fedora.16.64.cpu_hotplug_test
 FAIL   96
 
 
 Tests Passed:
 
 
  Test Name   
 ResultRun time
 
 kvm.raw.smp4.Fedora.16.64.boot
 PASS   38
 kvm.raw.smp4.Fedora.16.64.autotest.dbench 
 PASS  109
 kvm.raw.smp4.Fedora.16.64.autotest.ebizzy   

Re: [Autotest] Migration through file descriptor

2012-04-19 Thread Lucas Meneghel Rodrigues
Applied, thanks!

On Thu, Apr 19, 2012 at 1:27 PM, Jiří Župka jzu...@redhat.com wrote:
 This patch series adds
 1) support for migration over fd.
 2) Add multihost migration test over fd.

 pull-request: https://github.com/autotest/autotest/pull/312

 ___
 Autotest mailing list
 autot...@test.kernel.org
 http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



-- 
Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: trans_hugepage_swapping: Fix test to use current APIs

2012-04-18 Thread Lucas Meneghel Rodrigues
Test was using a reference to an old API that no longer
exists in virt_utils. Instead, let's use the current
methods to grab a VM class (methods of the env object).

Also, use up to date methods to get an ssh session to the vm.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/trans_hugepage_swapping.py |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/client/virt/tests/trans_hugepage_swapping.py 
b/client/virt/tests/trans_hugepage_swapping.py
index 056ad8a..9a2608b 100644
--- a/client/virt/tests/trans_hugepage_swapping.py
+++ b/client/virt/tests/trans_hugepage_swapping.py
@@ -71,23 +71,22 @@ def run_trans_hugepage_swapping(test, params, env):
 
 # Set the memory size of vm
 # To ignore the oom killer set it to the free swap size
-vm = virt_test_utils.get_living_vm(env, params.get(main_vm))
+vm = env.get_vm(params.get(main_vm))
+vm.verify_alive()
 if int(params['mem'])  swap_free[0]:
 vm.destroy()
 vm_name = 'vmsw'
 vm0 =  params.get(main_vm)
-vm0_key = virt_utils.env_get_vm(env, vm0)
+vm0_key = env.get_vm(vm0)
 params['vms'] = params['vms'] +   + vm_name
 params['mem'] = str(swap_free[0])
 vm_key = vm0_key.clone(vm0, params)
 virt_utils.env_register_vm(env, vm_name, vm_key)
 virt_env_process.preprocess_vm(test, params, env, vm_name)
 vm_key.create()
-session = virt_utils.wait_for(vm_key.remote_login,
-  timeout=login_timeout)
+session = vm_key.wait_for_login(timeout=login_timeout)
 else:
-session = virt_test_utils.wait_for_login(vm,
-timeout=login_timeout)
+session = vm.wait_for_login(timeout=login_timeout)
 
 error.context(making guest to swap memory)
 cmd = (dd if=/dev/zero of=%s/zero bs=%s00 count=%s %
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: RHEL-6-series.ks - Add coreutils and usbutils

2012-04-12 Thread Lucas Meneghel Rodrigues
Those packages are needed for some of the new tests
added to the kvm test set.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/unattended/RHEL-6-series.ks |2 ++
 1 file changed, 2 insertions(+)

diff --git a/client/virt/unattended/RHEL-6-series.ks 
b/client/virt/unattended/RHEL-6-series.ks
index f46ce35..c2132be 100644
--- a/client/virt/unattended/RHEL-6-series.ks
+++ b/client/virt/unattended/RHEL-6-series.ks
@@ -27,6 +27,8 @@ poweroff
 NetworkManager
 ntpdate
 watchdog
+coreutils
+usbutils
 
 %post --interpreter /usr/bin/python
 import os
-- 
1.7.9.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.tests.netstress_kill_guest: Workaround udev writing to serial

2012-03-07 Thread Lucas Meneghel Rodrigues
On some Linux guests such as RHEL 6.2, it's common that when
the succession of rmmods and modprobes happen, udev, SELinux
and other platform software write messages directly to the
serial, confusing aexpect. So let's write some code to
work around this peculiarity, being more robust in handling
these situations.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/netstress_kill_guest.py |   22 +-
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/client/virt/tests/netstress_kill_guest.py 
b/client/virt/tests/netstress_kill_guest.py
index 50eb0af..722169c 100644
--- a/client/virt/tests/netstress_kill_guest.py
+++ b/client/virt/tests/netstress_kill_guest.py
@@ -121,17 +121,29 @@ def run_netstress_kill_guest(test, params, env):
 os.kill(pid, signal.SIGCONT)
 
 
+def send_cmd_safe(session_serial, cmd):
+logging.debug(Sending command: %s, cmd)
+session_serial.sendline(cmd)
+got_prompt = False
+while not got_prompt:
+time.sleep(0.2)
+session_serial.sendline()
+try:
+session_serial.read_up_to_prompt()
+got_prompt = True
+except aexpect.ExpectTimeoutError:
+pass
+
+
 def netdriver_kill_problem(session_serial):
 modules = get_ethernet_driver(session_serial)
 logging.debug(modules)
 for _ in range(50):
 for module in modules:
-session_serial.cmd(rmmod %s % (module))
-time.sleep(0.2)
+send_cmd_safe(session_serial, rmmod %s % module)
 for module in modules:
-logging.debug(Sending command: modprobe %s, module)
-session_serial.sendline(modprobe %s\n % (module))
-time.sleep(0.2)
+send_cmd_safe(session_serial, modprobe %s % module)
+
 kill_and_check(vm)
 
 
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.tests.ethtool: Improving logging and fixing loop execution

2012-03-07 Thread Lucas Meneghel Rodrigues
Make sure we go through all tests available and record the failures.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/ethtool.py |  101 ++
 1 files changed, 63 insertions(+), 38 deletions(-)

diff --git a/client/virt/tests/ethtool.py b/client/virt/tests/ethtool.py
index fa9448e..45942a8 100644
--- a/client/virt/tests/ethtool.py
+++ b/client/virt/tests/ethtool.py
@@ -6,7 +6,7 @@ from autotest_lib.client.virt import virt_test_utils, 
virt_utils, aexpect
 
 def run_ethtool(test, params, env):
 
-Test offload functions of ethernet device by ethtool
+Test offload functions of ethernet device using ethtool
 
 1) Log into a guest.
 2) Initialize the callback of sub functions.
@@ -35,9 +35,11 @@ def run_ethtool(test, params, env):
 }
 o = session.cmd(ethtool -k %s % ethname)
 try:
-return re.findall(%s: (.*) % feature_pattern.get(f_type), o)[0]
+result = re.findall(%s: (.*) % feature_pattern.get(f_type), o)[0]
+logging.debug((%s) %s: %s, ethname, f_type, result)
+return result
 except IndexError:
-logging.debug(Could not get %s status, f_type)
+logging.debug((%s) %s: failed to get status, ethname, f_type)
 
 
 def ethtool_set(f_type, status):
@@ -47,7 +49,7 @@ def run_ethtool(test, params, env):
 @param f_type: Offload type name
 @param status: New status will be changed to
 
-logging.info(Try to set %s %s, f_type, status)
+logging.info((%s) %s: set status %s, ethname, f_type, status)
 if status not in [off, on]:
 return False
 cmd = ethtool -K %s %s %s % (ethname, f_type, status)
@@ -55,28 +57,30 @@ def run_ethtool(test, params, env):
 try:
 session.cmd(cmd)
 return True
-except Exception:
+except aexpect.ShellCmdError, e:
+logging.error(e)
 return False
 if ethtool_get(f_type) != status:
-logging.error(Fail to set %s %s, f_type, status)
+logging.error((%s) %s: set status %s failed, ethname, f_type,
+  status)
 return False
 return True
 
 
 def ethtool_save_params():
-logging.info(Save ethtool configuration)
+logging.info(Saving ethtool configuration)
 for i in supported_features:
 feature_status[i] = ethtool_get(i)
 
 
 def ethtool_restore_params():
-logging.info(Restore ethtool configuration)
+logging.info(Restoring ethtool configuration)
 for i in supported_features:
 ethtool_set(i, feature_status[i])
 
 
 def compare_md5sum(name):
-logging.info(Compare md5sum of the files on guest and host)
+logging.info(Comparing md5sum of the files on guest and host)
 host_result = utils.hash_file(name, method=md5)
 try:
 o = session.cmd_output(md5sum %s % name)
@@ -88,7 +92,7 @@ def run_ethtool(test, params, env):
 return guest_result == host_result
 
 
-def transfer_file(src=guest):
+def transfer_file(src):
 
 Transfer file by scp, use tcpdump to capture packets, then check the
 return string.
@@ -97,21 +101,24 @@ def run_ethtool(test, params, env):
 @return: Tuple (status, error msg/tcpdump result)
 
 session2.cmd_output(rm -rf %s % filename)
+
 dd_cmd = (dd if=/dev/urandom of=%s bs=1M count=%s %
   (filename, params.get(filesize)))
-failure = (False, Failed to create file using dd, cmd: %s % dd_cmd)
-logging.info(Creating file in source host, cmd: %s, dd_cmd)
+
+failure = (False, Failed to create file using: %s % dd_cmd)
+
+logging.info(Creating file in %s, cmd: %s, src, dd_cmd)
 tcpdump_cmd = tcpdump -lep -s 0 tcp -vv port ssh
 if src == guest:
 tcpdump_cmd +=  and src %s % guest_ip
-copy_files_from = vm.copy_files_from
+copy_files_func = vm.copy_files_from
 try:
 session.cmd_output(dd_cmd, timeout=360)
 except aexpect.ShellCmdError, e:
 return failure
 else:
 tcpdump_cmd +=  and dst %s % guest_ip
-copy_files_from = vm.copy_files_to
+copy_files_func = vm.copy_files_to
 try:
 utils.system(dd_cmd)
 except error.CmdError, e:
@@ -119,34 +126,36 @@ def run_ethtool(test, params, env):
 
 # only capture the new tcp port after offload setup
 original_tcp_ports = re.findall(tcp.*:(\d+).*%s % guest_ip,
-  utils.system_output(/bin/netstat -nap))
+   utils.system_output(/bin/netstat 
-nap))
+
 for i in original_tcp_ports:
 tcpdump_cmd +=  and not port

Re: [KVM-AUTOTEST] [KVM-autotest] Cgroup-kvm rework

2012-02-28 Thread Lucas Meneghel Rodrigues

On 02/27/2012 03:42 PM, Lukas Doktor wrote:

Hi,

This is a complete rework of cgroup test from subtests to singe-test-execution. 
It improves stability of testing and allows better test customisation. The 
speed is similar/faster in single variant execution and a bit slower in 
all-variants execution compare to previous version.

It also contains a lot of important bugfixes and some cool enhancements 
described in patch.

Checkout current version on:
https://github.com/autotest/autotest/pull/209


Patchset applied, thanks Lukas!


Regards,
Lukáš



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: Fix migration bg command

2012-02-14 Thread Lucas Meneghel Rodrigues
In migration tests, the command we were using as a
'watchdog' command was tcpdump, but without specifying
which interface it should listen to. As this may fail
depending on the interface ordering, let's change the
command to listen in all interfaces, since this way
it's safer and the command won't fail depending on
the interface ordering.

Signed-off-by: Eduardo Habkost ehabk...@redhat.com
---
 client/virt/subtests.cfg.sample |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index b08a5c4..56043e0 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -350,7 +350,7 @@ variants:
 - migrate: install setup image_copy unattended_install.cdrom
 type = migration
 migration_test_command = help
-migration_bg_command = cd /tmp; nohup tcpdump -q -t ip host localhost
+migration_bg_command = cd /tmp; nohup tcpdump -q -i any -t ip host 
localhost
 migration_bg_check_command = pgrep tcpdump
 migration_bg_kill_command = pkill tcpdump
 kill_vm_on_error = yes
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: Fix libvirt vm incompatibility with RHEL 5

2012-01-18 Thread Lucas Meneghel Rodrigues
There's no vnclisten param in the virt-install command
shipped in RHEL 5, so let's add it to the command line
only if does support this option.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/libvirt_vm.py |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index c825661..73894c6 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -536,7 +536,10 @@ class VM(virt_vm.BaseVM):
 return  --vnc --vncport=%d % (vnc_port)
 
 def add_vnclisten(help, vnclisten):
-return  --vnclisten=%s  % (vnclisten)
+if has_option(help, vnclisten):
+return  --vnclisten=%s % (vnclisten)
+else:
+return 
 
 def add_sdl(help):
 if has_option(help, sdl):
-- 
1.7.7.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] libvirt_vm.py: Set ignore_status to False in virsh_cmd().

2012-01-12 Thread Lucas Meneghel Rodrigues

On 01/11/2012 05:06 AM, tangchen wrote:

utils.run()'s parameter ignore_status is set to True in virsh_cmd().
In this case we are not able to know whether the command succeeds.
This patch sets it to False, and utils.run() will throw an exception
when command fails.


Problem with this is that some commands may fail and that is not a fatal 
problem, for example:


13:49:26 ERROR| Test failed: CmdError: Command /usr/bin/virsh -c 
qemu:///system domstate vm1 failed, rc=1, Command returned non-zero 
exit status[context: preprocessing]

* Command:
/usr/bin/virsh -c qemu:///system domstate vm1
Exit status: 1
Duration: 0.0250420570374

stderr:
error: failed to get domain 'vm1'
error: Domain not found: no domain with matching name 'vm1'

This is just a function to probe whether the domain exists or not, so it 
shouldn't throw an exception. I agree we can do better handling of 
failures, but a more thorough patch handling failures on the functions 
dependent on virsh_cmd is needed.


So I'm rejecting the patch. Feel free to open an issue contemplating 
this perceived problem, and we can work towards a more appropriate patch.




Signed-off-by: Tang Chentangc...@cn.fujitsu.com
---
  client/virt/libvirt_vm.py |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index c825661..6f30f36 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -38,7 +38,7 @@ def virsh_cmd(cmd, uri = ):
  if uri:
  uri_arg = -c  + uri

-cmd_result = utils.run(%s %s %s % (VIRSH_EXEC, uri_arg, cmd), 
ignore_status=True,
+cmd_result = utils.run(%s %s %s % (VIRSH_EXEC, uri_arg, cmd), 
ignore_status=False,
 verbose=DEBUG)
  if DEBUG:
  if cmd_result.stdout.strip():


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: Fix issue #90 - MonitorSocketError installing SLES

2012-01-12 Thread Lucas Meneghel Rodrigues
Sometimes, before a KVM VM shuts down cleanly, a Monitor
connection reset error might happen, even though it's
not a fatal condition for the test. So, let's handle
better MonitorErrors happening during the unattended
install loop.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/unattended_install.py |   15 +++
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/client/virt/tests/unattended_install.py 
b/client/virt/tests/unattended_install.py
index 95a11da..473c2db 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -4,7 +4,8 @@ import xml.dom.minidom
 from autotest_lib.client.common_lib import error
 from autotest_lib.client.bin import utils
 from autotest_lib.client.virt import virt_vm, virt_utils, virt_http_server
-from autotest_lib.client.virt import libvirt_vm
+from autotest_lib.client.virt import libvirt_vm, kvm_monitor
+
 
 # Whether to print all shell commands called
 DEBUG = False
@@ -928,7 +929,9 @@ def run_unattended_install(test, params, env):
 while (time.time() - start_time)  install_timeout:
 try:
 vm.verify_alive()
-except virt_vm.VMDeadError, e:
+# Due to a race condition, sometimes we might get a MonitorError
+# before the VM gracefully shuts down, so let's capture MonitorErrors.
+except (virt_vm.VMDeadError, kvm_monitor.MonitorError), e:
 if params.get(wait_no_ack, no) == yes:
 break
 else:
@@ -977,5 +980,9 @@ def run_unattended_install(test, params, env):
 shutdown_cleanly_timeout = int(params.get(shutdown_cleanly_timeout,
   120))
 logging.info(Wait for guest to shutdown cleanly)
-if virt_utils.wait_for(vm.is_dead, shutdown_cleanly_timeout, 1, 1):
-logging.info(Guest managed to shutdown cleanly)
+try:
+if virt_utils.wait_for(vm.is_dead, shutdown_cleanly_timeout, 1, 1):
+logging.info(Guest managed to shutdown cleanly)
+except kvm_monitor.MonitorError, e:
+logging.warning(Guest apparently shut down, but got a 
+monitor error: %s, e)
-- 
1.7.7.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt.tests: Fix issue #18 - set_link

2012-01-12 Thread Lucas Meneghel Rodrigues
With the recent introduction of an improved set_link
interface (see 4ada095f8bd3a3435d6f51db0b4164c7d1122070
and a9ef23f9ed66ca5892f8a3c784b33093d6b5ced4),
update the set_link test with it and resolve
issue #18.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/set_link.py |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/tests/set_link.py 
b/client/tests/kvm/tests/set_link.py
index ef34c71..f50dc93 100644
--- a/client/tests/kvm/tests/set_link.py
+++ b/client/tests/kvm/tests/set_link.py
@@ -29,13 +29,13 @@ def run_set_link(test, params, env):
 
 ip = vm.get_address(0)
 
-vm.monitor.cmd(set_link %s down % linkid)
+vm.set_link(linkid, up=False)
 s, o = virt_test_utils.ping(ip, count=10, timeout=20)
 if virt_test_utils.get_loss_ratio(o) != 100:
 raise error.TestFail(Still can ping the %s after down %s %
  (ip, linkid))
 
-vm.monitor.cmd(set_link %s up % linkid)
+vm.set_link(linkid, up=True)
 s, o = virt_test_utils.ping(ip, count=10, timeout=20)
 # we use 100% here as the notification of link status changed may be
 # delayed in guest driver
-- 
1.7.7.5

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Autotest PATCH v2 0/4] Network performance regression

2012-01-06 Thread Lucas Meneghel Rodrigues

On 01/05/2012 01:05 AM, Amos Kong wrote:

This patchset adds a new network perf testcase for Windows,
refactors old netperf test, and support numa resource control.
Process the raw results to a 'standard format' at the end of test,
then we can analyze them with general module, compute average
and compare with old results.
User can configure test time/repeat times for getting stable results.

Welcome to give feedback, thanks in advance!


I've made a first review of the series, with comments on your pull request:

https://github.com/autotest/autotest/pull/126

Let me know what you think about my findings.

Cheers,

Lucas


Changes from v1:
- refactor analysis module
- add new features in analysis code
- shape those two tests
- fix some script bugs
- add autoio script for ntttcp test

---

Amos Kong (4):
   virt-test: add NTttcp subtests
   virt-test: Refactor netperf test and add analysis module
   netperf: pin guest vcpus/memory/vhost thread to numa node
   virt: Introduce regression testing infrastructure


  client/tests/kvm/control|7 +
  client/tests/kvm/perf.conf  |   23 +++
  client/virt/scripts/ntttcp.au3  |   41 +
  client/virt/subtests.cfg.sample |   59 ++-
  client/virt/tests/analyzer.py   |  172 ++
  client/virt/tests/netperf.py|  312 ---
  client/virt/tests/ntttcp.py |  183 +++
  client/virt/tests/regression.py |   34 
  8 files changed, 733 insertions(+), 98 deletions(-)
  create mode 100644 client/tests/kvm/perf.conf
  create mode 100755 client/virt/scripts/ntttcp.au3
  create mode 100644 client/virt/tests/analyzer.py
  create mode 100644 client/virt/tests/ntttcp.py
  create mode 100644 client/virt/tests/regression.py



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Autotest] [PATCH] virt: Add the parameter --vnclisten to the virt-install command

2012-01-03 Thread Lucas Meneghel Rodrigues

On 01/02/2012 11:50 PM, tangchen wrote:

Hi~

Here is the problem:)

Without vnclisten, guest is still accessable from localhost by vnc.
But we cannot access guest from other host.

And most of the time, we do the test on remote host, and in this situation,
vnclisten is very useful.:)


Ok, fair enough, applied, thanks!
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Autotest] [PATCH] virt: Add the parameter --vnclisten to the virt-install command

2011-12-30 Thread Lucas Meneghel Rodrigues

On 12/30/2011 03:26 AM, tangchen wrote:

Hi,

My colleague happened to find that when installing a Guest,
we cannot access to it by VNC because of the missing
parameter --vnclisten=0.0.0.0 in virt-install.

Here is the patch, please comment! :)


Strange, I can access the guests using VNC just fine. I wonder why that 
is happening to you guys...




Signed-off-by: Gu Yanhuaguyanhua-f...@cn.fujitsu.com
---
  client/virt/libvirt_vm.py |8 
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 65db338..4684aeb 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -287,6 +287,7 @@ class VM(virt_vm.BaseVM):
  self.serial_console = None
  self.redirs = {}
  self.vnc_port = 5900
+self.vnclisten = 0.0.0.0
  self.pci_assignable = None
  self.netdev_id = []
  self.device_id = []
@@ -298,6 +299,7 @@ class VM(virt_vm.BaseVM):
  self.params = params
  self.root_dir = root_dir
  self.address_cache = address_cache
+self.vnclisten = 0.0.0.0
  # For now, libvirt does not have a monitor property.
  self.monitor = None
  self.driver_type = params.get(driver_type, self.LIBVIRT_DEFAULT)
@@ -489,6 +491,9 @@ class VM(virt_vm.BaseVM):

  def add_vnc(help, vnc_port):
  return  --vnc --vncport=%d % (vnc_port)
+
+def add_vnclisten(help, vnclisten):
+return  --vnclisten=%s  % (vnclisten)

  def add_sdl(help):
  if has_option(help, sdl):
@@ -629,6 +634,9 @@ class VM(virt_vm.BaseVM):
  if params.get(vnc_port):
  vm.vnc_port = int(params.get(vnc_port))
  virt_install_cmd += add_vnc(help, vm.vnc_port)
+if params.get(vnclisten):
+vm.vnclisten = params.get(vnclisten)
+virt_install_cmd += add_vnclisten(help, vm.vnclisten)
  elif params.get(display) == sdl:
  virt_install_cmd += add_sdl(help)
  elif params.get(display) == nographic:
-- 1.7.1




--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] virt: Config file unification

2011-12-29 Thread Lucas Meneghel Rodrigues
Make kvm and libvirt test configs mostly shared, so it's
easy to maintain those config files.

Chris Evich (5):
  virt: Adding common config among libvirt and kvm tests
  virt: Remove sample config from kvm and libvirt folders
  virt: Move vm_type into separate tests.cfg.sample
  virt: libvirt_vm: Avoid re-copying kernel and initrd on install
  virt: Fixup extra_params usage and config

 client/tests/kvm/base.cfg.sample   |  169 ---
 client/tests/kvm/cdkeys.cfg.sample |   18 -
 client/tests/kvm/guest-hw.cfg.sample   |  105 --
 client/tests/kvm/guest-os.cfg.sample   | 1729 
 client/tests/kvm/subtests.cfg.sample   | 1385 --
 client/tests/kvm/tests.cfg.sample  |5 +
 client/tests/kvm/virtio-win.cfg.sample |  235 
 client/tests/libvirt/base.cfg.sample   |  134 ---
 client/tests/libvirt/cdkeys.cfg.sample |   18 -
 client/tests/libvirt/guest-hw.cfg.sample   |  107 --
 client/tests/libvirt/guest-os.cfg.sample   | 1664 --
 client/tests/libvirt/subtests.cfg.sample   | 1045 -
 client/tests/libvirt/tests.cfg.sample  |5 +
 client/tests/libvirt/virtio-win.cfg.sample |  235 
 client/virt/base.cfg.sample|  180 +++
 client/virt/cdkeys.cfg.sample  |   18 +
 client/virt/guest-hw.cfg.sample|  110 ++
 client/virt/guest-os.cfg.sample| 1720 +++
 client/virt/kvm_vm.py  |4 +
 client/virt/libvirt_vm.py  |   19 +-
 client/virt/subtests.cfg.sample| 1392 ++
 client/virt/virt_utils.py  |6 +-
 client/virt/virtio-win.cfg.sample  |  235 
 23 files changed, 3687 insertions(+), 6851 deletions(-)
 delete mode 100644 client/tests/kvm/base.cfg.sample
 delete mode 100644 client/tests/kvm/cdkeys.cfg.sample
 delete mode 100644 client/tests/kvm/guest-hw.cfg.sample
 delete mode 100644 client/tests/kvm/guest-os.cfg.sample
 delete mode 100644 client/tests/kvm/subtests.cfg.sample
 delete mode 100644 client/tests/kvm/virtio-win.cfg.sample
 delete mode 100644 client/tests/libvirt/base.cfg.sample
 delete mode 100644 client/tests/libvirt/cdkeys.cfg.sample
 delete mode 100644 client/tests/libvirt/guest-hw.cfg.sample
 delete mode 100644 client/tests/libvirt/guest-os.cfg.sample
 delete mode 100644 client/tests/libvirt/subtests.cfg.sample
 delete mode 100644 client/tests/libvirt/virtio-win.cfg.sample
 create mode 100644 client/virt/base.cfg.sample
 create mode 100644 client/virt/cdkeys.cfg.sample
 create mode 100644 client/virt/guest-hw.cfg.sample
 create mode 100644 client/virt/guest-os.cfg.sample
 create mode 100644 client/virt/subtests.cfg.sample
 create mode 100644 client/virt/virtio-win.cfg.sample

-- 
1.7.7.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] virt: Move vm_type into separate tests.cfg.sample

2011-12-29 Thread Lucas Meneghel Rodrigues
Moved vm_type setting into seperate tests.cfg.sample so that
base.cfg.sample can be shared between virt test types.

Signed-off-by: Chris Evich cev...@redhat.com
---
 client/tests/kvm/tests.cfg.sample |5 +
 client/tests/libvirt/tests.cfg.sample |5 +
 client/virt/base.cfg.sample   |4 
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/client/tests/kvm/tests.cfg.sample 
b/client/tests/kvm/tests.cfg.sample
index bd0d05e..9048884 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -10,6 +10,11 @@ include guest-hw.cfg
 include cdkeys.cfg
 include virtio-win.cfg
 
+# Virtualization type (kvm or libvirt)
+# TODO: Update code to use vm_library + vm_type + vm_subtype
+#   i.e.(libvirt/none) + (qemu/kvm/xen) + (hvm/paravirt)
+vm_type = kvm
+
 # Here you can override the image name for our custom linux and windows guests
 #
 CustomGuestLinux:
diff --git a/client/tests/libvirt/tests.cfg.sample 
b/client/tests/libvirt/tests.cfg.sample
index 831ff4e..158c7b1 100644
--- a/client/tests/libvirt/tests.cfg.sample
+++ b/client/tests/libvirt/tests.cfg.sample
@@ -8,6 +8,11 @@ include guest-hw.cfg
 include cdkeys.cfg
 include virtio-win.cfg
 
+# Virtualization type (kvm or libvirt)
+# TODO: Update code to use vm_library + vm_type + vm_subtype
+#   i.e.(libvirt/none) + (qemu/kvm/xen) + (hvm/paravirt)
+vm_type = libvirt
+
 variants:
 # Runs virt-install, f16 64 bit guest OS, install, boot, shutdown
 - @libvirt_f16_quick:
diff --git a/client/virt/base.cfg.sample b/client/virt/base.cfg.sample
index eda511c..7bd998a 100644
--- a/client/virt/base.cfg.sample
+++ b/client/virt/base.cfg.sample
@@ -9,10 +9,6 @@ qemu_io_binary = qemu-io
 vms = vm1
 # Default virtual machine to use, when not specified by test.
 main_vm = vm1
-# Virtualization type (kvm or libvirt)
-# TODO: Update code to use vm_library + vm_type + vm_subtype
-#   i.e.(libvirt/none) + (qemu/kvm/xen) + (hvm/paravirt)
-vm_type = kvm
 
 # List of network device object names (whitespace seperated)
 nics = nic1
-- 
1.7.7.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] virt: libvirt_vm: Avoid re-copying kernel and initrd on install

2011-12-29 Thread Lucas Meneghel Rodrigues
Added simple workaround for virt-install's insistence on re-copying
kernel and initrd files from a specific directory layout.  Added a note
that this code should be cleaned up if/when corresponding part of
unattended_install test is cleaned.

Signed-off-by: Chris Evich cev...@redhat.com
---
 client/virt/libvirt_vm.py |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 65db338..97b9f8b 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -601,7 +601,7 @@ class VM(virt_vm.BaseVM):
 if smp:
 virt_install_cmd += add_smp(help, smp)
 
-# TODO: directory location for vmlinuz/kernel for cdrom install ?
+# libvirt expects --location path/images/pxeboot/vmlinuz|initrd
 location = None
 if params.get(medium) == 'url':
 if params.get(url) == 'auto':
@@ -620,7 +620,16 @@ class VM(virt_vm.BaseVM):
 if params.get(use_libvirt_cdrom_switch) == 'yes':
 virt_install_cmd += add_cdrom(help, params.get(cdrom_cd1))
 else:
-location = params.get(image_dir)
+# Fake images/pxeboot using relative symlinks
+# Assumes kernel and initrd were copied to same dir
+# TODO: This and cooresponding add_cdrom() in 
unattended_install test
+#   should be much cleaner.
+location = os.path.dirname(params.get(kernel))
+try:
+os.symlink( ., os.path.join(location, images)  )
+os.symlink( ., os.path.join(location, pxeboot)  )
+except OSError:
+pass # ignore if already exists
 
 if location:
 virt_install_cmd += add_location(help, location)
-- 
1.7.7.4

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] virt: Fixup extra_params usage and config

2011-12-29 Thread Lucas Meneghel Rodrigues
Created a special category, 'kernel_params', for options
passed to the kernel which we are booting, such as the
installer kernels. With this patch we don't mess up with
the other uses of extra_params still keeping consistency
between libvirt and kvm tests.

Signe-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/guest-os.cfg.sample |   21 +
 client/virt/kvm_vm.py   |4 
 client/virt/libvirt_vm.py   |6 +++---
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/client/virt/guest-os.cfg.sample b/client/virt/guest-os.cfg.sample
index 538dd87..7eb2b1d 100644
--- a/client/virt/guest-os.cfg.sample
+++ b/client/virt/guest-os.cfg.sample
@@ -104,11 +104,10 @@ variants:
 shell_prompt = ^\[.*\][\#\$]\s*$
 unattended_install:
 boot_path = images/pxeboot
-# TODO: does kvm need to prefix this with '--append'?
-extra_params +=  'ks=cdrom nicdelay=60 
console=ttyS0,115200 console=tty0'
+kernel_params = ks=cdrom nicdelay=60 console=ttyS0,115200 
console=tty0
 # You have to use ks=floppy if you want to use floppies to
 # hold your kickstart file
-#extra_params +=  ks=floppy nicdelay=60 
console=ttyS0,115200 console=tty0
+#kernel_params = ks=floppy nicdelay=60 
console=ttyS0,115200 console=tty0
 variants:
 - 8.32:
 no setup
@@ -403,8 +402,7 @@ variants:
 boot_path = images/pxeboot
 # You have to use ks=floppy if you want to use floppies to
 # hold your kickstart file
-# TODO: does kvm need to prefix this with '--append'?
-extra_params +=  ks=cdrom nicdelay=60 
console=ttyS0,115200 console=tty0
+kernel_params = ks=cdrom nicdelay=60 console=ttyS0,115200 
console=tty0
 variants:
 - 3.9.i386:
 no setup autotest linux_s3 guest_s4 shutdown multi_disk
@@ -768,8 +766,8 @@ variants:
 unattended_install:
 # You have to use autoyast=floppy if you want to use 
floppies to
 # hold your autoyast file
-#extra_params +=  --append 'autoyast=floppy 
console=ttyS0,115200 console=tty0'
-extra_params +=  --append 
'autoyast=device://scd0/autoinst.xml console=ttyS0,115200 console=tty0'
+#kernel_params = autoyast=floppy console=ttyS0,115200 
console=tty0
+kernel_params = autoyast=device://scd0/autoinst.xml 
console=ttyS0,115200 console=tty0
 wait_no_ack = yes
 
 variants:
@@ -932,10 +930,10 @@ variants:
 unattended_install:
 # You have to use autoyast=floppy if you want to use 
floppies to
 # hold your autoyast file
-#extra_params +=  --append 'autoyast=floppy 
console=ttyS0,115200 console=tty0'
-extra_params +=  --append 
'autoyast=device://scd0/autoinst.xml console=ttyS0,115200 console=tty0'
+#kernel_params = autoyast=floppy console=ttyS0,115200 
console=tty0
+kernel_params = autoyast=device://scd0/autoinst.xml 
console=ttyS0,115200 console=tty0
 # --- uncomment the below line for other SLES 10 distros 
only ---
-#extra_params +=  --append 
'autoyast=device://hdb/autoinst.xml console=ttyS0,115200 console=tty0'
+#kernel_params = autoyast=device://hdb/autoinst.xml 
console=ttyS0,115200 console=tty0
 kernel = linux
 initrd = initrd
 wait_no_ack = yes
@@ -1036,7 +1034,7 @@ variants:
 kernel = linux
 initrd = initrd
 wait_no_ack = yes
-extra_params +=  --append 'console=ttyS0,115200 
console=tty0'
+kernel_params = console=ttyS0,115200 console=tty0
 
 variants:
 - 6.10-32:
@@ -1720,4 +1718,3 @@ variants:
 steps = steps/memtest86+.steps
 cdrom_cd1 = isos/misc/memtest86+-2.01.iso
 md5sum_cd1 = 9fae22f2666369968a76ef59e9a81ced
-
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 1fb177f..b55d57d 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -680,6 +680,10 @@ class VM(virt_vm.BaseVM):
 for pci_id in vm.pa_pci_ids:
 qemu_cmd += add_pcidevice(help, pci_id)
 
+kernel_params = params.get(kernel_params)
+if kernel_params:
+qemu_cmd +=  --append '%s' % kernel_params
+
 extra_params = params.get(extra_params)
 if extra_params:
 qemu_cmd +=  %s

Re: [PATCH] virt-test: support static ip address in framework

2011-12-20 Thread Lucas Meneghel Rodrigues

On 12/19/2011 11:11 AM, Amos Kong wrote:

Sometime, we need to test with guest(s) which have static ip
address(es).
eg. No real/emulated DHCP server in test environment.
eg. Test with old image we don't want to change the net config.
eg. Test when DHCP exists problem.


Ok Amos, looks reasonable. Would you please send a v2 with ip_nic 
commented out and a companion wiki documentation? It'd be the start of a 
KVM autotest networking documentation. In case you are not aware, the 
autotest wiki is now a git repo, you can clone it, edit the pages on 
your editor, commit and push the changes.


If you have any problems, please contact me.

Cheers,

Lucas


This is an example of using static ip address:
1. edit ifcfg-eth0 of guest to assign static IP
(192.168.100.110). You can also do this by install
post-script/serial.
2. add and setup bridge in host
# brctl addbr vbr
# ifconfig vbr 192.168.100.1
3. add script for setup tap device
/etc/qemu-ifup-vbr
| #!/bin/sh
| switch=vbr
| /sbin/ifconfig $1 0.0.0.0 up
| /usr/sbin/brctl addif ${switch} $1
| /usr/sbin/brctl setfd ${switch} 0
| /usr/sbin/brctl stp ${switch} off
4. assign parameters in config file and execute test as usual
test.cfg:
| ip_nic1 = 192.168.100.110
| mac_nic1 = 11:22:33:44:55:67
| bridge = vbr

Signed-off-by: Amos Kongak...@redhat.com
---
  client/tests/kvm/base.cfg.sample |3 +++
  1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/base.cfg.sample b/client/tests/kvm/base.cfg.sample
index 411decf..c86ec1f 100644
--- a/client/tests/kvm/base.cfg.sample
+++ b/client/tests/kvm/base.cfg.sample
@@ -17,6 +17,9 @@ nics = nic1
  # Connect NIC devices to host bridge device
  bridge = virbr0

+# Tell framework of nic1's static ip address
+ip_nic1 = 192.168.100.110
+
  # List of block device object names (whitespace seperated)
  images = image1
  # List of optical device object names
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index fa258c3..1fb177f 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -821,7 +821,12 @@ class VM(virt_vm.BaseVM):
  if mac:
  virt_utils.set_mac_address(self.instance, vlan, mac)
  else:
-virt_utils.generate_mac_address(self.instance, vlan)
+mac = virt_utils.generate_mac_address(self.instance, vlan)
+
+if nic_params.get(ip):
+self.address_cache[mac] = nic_params.get(ip)
+logging.debug((address cache) Adding static cache entry: 
+  %s ---  %s % (mac, nic_params.get(ip)))

  # Assign a PCI assignable device
  self.pci_assignable = None

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][Autotest] Autotest: Add subtest inteface to client utils.

2011-12-20 Thread Lucas Meneghel Rodrigues

On 12/09/2011 10:50 AM, Jiří Župka wrote:

This class and some decorators are for easy way of start function like a 
subtest.
Subtests result are collected and it is posible for review on end of test.
Subtest class and decorators should be placed in autotest_lib.client.utils.

 There is possibility how to change  results format.

 Example:
 @staticmethod
 def result_to_string(result):
 
 @param result: Result of test.
 
 print result
 return ([%(result)]%(name): %(output)) % (result)

   1)
 Subtest.result_to_string = result_to_string
 Subtest.get_text_result()

   2)
 Subtest.get_text_result(result_to_string)

Pull-request: https://github.com/autotest/autotest/pull/111


^ I made a few remarks to the pull request, and now I wait on an updated 
version of the patchset. Thanks Jiri!



Signed-off-by: Jiří Župkajzu...@redhat.com
---
  client/common_lib/base_utils.py  |  214 ++
  client/common_lib/base_utils_unittest.py |  117 
  2 files changed, 331 insertions(+), 0 deletions(-)

diff --git a/client/common_lib/base_utils.py b/client/common_lib/base_utils.py
index 005e3b0..fc6578d 100644
--- a/client/common_lib/base_utils.py
+++ b/client/common_lib/base_utils.py
@@ -119,6 +119,220 @@ class BgJob(object):
  signal.signal(signal.SIGPIPE, signal.SIG_DFL)


+def subtest_fatal(function):
+
+Decorator which mark test critical.
+If subtest failed whole test ends.
+
+def wrapped(self, *args, **kwds):
+self._fatal = True
+self.decored()
+result = function(self, *args, **kwds)
+return result
+wrapped.func_name = function.func_name
+return wrapped
+
+
+def subtest_nocleanup(function):
+
+Decorator disable cleanup function.
+
+def wrapped(self, *args, **kwds):
+self._cleanup = False
+self.decored()
+result = function(self, *args, **kwds)
+return result
+wrapped.func_name = function.func_name
+return wrapped
+
+
+class Subtest(object):
+
+Collect result of subtest of main test.
+
+result = []
+passed = 0
+failed = 0
+def __new__(cls, *args, **kargs):
+self = super(Subtest, cls).__new__(cls)
+
+self._fatal = False
+self._cleanup = True
+self._num_decored = 0
+
+ret = None
+if args is None:
+args = []
+
+res = {
+   'result' : None,
+   'name'   : self.__class__.__name__,
+   'args'   : args,
+   'kargs'  : kargs,
+   'output' : None,
+  }
+try:
+logging.info(Starting test %s % self.__class__.__name__)
+ret = self.test(*args, **kargs)
+res['result'] = 'PASS'
+res['output'] = ret
+try:
+logging.info(Subtest.result_to_string(res))
+except:
+self._num_decored = 0
+raise
+Subtest.result.append(res)
+Subtest.passed += 1
+except NotImplementedError:
+raise
+except Exception:
+exc_type, exc_value, exc_traceback = sys.exc_info()
+for _ in range(self._num_decored):
+exc_traceback = exc_traceback.tb_next
+logging.error(In function ( + self.__class__.__name__ + ):)
+logging.error(Call from:\n +
+  traceback.format_stack()[-2][:-1])
+logging.error(Exception from:\n +
+  .join(traceback.format_exception(
+  exc_type, exc_value,
+  exc_traceback.tb_next)))
+# Clean up environment after subTest crash
+res['result'] = 'FAIL'
+logging.info(self.result_to_string(res))
+Subtest.result.append(res)
+Subtest.failed += 1
+if self._fatal:
+raise
+finally:
+if self._cleanup:
+self.clean()
+
+return ret
+
+
+def test(self):
+
+Check if test is defined.
+
+For makes test fatal add before implementation of test method
+decorator @subtest_fatal
+
+raise NotImplementedError(Method test is not implemented.)
+
+
+def clean(self):
+
+Check if cleanup is defined.
+
+For makes test fatal add before implementation of test method
+decorator @subtest_nocleanup
+
+raise NotImplementedError(Method cleanup is not implemented.)
+
+
+def decored(self):
+self._num_decored += 1
+
+
+@classmethod
+def has_failed(cls):
+
+@return: If any of subtest not pass return True.
+
+if cls.failed  0:
+return True
+else:
+

[PATCH] virt.kvm_installer: Fix typo

2011-12-13 Thread Lucas Meneghel Rodrigues
Introduced with commit eda2ffce5c2ec514f404719010106bad1400d2bb.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_installer.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index 2af359d..c4002bc 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -174,7 +174,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 raise error.TestError('Invalid qemu-img path')
 
 qemu_io_bin = self._qemu_io_bin_exists_at_prefix()
-if qemu_img_bin is not None:
+if qemu_io_bin is not None:
 os.symlink(qemu_io_bin, qemu_io_dst)
 else:
 raise error.TestError('Invalid qemu-img path')
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt-test: Add a class NumaNode v2

2011-12-08 Thread Lucas Meneghel Rodrigues
From: Amos Kong ak...@redhat.com

Dynamically checking hardware, use a dict to record the pin status,
pin process to single cpu by 'taskset' command.

Guest memory pining is already implemented in framework.
process pining needs to be done in the testcases.

Example:
|  numa_node = -1 # last node
|  p = virt_utils.NumaNode(numa_node)
|  vhost_threads = commands.getoutput(ps aux |grep '\[vhost-.*\]'
|  |grep -v grep|awk '{print $2}')
|  for i in vhost_threads.split():
|  logging.debug(pin vhost_net thread(%s) to host cpu node % i)
|  p.pin_cpu(i)
|  o = vm.monitor.info(cpus)
|  for i in re.findall(thread_id=(\d+), o):
|  logging.debug(pin vcpu thread(%s) to host cpu node % i)
|  p.pin_cpu(i)
|  p.show()

Changes from v1:
 * Removed usage of commands API, using utils.run() instead
 * Added unittests for NumaNode
 * Improved docstrings

Signed-off-by: Amos Kong ak...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/base.cfg.sample   |6 ++-
 client/virt/kvm_vm.py  |8 +++
 client/virt/virt_utils.py  |   80 +
 client/virt/virt_utils_unittest.py |  112 +++-
 4 files changed, 204 insertions(+), 2 deletions(-)

diff --git a/client/tests/kvm/base.cfg.sample b/client/tests/kvm/base.cfg.sample
index 21fa513..411decf 100644
--- a/client/tests/kvm/base.cfg.sample
+++ b/client/tests/kvm/base.cfg.sample
@@ -147,6 +147,11 @@ shell_port = 22
 used_cpus = 1
 used_mem = 512
 
+# Numa pinning params
+# pin guest memory to 1st numa node
+# pin processes to host cpu of 1st node
+# numa_node = 1
+
 # Port redirections
 redirs = remote_shell
 guest_port_remote_shell = 22
@@ -159,4 +164,3 @@ login_timeout = 360
 
 # NFS directory of guest images
 images_good = fileserver.foo.com:/autotest/images_good
-
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 6747c2b..fa258c3 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -473,6 +473,14 @@ class VM(virt_vm.BaseVM):
 qemu_cmd += LD_LIBRARY_PATH=%s  % library_path
 if params.get(qemu_audio_drv):
 qemu_cmd += QEMU_AUDIO_DRV=%s  % params.get(qemu_audio_drv)
+# Add numa memory cmd to pin guest memory to numa node
+if params.get(numa_node):
+numa_node = int(params.get(numa_node))
+if numa_node  0:
+p = virt_utils.NumaNode(numa_node)
+qemu_cmd += numactl -m %s  % (int(p.get_node_num()) + 
numa_node)
+else:
+qemu_cmd += numactl -m %s  % (numa_node - 1)
 # Add the qemu binary
 qemu_cmd += qemu_binary
 # Add the VM's name
diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 95b2883..b2694ec 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -3452,3 +3452,83 @@ def virt_test_assistant(test_name, test_dir, base_dir, 
default_userspace_paths,
 logging.info(Autotest prints the results dir, so you can look at DEBUG 
  logs if something went wrong)
 logging.info(You can also edit the test config files)
+
+
+class NumaNode(object):
+
+Numa node to control processes and shared memory.
+
+def __init__(self, i=-1):
+self.num = self.get_node_num()
+if i  0:
+self.cpus = self.get_node_cpus(int(self.num) + i).split()
+else:
+self.cpus = self.get_node_cpus(i - 1).split()
+self.dict = {}
+for i in self.cpus:
+self.dict[i] = free
+
+
+def get_node_num(self):
+
+Get the number of nodes of current host.
+
+cmd = utils.run(numactl --hardware)
+return re.findall(available: (\d+) nodes, cmd.stdout)[0]
+
+
+def get_node_cpus(self, i):
+
+Get cpus of a specific node
+
+@param i: Index of the CPU inside the node.
+
+cmd = utils.run(numactl --hardware)
+return re.findall(node %s cpus: (.*) % i, cmd.stdout)[0]
+
+
+def free_cpu(self, i):
+
+Release pin of one node.
+
+@param i: Index of the node.
+
+self.dict[i] = free
+
+
+def _flush_pin(self):
+
+Flush pin dict, remove the record of exited process.
+
+cmd = utils.run(ps -eLf | awk '{print $4}')
+all_pids = cmd.stdout
+for i in self.cpus:
+if self.dict[i] != free and self.dict[i] not in all_pids:
+self.free_cpu(i)
+
+
+@error.context_aware
+def pin_cpu(self, process):
+
+Pin one process to a single cpu.
+
+@param process: Process ID.
+
+self._flush_pin()
+error.context(Pinning process %s to the CPU % process)
+for i in self.cpus:
+if self.dict[i] == free:
+self.dict[i] = str(process)
+cmd = taskset -p %s %s % (hex(2 ** int(i)), process

[PATCH 1/2] virt test: Simplifying address cache messages and exceptions

2011-12-02 Thread Lucas Meneghel Rodrigues
KVM autotest relies on a system that listens network traffic
and registers DHCP leases, so we know what is the IP for a
given guest network card. However, the terminology used on
messages is highly specific to the internal implementation.

So let's use messages with a terminology that can be more
easily understood by people not too familiar with the
internals of autotest.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_env_process.py |2 +-
 client/virt/virt_vm.py  |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index ab2f77e..a4b9f71 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -449,7 +449,7 @@ def _update_address_cache(address_cache, line):
 if matches and address_cache.get(last_seen):
 mac_address = matches[0].lower()
 if time.time() - address_cache.get(time_%s % mac_address, 0)  5:
-logging.debug((address cache) Adding cache entry: %s --- %s,
+logging.debug((address cache) DCHP lease OK: %s -- %s,
   mac_address, address_cache.get(last_seen))
 address_cache[mac_address] = address_cache.get(last_seen)
 address_cache[time_%s % mac_address] = time.time()
diff --git a/client/virt/virt_vm.py b/client/virt/virt_vm.py
index 5cb900b..e2443dd 100644
--- a/client/virt/virt_vm.py
+++ b/client/virt/virt_vm.py
@@ -130,8 +130,8 @@ class VMAddressVerificationError(VMAddressError):
 self.ip = ip
 
 def __str__(self):
-return (Cannot verify MAC-IP address mapping using arping: 
-%s --- %s % (self.mac, self.ip))
+return (Could not verify DHCP lease: 
+%s -- %s % (self.mac, self.ip))
 
 
 class VMMACAddressMissingError(VMAddressError):
@@ -140,7 +140,7 @@ class VMMACAddressMissingError(VMAddressError):
 self.nic_index = nic_index
 
 def __str__(self):
-return No MAC address defined for NIC #%s % self.nic_index
+return No MAC defined for NIC #%s % self.nic_index
 
 
 class VMIPAddressMissingError(VMAddressError):
@@ -149,7 +149,7 @@ class VMIPAddressMissingError(VMAddressError):
 self.mac = mac
 
 def __str__(self):
-return Cannot find IP address for MAC address %s % self.mac
+return No DHCP lease for MAC %s % self.mac
 
 
 class VMAddNetDevError(VMError):
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Virt: virt_utils - Reducing verbosity of the remote login code

2011-12-02 Thread Lucas Meneghel Rodrigues
Make the remote login code only print messages if a debug
flag is turned on. This way we can get rid of many lines that
may clutter debug logs that are only really needed in special
occasions.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_utils.py |   22 ++
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 9672066..2b37f76 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -564,7 +564,7 @@ class SCPTransferFailedError(SCPError):
 (self.status, self.output))
 
 
-def _remote_login(session, username, password, prompt, timeout=10):
+def _remote_login(session, username, password, prompt, timeout=10, 
debug=False):
 
 Log into a remote host (guest) using SSH or Telnet.  Wait for questions
 and provide answers.  If timeout expires while waiting for output from the
@@ -595,12 +595,14 @@ def _remote_login(session, username, password, prompt, 
timeout=10):
  r[Pp]lease wait, r[Ww]arning, prompt],
 timeout=timeout, internal_timeout=0.5)
 if match == 0:  # Are you sure you want to continue connecting
-logging.debug(Got 'Are you sure...', sending 'yes')
+if debug:
+logging.debug(Got 'Are you sure...', sending 'yes')
 session.sendline(yes)
 continue
 elif match == 1:  # password:
 if password_prompt_count == 0:
-logging.debug(Got password prompt, sending '%s', 
password)
+if debug:
+logging.debug(Got password prompt, sending '%s', 
password)
 session.sendline(password)
 password_prompt_count += 1
 continue
@@ -609,7 +611,8 @@ def _remote_login(session, username, password, prompt, 
timeout=10):
text)
 elif match == 2:  # login:
 if login_prompt_count == 0 and password_prompt_count == 0:
-logging.debug(Got username prompt; sending '%s', 
username)
+if debug:
+logging.debug(Got username prompt; sending '%s', 
username)
 session.sendline(username)
 login_prompt_count += 1
 continue
@@ -624,14 +627,17 @@ def _remote_login(session, username, password, prompt, 
timeout=10):
 elif match == 4:  # Connection refused
 raise LoginError(Client said 'connection refused', text)
 elif match == 5:  # Please wait
-logging.debug(Got 'Please wait')
+if debug:
+logging.debug(Got 'Please wait')
 timeout = 30
 continue
 elif match == 6:  # Warning added RSA
-logging.debug(Got 'Warning added RSA to known host list)
+if debug:
+logging.debug(Got 'Warning added RSA to known host list)
 continue
 elif match == 7:  # prompt
-logging.debug(Got shell prompt -- logged in)
+if debug:
+logging.debug(Got shell prompt -- logged in)
 break
 except aexpect.ExpectTimeoutError, e:
 raise LoginTimeoutError(e.output)
@@ -671,7 +677,7 @@ def remote_login(client, host, port, username, password, 
prompt, linesep=\n,
 else:
 raise LoginBadClientError(client)
 
-logging.debug(Trying to login with command '%s', cmd)
+logging.debug(Login command: '%s', cmd)
 session = aexpect.ShellSession(cmd, linesep=linesep, prompt=prompt)
 try:
 _remote_login(session, username, password, prompt, timeout)
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] KVM test: Check guest for kernel crashes during migration

2011-12-02 Thread Lucas Meneghel Rodrigues
It's possible that the guest kernel dies during migration,
this will lead in many time errors like:

Unhandled VMAddressVerificationError: Cannot verify MAC-IP address
mapping using arping: 9a:95:62:c5:0d:c0 --- 192.168.122.68

Since in fact what happened is that the guest died, hence
it's unable to request an IP to the DHCP server.

So put this verification code in 2 places:

1) Right before a round of migration, on the source vm
2) Right after we move the internal state of the source
   vm object to the clone vm object

With this, we should see more meaningful test failures.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_vm.py |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 215687c..6747c2b 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -1451,6 +1451,8 @@ class VM(virt_vm.BaseVM):
 return
 
 wait_for_migration()
+self.verify_kernel_crash()
+self.verify_alive()
 
 # Report migration status
 if mig_succeeded():
@@ -1473,6 +1475,7 @@ class VM(virt_vm.BaseVM):
 error.context(after migration)
 if local:
 time.sleep(1)
+self.verify_kernel_crash()
 self.verify_alive()
 
 if local and stable_check:
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] qemu-io tests: More fine grained control of qemu paths

2011-12-01 Thread Lucas Meneghel Rodrigues
In automated test environments, we often build and test
qemu from arbitrary paths, rather than installing them
on standard PATH directories. Of course, appending directories
to PATH might produce the desired result, but making it
possible to specify arbitrary qemu paths through environment
variables is very convenient and minimally intrusive.

So, make it possible to set qemu paths through env
variables, and also, print the paths of the qemu versions
being tested, for clarity sake.

Lucas Meneghel Rodrigues (2):
  check: print relevant path information
  common.config: Allow use of arbitrary qemu* paths

 check |3 +++
 common.config |   12 +---
 2 files changed, 12 insertions(+), 3 deletions(-)

-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] check: print relevant path information

2011-12-01 Thread Lucas Meneghel Rodrigues
Print the paths of the programs under test
(qemu, qemu-img and qemu-io).

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 check |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/check b/check
index 84ef3e5..8499a04 100755
--- a/check
+++ b/check
@@ -158,6 +158,9 @@ FULL_HOST_DETAILS=`_full_platform_details`
 #FULL_MOUNT_OPTIONS=`_scratch_mount_options`
 
 cat EOF
+QEMU  -- $QEMU
+QEMU_IMG  -- $QEMU_IMG
+QEMU_IO   -- $QEMU_IO
 IMGFMT-- $FULL_IMGFMT_DETAILS
 IMGPROTO  -- $FULL_IMGPROTO_DETAILS
 PLATFORM  -- $FULL_HOST_DETAILS
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] common.config: Allow use of arbitrary qemu* paths

2011-12-01 Thread Lucas Meneghel Rodrigues
Since we might want to test arbitrary qemu, qemu-img and
qemu-io paths, allow users to specify environment variable
values for QEMU_PROG, QEMU_IMG_PROG and QEMU_IO_PROG so
the testsuite will use those values rather than find them
on PATH. Obviously, if such env variables are not set
prior to script execution, normal detection mechanism
takes place.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 common.config |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common.config b/common.config
index d5a72af..d07f435 100644
--- a/common.config
+++ b/common.config
@@ -87,13 +87,19 @@ export BC_PROG=`set_prog_path bc`
 
 export PS_ALL_FLAGS=-ef
 
-export QEMU_PROG=`set_prog_path qemu`
+if [ -z $QEMU_PROG ]; then
+export QEMU_PROG=`set_prog_path qemu`
+fi
 [ $QEMU_PROG =  ]  _fatal qemu not found
 
-export QEMU_IMG_PROG=`set_prog_path qemu-img`
+if [ -z $QEMU_IMG_PROG ]; then
+export QEMU_IMG_PROG=`set_prog_path qemu-img`
+fi
 [ $QEMU_IMG_PROG =  ]  _fatal qemu-img not found
 
-export QEMU_IO_PROG=`set_prog_path qemu-io`
+if [ -z $QEMU_IO_PROG ]; then
+export QEMU_IO_PROG=`set_prog_path qemu-io`
+fi
 [ $QEMU_IO_PROG =  ]  _fatal qemu-io not found
 
 export QEMU=$QEMU_PROG
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] Suport for qemu-iotests from inside KVM autotest

2011-12-01 Thread Lucas Meneghel Rodrigues
Currently, qemu-iotests is implemented outside
the KVM autotest realm. Although convenient if
you want to test the default qemu shipped with
your distro, it's not so convenient to integrate
with the KVM autotest workflow.

In order to take advantage of the fact kvm autotest
tests are already testing a set of paths
[qemu, qemu-img and qemu-io], implement a qemu-iotests
that fetch the latest testsuite from git and run the
available tests, with the appropriate qemu paths.

Lucas Meneghel Rodrigues (2):
  KVM test: Make tests aware of the qemu-io path
  KVM test: Introduce qemu_iotests for the KVM test

 client/tests/kvm/base.cfg.sample   |1 +
 client/tests/kvm/subtests.cfg.sample   |   13 +++
 client/tests/kvm/tests.cfg.sample  |4 ++
 client/tests/kvm/tests/qemu_iotests.py |   62 
 client/virt/kvm_installer.py   |   24 
 5 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/qemu_iotests.py

-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] KVM test: Make tests aware of the qemu-io path

2011-12-01 Thread Lucas Meneghel Rodrigues
As it is important for qemu-iotests that this particular
program is used.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/base.cfg.sample  |1 +
 client/tests/kvm/tests.cfg.sample |4 
 client/virt/kvm_installer.py  |   24 
 3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/base.cfg.sample b/client/tests/kvm/base.cfg.sample
index c99add6..21fa513 100644
--- a/client/tests/kvm/base.cfg.sample
+++ b/client/tests/kvm/base.cfg.sample
@@ -3,6 +3,7 @@
 # Absolute paths and/or names of binaries (default path is /usr/bin)
 qemu_binary = qemu
 qemu_img_binary = qemu-img
+qemu_io_binary = qemu-io
 
 # List of virtual machine object names (whitespace seperated)
 vms = vm1
diff --git a/client/tests/kvm/tests.cfg.sample 
b/client/tests/kvm/tests.cfg.sample
index b011540..bd0d05e 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -60,6 +60,7 @@ variants:
 # We want qemu-kvm for this run
 qemu_binary = /usr/bin/qemu-kvm
 qemu_img_binary = /usr/bin/qemu-img
+qemu_io_binary = /usr/bin/qemu-io
 # Only qcow2 file format
 only qcow2
 # Only rtl8139 for nw card (default on qemu-kvm)
@@ -82,6 +83,7 @@ variants:
 # We want qemu for this run
 qemu_binary = /usr/bin/qemu
 qemu_img_binary = /usr/bin/qemu-img
+qemu_io_binary = /usr/bin/qemu-io
 only qcow2
 # The default nw card for qemu is e1000
 only e1000
@@ -100,6 +102,7 @@ variants:
 # We want qemu-kvm for this run
 qemu_binary = /usr/bin/qemu-kvm
 qemu_img_binary = /usr/bin/qemu-img
+qemu_io_binary = /usr/bin/qemu-io
 only qcow2
 only rtl8139
 only ide
@@ -117,6 +120,7 @@ variants:
 # We want qemu-kvm for this run
 qemu_binary = /usr/bin/qemu-kvm
 qemu_img_binary = /usr/bin/qemu-img
+qemu_io_binary = /usr/bin/qemu-io
 only qcow2
 only rtl8139
 only ide
diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index 6bebd87..2af359d 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -32,6 +32,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 #
 QEMU_BIN = 'qemu'
 QEMU_IMG_BIN = 'qemu-img'
+QEMU_IO_BIN = 'qemu-io'
 
 
 def _kill_qemu_processes(self):
@@ -131,6 +132,23 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 return None
 
 
+def _qemu_io_bin_exists_at_prefix(self):
+'''
+Attempts to find the qemu-io binary at the installation prefix
+
+@return: full path of qemu-io binary or None if not found
+'''
+qemu_io_bin_name = os.path.join(self.install_prefix,
+ 'bin', self.QEMU_IO_BIN)
+if os.path.isfile(qemu_io_bin_name):
+logging.debug('Found qemu-io binary at %s', qemu_io_bin_name)
+return qemu_io_bin_name
+else:
+logging.debug('Could not find qemu-img binary at prefix %s',
+  self.install_prefix)
+return None
+
+
 def _create_symlink_qemu(self):
 
 Create symbolic links for qemu and qemu-img commands on test bindir
@@ -141,6 +159,7 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 
 qemu_dst = os.path.join(self.test_bindir, self.QEMU_BIN)
 qemu_img_dst = os.path.join(self.test_bindir, self.QEMU_IMG_BIN)
+qemu_io_dst = os.path.join(self.test_bindir, self.QEMU_IO_BIN)
 
 qemu_bin = self._qemu_bin_exists_at_prefix()
 if qemu_bin is not None:
@@ -154,6 +173,11 @@ class KVMBaseInstaller(base_installer.BaseInstaller):
 else:
 raise error.TestError('Invalid qemu-img path')
 
+qemu_io_bin = self._qemu_io_bin_exists_at_prefix()
+if qemu_img_bin is not None:
+os.symlink(qemu_io_bin, qemu_io_dst)
+else:
+raise error.TestError('Invalid qemu-img path')
 
 def _install_phase_init(self):
 '''
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] KVM test: Introduce qemu_iotests for the KVM test

2011-12-01 Thread Lucas Meneghel Rodrigues
In order to run always the latest up to date qemu iotests
on all KVM branches, insert qemu-iotests execution inside
KVM autotest. It'll attempt to git fetch the latest contents
of the qemu-iotests test suite, then carry on with tests,
reporting errors to autotest.

Besides having the latest test, with this approach it is
easier to specify to the test suite which paths we want
to get tested, which are under kvm autotest's control.
This patch actually depends on a couple of patches sent
to the qemu_iotest upstream maintainers.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/subtests.cfg.sample   |   13 +++
 client/tests/kvm/tests/qemu_iotests.py |   62 
 2 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/qemu_iotests.py

diff --git a/client/tests/kvm/subtests.cfg.sample 
b/client/tests/kvm/subtests.cfg.sample
index 55f1b21..9b997dd 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -80,6 +80,19 @@ variants:
 extra_params =  --append ks=REPLACE_THIS_WITH_URL_OF_KS
 url = REPLACE_THIS_WITH_TREE_URL
 
+- qemu_iotests:
+type = qemu_iotests
+vms = ''
+profilers = ''
+take_regular_screendumps = no
+qemu_io_uri = 
git://git.kernel.org/pub/scm/linux/kernel/git/hch/qemu-iotests.git
+qemu_io_branch = master
+qemu_io_lbranch = master
+qemu_io_formats = raw qcow qcow2 qed vdi vpc vmdk rdb sheepdog
+#qemu_io_commit =
+#qemu_io_base_uri =
+#qemu_io_extra_options =
+
 - qemu_img:
 type = qemu_img
 vms = ''
diff --git a/client/tests/kvm/tests/qemu_iotests.py 
b/client/tests/kvm/tests/qemu_iotests.py
new file mode 100644
index 000..2b44a42
--- /dev/null
+++ b/client/tests/kvm/tests/qemu_iotests.py
@@ -0,0 +1,62 @@
+import os
+from autotest_lib.client.common_lib import git, error
+from autotest_lib.client.bin import utils
+from autotest_lib.client.virt import virt_utils
+
+
+def run_qemu_iotests(test, params, env):
+
+Fetch from git and run qemu-iotests using the qemu binaries under test.
+
+1) Fetch qemu-io from git
+2) Parse help output to figure out supported file formats
+3) Run test for each file format detected
+4) Report any errors found to autotest
+
+@param test:   KVM test object.
+@param params: Dictionary with the test parameters.
+@param env:Dictionary with test environment.
+
+# First, let's get qemu-io
+std = git://git.kernel.org/pub/scm/linux/kernel/git/hch/qemu-iotests.git
+uri = params.get(qemu_io_uri, std)
+branch = params.get(qemu_io_branch, 'master')
+lbranch = params.get(qemu_io_lbranch, 'master')
+commit = params.get(qemu_io_commit, None)
+base_uri = params.get(qemu_io_base_uri, None)
+destination_dir = os.path.join(test.srcdir, qemu_io_tests)
+git.get_repo(uri=uri, branch=branch, lbranch=lbranch, commit=commit,
+ destination_dir=destination_dir, base_uri=base_uri)
+
+# Then, set the qemu paths for the use of the testsuite
+os.environ[QEMU_PROG] = virt_utils.get_path(test.bindir,
+params.get(qemu_binary, qemu))
+os.environ[QEMU_IMG_PROG] = virt_utils.get_path(test.bindir,
+params.get(qemu_img_binary, qemu-img))
+os.environ[QEMU_IO_PROG] = virt_utils.get_path(test.bindir,
+params.get(qemu_io_binary, qemu-io))
+
+# Parse help output to figure out supported file formats
+os.chdir(destination_dir)
+formats = params.get(qemu_io_image_formats,
+ raw qcow2 qed qcow vdi vpc vmdk rdb sheepdog)
+extra_options = params.get(qemu_io_extra_options, )
+
+formats = formats.split()
+
+# Run test for each file format detected
+err = []
+cmd = './check'
+if extra_options:
+cmd += extra_options
+for f in formats:
+try:
+utils.system(%s -%s % (cmd, f))
+except error.CmdError:
+err.append(format)
+
+# Report all errors found to autotest
+if err:
+err = , .join(err)
+e_msg = Testsuite qemu-io reported errors for formats: %s % err
+raise error.TestFail(e_msg)
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] KVM test: Avoid race condition on boot_savevm

2011-11-30 Thread Lucas Meneghel Rodrigues
As while loops termination conditions are checked at
the beginning of the loop, if we successfuly log onto
the vm on the last cycle, but the timeout happened
to be ended by then, we'd have a test failure.

So, introduce a variable that records whether the
test managed to log onto the VM, and use this variable
as the criteria for PASS/FAIL.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/boot_savevm.py |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/tests/boot_savevm.py 
b/client/tests/kvm/tests/boot_savevm.py
index 91199fb..d02463d 100644
--- a/client/tests/kvm/tests/boot_savevm.py
+++ b/client/tests/kvm/tests/boot_savevm.py
@@ -21,6 +21,7 @@ def run_boot_savevm(test, params, env):
 savevm_login_delay = float(params.get(savevm_login_delay))
 end_time = time.time() + float(params.get(savevm_timeout))
 
+successful_login = False
 while time.time()  end_time:
 time.sleep(savevm_delay)
 try:
@@ -46,10 +47,11 @@ def run_boot_savevm(test, params, env):
 
 try:
 vm.wait_for_login(timeout=savevm_login_delay)
+successful_login = True
 break
 except Exception, detail:
 logging.debug(detail)
 
-if (time.time()  end_time):
+if not successful_login:
 raise error.TestFail(Not possible to log onto the vm after %s s %
  params.get(savevm_timeout))
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] KVM test: boot_savevm: Add more debug and kernel panic detection

2011-11-30 Thread Lucas Meneghel Rodrigues
Print total time elapsed and number of save/load
VM cycles performed during the test. Also, verify whether
a kernel panic happened during the test execution.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/boot_savevm.py |   23 +--
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/client/tests/kvm/tests/boot_savevm.py 
b/client/tests/kvm/tests/boot_savevm.py
index d02463d..d4899de 100644
--- a/client/tests/kvm/tests/boot_savevm.py
+++ b/client/tests/kvm/tests/boot_savevm.py
@@ -19,10 +19,14 @@ def run_boot_savevm(test, params, env):
 vm.verify_alive()
 savevm_delay = float(params.get(savevm_delay))
 savevm_login_delay = float(params.get(savevm_login_delay))
-end_time = time.time() + float(params.get(savevm_timeout))
+savevm_login_timeout = float(params.get(savevm_timeout))
+start_time = time.time()
+
+cycles = 0
 
 successful_login = False
-while time.time()  end_time:
+while (time.time() - start_time)  savevm_login_timeout:
+logging.info(Save/load cycle %d, cycles + 1)
 time.sleep(savevm_delay)
 try:
 vm.monitor.cmd(stop)
@@ -45,13 +49,20 @@ def run_boot_savevm(test, params, env):
 except kvm_monitor.MonitorError, e:
 logging.error(e)
 
+vm.verify_kernel_crash()
+
 try:
 vm.wait_for_login(timeout=savevm_login_delay)
 successful_login = True
 break
-except Exception, detail:
-logging.debug(detail)
+except:
+pass
+
+cycles += 1
 
+time_elapsed = int(time.time() - start_time)
+info = after %s s, %d load/save cycles % (time_elapsed, cycles + 1)
 if not successful_login:
-raise error.TestFail(Not possible to log onto the vm after %s s %
- params.get(savevm_timeout))
+raise error.TestFail(Can't log on '%s' %s % (vm.name, info))
+else:
+logging.info(Test ended %s, info)
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] KVM test: subtests.cfg.sample: Decrease boot_savevm login timeout

2011-11-30 Thread Lucas Meneghel Rodrigues
This way we'll have much more stress by doing more save/load
cycles during boot time. We did see some disk corruption problems
using this value, but the condition is not 100% reproducible.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/subtests.cfg.sample |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/client/tests/kvm/subtests.cfg.sample 
b/client/tests/kvm/subtests.cfg.sample
index 03ddbe2..55f1b21 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -348,7 +348,7 @@ variants:
 - boot_savevm: install setup image_copy unattended_install.cdrom
 type = boot_savevm
 savevm_delay = 0.3
-savevm_login_delay = 120
+savevm_login_delay = 5
 savevm_timeout = 2000
 kill_vm_on_error = yes
 kill_vm_gracefully = yes
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Virt: screendump thread - handle IOErrors on PPM conversion

2011-11-30 Thread Lucas Meneghel Rodrigues
Under some conditions, monitor screendumps can get truncated,
generating IOError exceptions during PIL conversion. So
handle those errors and log a warning rather than failing
the entire screendump thread.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_env_process.py |   14 +++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 3f996ca..ab2f77e 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -511,9 +511,17 @@ def _take_screendumps(test, params, env):
 pass
 else:
 try:
-image = PIL.Image.open(temp_filename)
-image.save(screendump_filename, format=JPEG, 
quality=quality)
-cache[hash] = screendump_filename
+try:
+image = PIL.Image.open(temp_filename)
+image.save(screendump_filename, format=JPEG,
+   quality=quality)
+cache[hash] = screendump_filename
+except IOError, error_detail:
+logging.warning(VM '%s' failed to produce a 
+screendump: %s, vm.name, 
error_detail)
+# Decrement the counter as we in fact failed to
+# produce a converted screendump
+counter[vm] -= 1
 except NameError:
 pass
 os.unlink(temp_filename)
-- 
1.7.7.3

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Virt Test: Add a new test nfs_corrupt v2

2011-11-29 Thread Lucas Meneghel Rodrigues
From: Qingtang Zhou qz...@redhat.com

Subtest nfs_corrupt is used to check the change of
VM status when disk I/O error happen. Only test
Linux platform, write disk by dd command. Setup
NFS service by pre_command and post_command.

Update this case, using 'iptables' command to
filter nfs connection instead of stop nfs service,
because maybe there are some other nfs service
provided on the same host.

Changes from v1:
 * Move test setup to a class, to make better use
of object state, allowing for clearer, less
duplicated code.
 * All the nfs directories are now located
on test.tmpdir.
 * Now test works with Fedora 16 hosts, since
nfs service name has changed on those hosts.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
Signed-off-by: Amos Kong ak...@redhat.com
Signed-off-by: Qingtang Zhou qz...@redhat.com
---
 client/tests/kvm/subtests.cfg.sample |   17 +++
 client/virt/tests/nfs_corrupt.py |  255 ++
 2 files changed, 272 insertions(+), 0 deletions(-)
 create mode 100644 client/virt/tests/nfs_corrupt.py

diff --git a/client/tests/kvm/subtests.cfg.sample 
b/client/tests/kvm/subtests.cfg.sample
index 0b47b88..ac32bdc 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -348,6 +348,23 @@ variants:
 type = stop_continue
 kill_vm_on_error = yes
 
+- nfs_corrupt:
+only Linux
+type = nfs_corrupt
+start_vm = no
+images +=  stg
+image_size_stg = 10G
+image_format_stg = qcow2
+create_image_stg = no
+force_create_image_stg = no
+remove_image_stg = yes
+drive_werror = stop
+drive_cache = none
+kill_vm = yes
+post_command_noncritical = yes
+wait_paused_timeout = 120
+nfs_stat_chk_re = running
+
 - linux_s3: install setup image_copy unattended_install.cdrom
 only Linux
 type = linux_s3
diff --git a/client/virt/tests/nfs_corrupt.py b/client/virt/tests/nfs_corrupt.py
new file mode 100644
index 000..446be31
--- /dev/null
+++ b/client/virt/tests/nfs_corrupt.py
@@ -0,0 +1,255 @@
+import logging, os, re
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.bin import utils, os_dep
+from autotest_lib.client.virt import virt_utils
+from autotest_lib.client.virt import virt_env_process
+
+
+class NFSCorruptConfig(object):
+
+This class sets up nfs_corrupt test environment.
+
+def __init__(self, test, params):
+self.nfs_dir = os.path.join(test.tmpdir, nfs_dir)
+self.mnt_dir = os.path.join(test.tmpdir, mnt_dir)
+self.chk_re = params.get(nfs_stat_chk_re, running)
+
+cmd_list = self._get_service_cmds()
+self.start_cmd = cmd_list[0]
+self.stop_cmd = cmd_list[1]
+self.restart_cmd = cmd_list[2]
+self.status_cmd = cmd_list[3]
+
+@error.context_aware
+def _get_service_cmds(self):
+
+Figure out the commands used to control the NFS service.
+
+error.context(Finding out appropriate commands to handle NFS service)
+service = os_dep.command(service)
+try:
+systemctl = os_dep.command(systemctl)
+except ValueError:
+systemctl = None
+
+if systemctl is not None:
+init_script = /etc/init.d/nfs
+service_file = /lib/systemd/system/nfs-server.service
+if os.path.isfile(init_script):
+service_name = nfs
+elif os.path.isfile(service_file):
+service_name = nfs-server
+else:
+raise error.TestError(Files %s and %s absent, don't know 
+  how to set up NFS for this host %
+  (init_script, service_file))
+start_cmd = %s start %s.service % (systemctl, service_name)
+stop_cmd = %s stop %s.service % (systemctl, service_name)
+restart_cmd = %s restart %s.service % (systemctl, service_name)
+status_cmd = %s status %s.service % (systemctl, service_name)
+else:
+start_cmd = %s nfs start % service
+stop_cmd = %s nfs stop % service
+restart_cmd = %s nfs restart % service
+status_cmd = %s nfs status % service
+
+return [start_cmd, stop_cmd, restart_cmd, status_cmd]
+
+@error.context_aware
+def setup(self, force_start=False):
+
+Setup test NFS share.
+
+@param force_start: Whether to make NFS service start anyway.
+
+error.context(Setting up test NFS share)
+
+for d in [self.nfs_dir, self.mnt_dir]:
+try:
+os.makedirs(d)
+except OSError:
+pass
+
+if force_start:
+self.start_service()
+else:
+if not self.is_service_active():
+self.start_service()
+
+utils.run(exportfs

Guest floppy regression hits qemu-kvm, qemu is not affected

2011-11-18 Thread Lucas Meneghel Rodrigues

Hi guys,

Today during the last 'sanity' qemu-kvm testing, we've noticed a 
recurring problem: guest OS does not see the floppy, making the windows 
installs time out. This problem has been extensively discussed on qemu 
and qemu is fine here, problem is specific with qemu-kvm.


http://comments.gmane.org/gmane.comp.emulators.qemu/123928

So, this is something to go on your radars.

Cheers,

Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] KVM test: Remove monotonic_time.tsc from the list of tests

2011-11-17 Thread Lucas Meneghel Rodrigues
The TSC is unstable on guests, hence there's no guarantee
that this test will pass, it may pass or fail. Therefore,
let's just remove it from the config.

CC: Avi Kivity a...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 .../virt/autotest_control/monotonic_time.control   |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/client/virt/autotest_control/monotonic_time.control 
b/client/virt/autotest_control/monotonic_time.control
index 4dbfec4..a5d8f5f 100644
--- a/client/virt/autotest_control/monotonic_time.control
+++ b/client/virt/autotest_control/monotonic_time.control
@@ -32,6 +32,3 @@ job.run_test('monotonic_time', tag='gtod',  test_type='gtod',
 
 job.run_test('monotonic_time', tag='clock', test_type='clock',
  duration=300, threshold=0)
-
-job.run_test('monotonic_time', tag='tsc',   test_type='tsc',
- duration=300, threshold=0)
-- 
1.7.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4] virt tests: Improvements to trans_hugepage subtest

2011-11-17 Thread Lucas Meneghel Rodrigues
Miscelaneous code cleanups and better logging for the operations
executed during THP test setup.

Lucas Meneghel Rodrigues (4):
  client.virt.tests: trans_hugepage.swapping: cleanups + move common
area
  client.virt.tests: trans_hugepage.defrag - cleanups + move common
area
  client.virt.tests: trans_hugepage.base - cleanups + move common area
  virt.virt_test_setup: Improve logging of the THP test setup

 client/tests/kvm/tests/trans_hugepage.py  |  127 -
 client/tests/kvm/tests/trans_hugepage_defrag.py   |   86 --
 client/tests/kvm/tests/trans_hugepage_swapping.py |  115 ---
 client/virt/tests/trans_hugepage.py   |  127 +
 client/virt/tests/trans_hugepage_defrag.py|   86 ++
 client/virt/tests/trans_hugepage_swapping.py  |  113 ++
 client/virt/virt_test_setup.py|   38 +-
 7 files changed, 357 insertions(+), 335 deletions(-)
 delete mode 100644 client/tests/kvm/tests/trans_hugepage.py
 delete mode 100644 client/tests/kvm/tests/trans_hugepage_defrag.py
 delete mode 100644 client/tests/kvm/tests/trans_hugepage_swapping.py
 create mode 100644 client/virt/tests/trans_hugepage.py
 create mode 100644 client/virt/tests/trans_hugepage_defrag.py
 create mode 100644 client/virt/tests/trans_hugepage_swapping.py

-- 
1.7.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] client.virt.tests: trans_hugepage.swapping: cleanups + move common area

2011-11-17 Thread Lucas Meneghel Rodrigues
1) Remove unused imports
2) Change mistaken raise statement
3) Move it to the common test area

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/trans_hugepage_swapping.py |  115 -
 client/virt/tests/trans_hugepage_swapping.py  |  113 
 2 files changed, 113 insertions(+), 115 deletions(-)
 delete mode 100644 client/tests/kvm/tests/trans_hugepage_swapping.py
 create mode 100644 client/virt/tests/trans_hugepage_swapping.py

diff --git a/client/tests/kvm/tests/trans_hugepage_swapping.py 
b/client/tests/kvm/tests/trans_hugepage_swapping.py
deleted file mode 100644
index 10600b0..000
--- a/client/tests/kvm/tests/trans_hugepage_swapping.py
+++ /dev/null
@@ -1,115 +0,0 @@
-import logging, time, commands, os, string, re
-from autotest_lib.client.common_lib import error
-from autotest_lib.client.bin import utils
-from autotest_lib.client.virt import virt_utils, virt_test_utils
-from autotest_lib.client.virt import virt_test_setup, virt_env_process
-
-
-@error.context_aware
-def run_trans_hugepage_swapping(test, params, env):
-
-KVM khugepage user side test:
-1) Verify that the hugepages can be swapped in/out.
-
-@param test: KVM test object.
-@param params: Dictionary with test parameters.
-@param env: Dictionary with the test environment.
-
-def get_args(args_list):
-
-Get the memory arguments from system
-
-args_list_tmp = args_list.copy()
-for line in file('/proc/meminfo', 'r').readlines():
-for key in args_list_tmp.keys():
-if line.startswith(%s % args_list_tmp[key]):
-args_list_tmp[key] = int(re.split('\s+', line)[1])
-return args_list_tmp
-
-test_config = virt_test_setup.TransparentHugePageConfig(test, params)
-try:
-test_config.setup()
-# Swapping test
-logging.info(Swapping test start)
-# Parameters of memory information
-# @total: Memory size
-# @free: Free memory size
-# @swap_size: Swap size
-# @swap_free: Free swap size
-# @hugepage_size: Page size of one hugepage
-# @page_size: The biggest page size that app can ask for
-args_dict_check = {free : MemFree, swap_size : SwapTotal,
-   swap_free : SwapFree, total : MemTotal,
-   hugepage_size : Hugepagesize,}
-args_dict = get_args(args_dict_check)
-swap_free = []
-total = int(args_dict['total']) / 1024
-free = int(args_dict['free']) / 1024
-swap_size = int(args_dict['swap_size']) / 1024
-swap_free.append(int(args_dict['swap_free'])/1024)
-hugepage_size = int(args_dict['hugepage_size']) / 1024
-dd_timeout = float(params.get(dd_timeout, 900))
-login_timeout = float(params.get(login_timeout, 360))
-check_cmd_timeout = float(params.get(check_cmd_timeout, 900))
-mem_path = os.path.join(test.tmpdir, 'thp_space')
-tmpfs_path = /space
-
-# If swap is enough fill all memory with dd
-if swap_free  (total - free):
-count = total / hugepage_size
-tmpfs_size = total
-else:
-count = free / hugepage_size
-tmpfs_size = free
-
-if swap_size = 0:
-raise logging.info(Host does not have swap enabled)
-session = None
-try:
-if not os.path.isdir(mem_path):
-os.makedirs(mem_path)
-utils.run(mount -t tmpfs  -o size=%sM none %s % (tmpfs_size,
-   mem_path))
-
-# Set the memory size of vm
-# To ignore the oom killer set it to the free swap size
-vm = virt_test_utils.get_living_vm(env, params.get(main_vm))
-if int(params['mem'])  swap_free[0]:
-vm.destroy()
-vm_name = 'vmsw'
-vm0 =  params.get(main_vm)
-vm0_key = virt_utils.env_get_vm(env, vm0)
-params['vms'] = params['vms'] +   + vm_name
-params['mem'] = str(swap_free[0])
-vm_key = vm0_key.clone(vm0, params)
-virt_utils.env_register_vm(env, vm_name, vm_key)
-virt_env_process.preprocess_vm(test, params, env, vm_name)
-vm_key.create()
-session = virt_utils.wait_for(vm_key.remote_login,
-  timeout=login_timeout)
-else:
-session = virt_test_utils.wait_for_login(vm,
-timeout=login_timeout)
-
-error.context(making guest to swap memory)
-cmd = (dd if=/dev/zero of=%s/zero bs=%s00 count=%s %
-   (mem_path, hugepage_size, count))
-utils.run(cmd)
-
-args_dict = get_args

[PATCH 3/4] client.virt.tests: trans_hugepage.base - cleanups + move common area

2011-11-17 Thread Lucas Meneghel Rodrigues
1) Removed unused imports
2) Removed unused variables
3) Moved to the common area

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/trans_hugepage.py |  127 --
 client/virt/tests/trans_hugepage.py  |  127 ++
 2 files changed, 127 insertions(+), 127 deletions(-)
 delete mode 100644 client/tests/kvm/tests/trans_hugepage.py
 create mode 100644 client/virt/tests/trans_hugepage.py

diff --git a/client/tests/kvm/tests/trans_hugepage.py 
b/client/tests/kvm/tests/trans_hugepage.py
deleted file mode 100644
index a533496..000
--- a/client/tests/kvm/tests/trans_hugepage.py
+++ /dev/null
@@ -1,127 +0,0 @@
-import logging, time, commands, os, string, re
-from autotest_lib.client.common_lib import error
-from autotest_lib.client.common_lib import utils
-from autotest_lib.client.virt import virt_test_utils, aexpect, virt_test_setup
-
-
-@error.context_aware
-def run_trans_hugepage(test, params, env):
-
-KVM kernel hugepages user side test:
-1) Smoke test
-2) Stress test
-
-@param test: KVM test object.
-@param params: Dictionary with test parameters.
-@param env: Dictionary with the test environment.
-
-def get_mem_status(params, type):
-if type == host:
-info = utils.system_output(cat /proc/meminfo)
-else:
-info = session.cmd(cat /proc/meminfo)
-for h in re.split(\n+, info):
-if h.startswith(%s % params):
-output = re.split('\s+', h)[1]
-return output
-
-dd_timeout = float(params.get(dd_timeout, 900))
-nr_ah = []
-mem = params['mem']
-failures = []
-
-debugfs_flag = 1
-debugfs_path = os.path.join(test.tmpdir, 'debugfs')
-mem_path = os.path.join(/tmp, 'thp_space')
-
-login_timeout = float(params.get(login_timeout, 3600))
-
-error.context(smoke test setup)
-if not os.path.ismount(debugfs_path):
-if not os.path.isdir(debugfs_path):
-os.makedirs(debugfs_path)
-utils.run(mount -t debugfs none %s % debugfs_path)
-
-test_config = virt_test_setup.TransparentHugePageConfig(test, params)
-vm = virt_test_utils.get_living_vm(env, params.get(main_vm))
-session = virt_test_utils.wait_for_login(vm, timeout=login_timeout)
-
-try:
-# Check khugepage is used by guest
-test_config.setup()
-
-logging.info(Smoke test start)
-error.context(smoke test)
-
-nr_ah_before = get_mem_status('AnonHugePages', 'host')
-if nr_ah_before = 0:
-e_msg = 'smoke: Host is not using THP'
-logging.error(e_msg)
-failures.append(e_msg)
-
-# Protect system from oom killer
-if int(get_mem_status('MemFree', 'guest')) / 1024  mem :
-mem = int(get_mem_status('MemFree', 'guest')) / 1024
-
-session.cmd(mkdir -p %s % mem_path)
-
-session.cmd(mount -t tmpfs -o size=%sM none %s % (str(mem), 
mem_path))
-
-count = mem / 4
-session.cmd(dd if=/dev/zero of=%s/1 bs=400 count=%s %
-(mem_path, count), timeout=dd_timeout)
-
-nr_ah_after = get_mem_status('AnonHugePages', 'host')
-
-if nr_ah_after = nr_ah_before:
-e_msg = ('smoke: Host did not use new THP during dd')
-logging.error(e_msg)
-failures.append(e_msg)
-
-if debugfs_flag == 1:
-if int(open('%s/kvm/largepages' % debugfs_path, 'r').read()) = 0:
-e_msg = 'smoke: KVM is not using THP'
-logging.error(e_msg)
-failures.append(e_msg)
-
-logging.info(Smoke test finished)
-
-# Use parallel dd as stress for memory
-count = count / 3
-logging.info(Stress test start)
-error.context(stress test)
-cmd = rm -rf %s/*; for i in `seq %s`; do dd  % (mem_path, count)
-cmd += if=/dev/zero of=%s/$i bs=400 count=1 done;wait % mem_path
-output = session.cmd_output(cmd, timeout=dd_timeout)
-
-if len(re.findall(No space, output))  count * 0.05:
-e_msg = stress: Too many dd instances failed in guest
-logging.error(e_msg)
-failures.append(e_msg)
-
-try:
-output = session.cmd('pidof dd')
-except Exception:
-output = None
-
-if output is not None:
-for i in re.split('\n+', output):
-session.cmd('kill -9 %s' % i)
-
-session.cmd(umount %s % mem_path)
-
-logging.info(Stress test finished)
-
-finally:
-error.context(all tests cleanup)
-if os.path.ismount(debugfs_path):
-utils.run(umount %s % debugfs_path)
-if os.path.isdir(debugfs_path):
-os.removedirs(debugfs_path)
-session.close()
-test_config.cleanup()
-
-error.context()
-if failures:
-raise error.TestFail(THP base test reported %s failures

[PATCH 4/4] virt.virt_test_setup: Improve logging of the THP test setup

2011-11-17 Thread Lucas Meneghel Rodrigues
Make the utils.run(pgrep khugepaged) silent, also, print
info on what are the config values for THP and what are the
tests executed with khugepaged. This gives a much better
idea of what is going on with the test.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_test_setup.py |   38 +++---
 1 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/client/virt/virt_test_setup.py b/client/virt/virt_test_setup.py
index 334c3cf..30c1c7e 100644
--- a/client/virt/virt_test_setup.py
+++ b/client/virt/virt_test_setup.py
@@ -68,12 +68,15 @@ class TransparentHugePageConfig(object):
 self.file_list_str = []
 # List of files that contain integer config values
 self.file_list_num = []
+logging.info(Scanning THP base path and recording base values)
 for f in os.walk(self.thp_path):
 base_dir = f[0]
 if f[2]:
 for name in f[2]:
 f_dir = os.path.join(base_dir, name)
 parameter = file(f_dir, 'r').read()
+logging.debug(Reading path %s: %s, f_dir,
+  parameter.strip())
 try:
 # Verify if the path in question is writable
 f = open(f_dir, 'w')
@@ -97,7 +100,10 @@ class TransparentHugePageConfig(object):
 Applies test configuration on the host.
 
 if self.test_config:
+logging.info(Applying custom THP test configuration)
 for path in self.test_config.keys():
+logging.info(Writing path %s: %s, path,
+ self.test_config[path])
 file(path, 'w').write(self.test_config[path])
 
 
@@ -121,10 +127,18 @@ class TransparentHugePageConfig(object):
 Check the status of khugepaged when set value to specify file.
 
 for (a, r) in action_list:
-open(file_name, w).write(a)
+logging.info(Writing path %s: %s, expected khugepage rc: %s ,
+ file_name, a, r)
+try:
+file_object = open(file_name, w)
+file_object.write(a)
+file_object.close()
+except IOError, error_detail:
+logging.info(IO Operation on path %s failed: %s,
+ file_name, error_detail)
 time.sleep(5)
 try:
-utils.run('pgrep khugepaged')
+utils.run('pgrep khugepaged', verbose=False)
 if r != 0:
 raise THPKhugepagedError(Khugepaged still alive when
  transparent huge page is 
@@ -134,7 +148,7 @@ class TransparentHugePageConfig(object):
 raise THPKhugepagedError(Khugepaged could not be set 
to
  status %s % a)
 
-
+logging.info(Testing khugepaged)
 for file_path in self.file_list_str:
 action_list = []
 if re.findall(enabled, file_path):
@@ -159,7 +173,10 @@ class TransparentHugePageConfig(object):
 
 for file_path in self.file_list_num:
 action_list = []
-value = int(open(file_path, r).read())
+file_object = open(file_path, r)
+value = file_object.read()
+value = int(value)
+file_object.close()
 if value != 0 and value != 1:
 new_value = random.random()
 action_list.append((str(int(value * new_value)),0))
@@ -184,10 +201,17 @@ class TransparentHugePageConfig(object):
 :
 Restore the host's original configuration after test
 
+logging.info(Restoring host's original THP configuration)
 for path in self.original_config:
-p_file = open(path, 'w')
-p_file.write(str(self.original_config[path]))
-p_file.close()
+logging.info(Writing path %s: %s, path,
+ self.original_config[path])
+try:
+p_file = open(path, 'w')
+p_file.write(str(self.original_config[path]))
+p_file.close()
+except IOError, error_detail:
+logging.info(IO operation failed on file %s: %s, path,
+ error_detail)
 
 
 class HugePageConfig(object):
-- 
1.7.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] client.virt.tests: trans_hugepage.defrag - cleanups + move common area

2011-11-17 Thread Lucas Meneghel Rodrigues
1) Removed unused imports
2) Trimmed down error message
3) Moved to the common area

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/tests/trans_hugepage_defrag.py |   86 ---
 client/virt/tests/trans_hugepage_defrag.py  |   86 +++
 2 files changed, 86 insertions(+), 86 deletions(-)
 delete mode 100644 client/tests/kvm/tests/trans_hugepage_defrag.py
 create mode 100644 client/virt/tests/trans_hugepage_defrag.py

diff --git a/client/tests/kvm/tests/trans_hugepage_defrag.py 
b/client/tests/kvm/tests/trans_hugepage_defrag.py
deleted file mode 100644
index bf81362..000
--- a/client/tests/kvm/tests/trans_hugepage_defrag.py
+++ /dev/null
@@ -1,86 +0,0 @@
-import logging, time, commands, os, string, re
-from autotest_lib.client.common_lib import error
-from autotest_lib.client.bin import utils
-from autotest_lib.client.virt import virt_test_utils, virt_test_setup
-
-
-@error.context_aware
-def run_trans_hugepage_defrag(test, params, env):
-
-KVM khugepage userspace side test:
-1) Verify that the host supports kernel hugepages.
-If it does proceed with the test.
-2) Verify that the kernel hugepages can be used in host.
-3) Verify that the kernel hugepages can be used in guest.
-4) Migrate guest while using hugepages.
-
-@param test: KVM test object.
-@param params: Dictionary with test parameters.
-@param env: Dictionary with the test environment.
-
-def get_mem_status(params):
-for line in file('/proc/meminfo', 'r').readlines():
-if line.startswith(%s % params):
-output = re.split('\s+', line)[1]
-return output
-
-
-def set_libhugetlbfs(number):
-f = file(/proc/sys/vm/nr_hugepages, w+)
-f.write(number)
-f.seek(0)
-ret = f.read()
-return int(ret)
-
-test_config = virt_test_setup.TransparentHugePageConfig(test, params)
-# Test the defrag
-logging.info(Defrag test start)
-login_timeout = float(params.get(login_timeout, 360))
-vm = virt_test_utils.get_living_vm(env, params.get(main_vm))
-session = virt_test_utils.wait_for_login(vm, timeout=login_timeout)
-mem_path = os.path.join(/tmp, thp_space)
-
-try:
-test_config.setup()
-error.context(Fragmenting guest memory)
-try:
-if not os.path.isdir(mem_path):
-os.makedirs(mem_path)
-if os.system(mount -t tmpfs none %s % mem_path):
-raise error.TestError(Can not mount tmpfs)
-
-# Try to fragment the memory a bit
-cmd = (for i in `seq 262144`; do dd if=/dev/urandom of=%s/$i 
-   bs=4K count=1  done % mem_path)
-utils.run(cmd)
-finally:
-utils.run(umount %s % mem_path)
-
-total = int(get_mem_status('MemTotal'))
-hugepagesize = int(get_mem_status('Hugepagesize'))
-nr_full = str(total / hugepagesize)
-
-error.context(activating khugepaged defrag functionality)
-# Allocate hugepages for libhugetlbfs before and after enable defrag,
-# and check out the difference.
-nr_hp_before = set_libhugetlbfs(nr_full)
-try:
-defrag_path = os.path.join(test_config.thp_path, 'khugepaged',
-   'defrag')
-file(str(defrag_path), 'w').write('yes')
-except IOError, e:
-raise error.TestFail(Can not start defrag on khugepaged: %s % e)
-# TODO: Is sitting an arbitrary amount of time appropriate? Aren't 
there
-# better ways to do this?
-time.sleep(1)
-nr_hp_after = set_libhugetlbfs(nr_full)
-
-if nr_hp_before = nr_hp_after:
-raise error.TestFail(There was no memory defragmentation on host: 

- %s huge pages allocated before turning 
- khugepaged defrag on, %s allocated after it 
%
- (nr_hp_before, nr_hp_after))
-logging.info(Defrag test succeeded)
-session.close()
-finally:
-test_config.cleanup()
diff --git a/client/virt/tests/trans_hugepage_defrag.py 
b/client/virt/tests/trans_hugepage_defrag.py
new file mode 100644
index 000..b8bc1b0
--- /dev/null
+++ b/client/virt/tests/trans_hugepage_defrag.py
@@ -0,0 +1,86 @@
+import logging, time, os, re
+from autotest_lib.client.common_lib import error
+from autotest_lib.client.bin import utils
+from autotest_lib.client.virt import virt_test_utils, virt_test_setup
+
+
+@error.context_aware
+def run_trans_hugepage_defrag(test, params, env):
+
+KVM khugepage userspace side test:
+1) Verify that the host supports kernel hugepages.
+If it does proceed with the test.
+2) Verify that the kernel hugepages can be used in host.
+3) Verify that the kernel hugepages can be used in guest.
+4) Migrate guest while using hugepages

[PATCH] Virt: Add Fedora 16 to the list of guests

2011-11-10 Thread Lucas Meneghel Rodrigues
Also, make it the default for virt tests.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/guest-os.cfg.sample |   27 +++
 client/tests/kvm/tests.cfg.sample|   10 
 client/virt/unattended/Fedora-16.ks  |   39 ++
 client/virt/virt_utils.py|6 ++--
 4 files changed, 74 insertions(+), 8 deletions(-)
 create mode 100644 client/virt/unattended/Fedora-16.ks

diff --git a/client/tests/kvm/guest-os.cfg.sample 
b/client/tests/kvm/guest-os.cfg.sample
index 1e19c52..cd9427e 100644
--- a/client/tests/kvm/guest-os.cfg.sample
+++ b/client/tests/kvm/guest-os.cfg.sample
@@ -328,6 +328,33 @@ variants:
 md5sum_cd1 = c122a2a4f478da4a3d2d12396e84244e
 md5sum_1m_cd1 = c02f37e293bbc85be02a7c850a61273a
 
+- 16.32:
+image_name = f16-32
+unattended_install:
+unattended_file = unattended/Fedora-16.ks
+#floppy = images/f16-32/ks.vfd
+cdrom_unattended = images/f16-32/ks.iso
+kernel = images/f16-32/vmlinuz
+initrd = images/f16-32/initrd.img
+unattended_install.cdrom:
+cdrom_cd1 = isos/linux/Fedora-16-i386-DVD.iso
+md5sum_cd1 = 0d64ab6b1b800827a9c83d95395b3da0
+md5sum_1m_cd1 = 3f616b5034980cadeefe67dbca79cf99
+
+- 16.64:
+image_name = f16-64
+unattended_install:
+unattended_file = unattended/Fedora-16.ks
+#floppy = images/f16-64/ks.vfd
+cdrom_unattended = images/f16-64/ks.iso
+kernel = images/f16-64/vmlinuz
+initrd = images/f16-64/initrd.img
+unattended_install.cdrom:
+cdrom_cd1 = isos/linux/Fedora-16-x86_64-DVD.iso
+md5sum_cd1 = bb38ea1fe4b2fc69e7a6e15cf1c69c91
+md5sum_1m_cd1 = e25ea147176f24239d38a46f501bd25e
+
+
 - RHEL:
 no setup
 shell_prompt = ^\[.*\][\#\$]\s*$
diff --git a/client/tests/kvm/tests.cfg.sample 
b/client/tests/kvm/tests.cfg.sample
index a30158b..4b217ee 100644
--- a/client/tests/kvm/tests.cfg.sample
+++ b/client/tests/kvm/tests.cfg.sample
@@ -78,7 +78,7 @@ variants:
 only unattended_install.cdrom, boot, shutdown
 
 # Runs qemu, f15 64 bit guest OS, install, boot, shutdown
-- @qemu_f15_quick:
+- @qemu_f16_quick:
 # We want qemu for this run
 qemu_binary = /usr/bin/qemu
 qemu_img_binary = /usr/bin/qemu-img
@@ -90,13 +90,13 @@ variants:
 only up
 only no_pci_assignable
 only smallpages
-only Fedora.15.64
+only Fedora.16.64
 only unattended_install.cdrom, boot, shutdown
 # qemu needs -enable-kvm on the cmdline
 extra_params += ' -enable-kvm'
 
 # Runs qemu-kvm, f15 64 bit guest OS, install, boot, shutdown
-- @qemu_kvm_f15_quick:
+- @qemu_kvm_f16_quick:
 # We want qemu-kvm for this run
 qemu_binary = /usr/bin/qemu-kvm
 qemu_img_binary = /usr/bin/qemu-img
@@ -106,7 +106,7 @@ variants:
 only smp2
 only no_pci_assignable
 only smallpages
-only Fedora.15.64
+only Fedora.16.64
 only unattended_install.cdrom, boot, shutdown
 
 # Runs your own guest image (qcow2, can be adjusted), all migration tests
@@ -140,4 +140,4 @@ variants:
 #kill_unresponsive_vms.* ?= no
 
 # Choose your test list from the testsets defined
-only qemu_kvm_f15_quick
+only qemu_kvm_f16_quick
diff --git a/client/virt/unattended/Fedora-16.ks 
b/client/virt/unattended/Fedora-16.ks
new file mode 100644
index 000..eb52c1f
--- /dev/null
+++ b/client/virt/unattended/Fedora-16.ks
@@ -0,0 +1,39 @@
+install
+KVM_TEST_MEDIUM
+text
+reboot
+lang en_US
+keyboard us
+network --bootproto dhcp
+rootpw 123456
+firewall --enabled --ssh
+selinux --enforcing
+timezone --utc America/New_York
+firstboot --disable
+bootloader --location=mbr --append=console=tty0 console=ttyS0,115200
+zerombr
+poweroff
+
+clearpart --all --initlabel
+autopart
+
+%packages
+@base
+@development-libs
+@development-tools
+%end
+
+%post --interpreter /usr/bin/python
+import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
+os.system('dhclient')
+os.system('chkconfig sshd on')
+os.system('iptables -F')
+os.system('echo 0  /selinux/enforce')
+server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+server.bind(('', 12323))
+server.listen(1)
+(client, addr) = server.accept()
+client.send(done)
+client.close()
+%end
diff --git

qemu and qemu.git - Migration + disk stress introduces qcow2 corruptions

2011-11-09 Thread Lucas Meneghel Rodrigues
Hi guys, here I am, reporting yet another issue with qemu. This time, 
it's something that was first reported in January, and Juan proposed a 
patch for it:


http://comments.gmane.org/gmane.comp.emulators.qemu/89009

[PATCH 4/5] Reopen files after migration

The symptom is, when running disk stress or any intense IO operation in 
guest while migrating it causes a qcow2 corruption. We've seen this 
consistently on the daily test jobs, both for qemu and qemu-kvm. The 
test that triggers it is autotest stress test running on a VM with 
ping-pong background migration.


The fix proposed by Juan is on our RHEL branch and such a problem does 
not happen on the RHEL branch. So, what about re-considering Juan's 
patch, or maybe work out a solution that is satisfactory for the 
upstream maintainers?


I'll open a launchpad bug with this report.

Thanks,

Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu and qemu.git - Migration + disk stress introduces qcow2 corruptions

2011-11-09 Thread Lucas Meneghel Rodrigues

On 11/09/2011 05:25 PM, Juan Quintela wrote:

Lucas Meneghel Rodriguesl...@redhat.com  wrote:

Hi guys, here I am, reporting yet another issue with qemu. This time,
it's something that was first reported in January, and Juan proposed a
patch for it:

http://comments.gmane.org/gmane.comp.emulators.qemu/89009

[PATCH 4/5] Reopen files after migration

The symptom is, when running disk stress or any intense IO operation
in guest while migrating it causes a qcow2 corruption. We've seen this
consistently on the daily test jobs, both for qemu and qemu-kvm. The
test that triggers it is autotest stress test running on a VM with
ping-pong background migration.

The fix proposed by Juan is on our RHEL branch and such a problem does
not happen on the RHEL branch. So, what about re-considering Juan's
patch, or maybe work out a solution that is satisfactory for the
upstream maintainers?

I'll open a launchpad bug with this report.


I have just sent:

[RFC PATCH 0/2] Fix migration with NFS  iscsi/Fiber channel

Only the 1st patch on that series are needed to fix that problem.  Could
you try it?


Just tried it, it conclusively fixes the corruption problems. Reported 
it on the patch email.



Thanks, Juan.


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] common_lib.cartesian_config: Turn missing includes into fatal errors

2011-11-08 Thread Lucas Meneghel Rodrigues
There's no point in including a file not necessary on a
cartesian config file, so it's more likely that the file
missing is actually a harmful problem.

So turn the missing file into a MissingIncludeError and
throw it.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/common_lib/cartesian_config.py |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/client/common_lib/cartesian_config.py 
b/client/common_lib/cartesian_config.py
index ac04c24..62bc925 100755
--- a/client/common_lib/cartesian_config.py
+++ b/client/common_lib/cartesian_config.py
@@ -28,7 +28,7 @@ Cartesian configuration format file parser.
 @copyright: Red Hat 2008-2011
 
 
-import re, os, sys, optparse, collections
+import re, os, optparse, collections
 
 class ParserError:
 def __init__(self, msg, line=None, filename=None, linenum=None):
@@ -45,6 +45,17 @@ class ParserError:
 return %s (%s:%s) % (self.msg, self.filename, self.linenum)
 
 
+class MissingIncludeError:
+def __init__(self, line, filename, linenum):
+self.line = line
+self.filename = filename
+self.linenum = linenum
+
+def __str__(self):
+return (%r (%s:%s): file does not exist or it's not a regular 
+file % (self.line, self.filename, self.linenum))
+
+
 num_failed_cases = 5
 
 
@@ -462,8 +473,7 @@ class Parser(object):
 filename = os.path.join(os.path.dirname(cr.filename),
 filename)
 if not os.path.isfile(filename):
-self._warn(%r (%s:%s): file doesn't exist or is not a 
-   regular file, line, cr.filename, linenum)
+raise MissingIncludeError(line, cr.filename, linenum)
 continue
 node = self._parse(FileReader(filename), node)
 continue
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] qemu-kvm crashes doing migration with disks + blkdebug files (does not happen with qemu)

2011-11-07 Thread Lucas Meneghel Rodrigues

On 11/07/2011 07:29 AM, Kevin Wolf wrote:

Am 05.11.2011 03:16, schrieb Lucas Meneghel Rodrigues:

Hi folks,

qemu-kvm is segfaulting when executing migration with blkdebug files.

19:50:02 DEBUG| Git repo qemu_kvm uri: git://github.com/avikivity/qemu.git
19:50:02 DEBUG| Git repo qemu_kvm branch: master
19:50:30 INFO | Commit hash for qemu_kvm is
7879db7e9c09b92d9af1c143fbe2cc212ec89e4b (no tag found)

How to reproduce:

1) create a origin vm like:

/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std
-monitor
unix:'/tmp/monitor-humanmonitor1-2004-200902-95j0',server,nowait
-qmp unix:'/tmp/monitor-qmpmonitor1-2004-200902-95j0',server,nowait
-serial unix:'/tmp/serial-2004-200902-95j0',server,nowait -drive
file=blkdebug:/usr/local/autotest/virt/blkdebug/default.conf:/tmp/kvm_autotest_root/images/rhel6.1-64.qcow2,index=0,if=virtio,cache=none,rerror=stop,werror=stop
-device
virtio-net-pci,netdev=idtzhBVb,mac='9a:d0:7b:07:18:72',id='id9JW3ZV'
-netdev tap,id=idtzhBVb,fd=23 -m 2048 -smp 2 -vnc :0


2) create a destination vm like:

/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std
-monitor
unix:'/tmp/monitor-humanmonitor1-2004-201329-Ia9o',server,nowait
-qmp unix:'/tmp/monitor-qmpmonitor1-2004-201329-Ia9o',server,nowait
-serial unix:'/tmp/serial-2004-201329-Ia9o',server,nowait -drive
file=blkdebug:/usr/local/autotest/virt/blkdebug/default.conf:/tmp/kvm_autotest_root/images/rhel6.1-64.qcow2,index=0,if=virtio,cache=none,rerror=stop,werror=stop
-device
virtio-net-pci,netdev=idup1xAf,mac='9a:d0:7b:07:18:72',id='idyvOQf3'
-netdev tap,id=idup1xAf,fd=19 -m 2048 -smp 2 -vnc :1  -S -incoming
exec:nc -l 5200

Note that blkdebug file contains:

[inject-error]
state = 2
event = read_aio
errno = 7
immediately = off
once = on

[set-state]
state = 1
event = read_aio
new_state = 2

[set-state]
state = 2
event = read_aio
new_state = 3

Start the migration (on this example, using exec, but it reproduces with
tcp and unix sockets):

11/04 20:13:30 DEBUG|kvm_monito:0254| (monitor humanmonitor1) Sending
command 'migrate -d exec:nc localhost 5200'

Then you will have:

11/04 20:13:33 INFO |   aexpect:0783| [qemu output] invalid runstate
transition


Invalid runstate transition is something for Luiz (CCed). Though
probably he doesn't need to do anything in this case: I think we're not
allowing the transition from I/O error to migrating. This might be fixed
by 8a9236f1 in qemu.git, so please retest with upstream.


In the end of my original message, I stated the same test does not yield 
a segfault in qemu.git, so the referred commit indeed fixes the issue.


Thanks!
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] Improve KVM autotest error reporting

2011-11-07 Thread Lucas Meneghel Rodrigues
This patchset adds some very welcome features:
 * Make it possible to fail some tests due to guest screen
   inactivity (unattended_install, mainly)
 * Make monitor errors to not mask qemu segmentation fault
   errors
 * Introduce a mechanism to communicate errors that happen
   on a background thread to the main test thread.

It was also sent as:

https://github.com/autotest/autotest/pull/62

Lucas Meneghel Rodrigues (5):
  virt.kvm_vm: Introduce background error queue
  virt.virt_env_process: fail tests due to guest screen inactivity
  virt tests: Introduce inactivity watcher for unattended_install
  virt.kvm_vm: Introduce vm.verify_userspace_crash()
  KVM test: Verify qemu process before throwing monitor exceptions

 client/tests/kvm/base.cfg.sample|6 
 client/tests/kvm/subtests.cfg.sample|2 +
 client/virt/kvm_monitor.py  |   24 +-
 client/virt/kvm_vm.py   |   28 +++---
 client/virt/libvirt_vm.py   |7 +
 client/virt/tests/unattended_install.py |2 +
 client/virt/virt_env_process.py |   39 +++
 client/virt/virt_test.py|   19 ++-
 8 files changed, 115 insertions(+), 12 deletions(-)

-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] virt.kvm_vm: Introduce background error queue

2011-11-07 Thread Lucas Meneghel Rodrigues
Introduce a background error queue to store exceptions
happened during virt background tasks (such as aexpect
instances and screendump thread). With this queue,
it is possible to store exception information useful
to fail tests at certain points. Examples:

* We can detect qemu suffered a crash from inside the
  aexpect thread
* We can detect screen inactivity on the screendump
  thread and fail the unattended install test without
  having to wait the entire timeout of the test

The next patches will introduce that functionality.

Implementation consists in a virt test attribute,
background_error test, that is a Queue.Queue()
(thread safe), background threads that want to
make use of it need to catch the exception they
want to propagate and store it in the queue
using put(sys.exc_info).

Then in every convenient situation to do so, subtests
can call the test.verify_bg_errors() method
(in the beginning or end of each test loop, where
operations such as migrations are executed).

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/virt_test.py |   19 ++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/client/virt/virt_test.py b/client/virt/virt_test.py
index e18081b..0ce43c4 100644
--- a/client/virt/virt_test.py
+++ b/client/virt/virt_test.py
@@ -1,4 +1,4 @@
-import os, sys, logging, imp
+import os, sys, logging, imp, Queue
 
 from autotest_lib.client.bin import test
 from autotest_lib.client.common_lib import error
@@ -22,6 +22,22 @@ class virt_test(test.test):
 if params.get(preserve_srcdir, yes) == yes:
 self.preserve_srcdir = True
 self.virtdir = os.path.dirname(sys.modules[__name__].__file__)
+# Queue to store exceptions that happen in bg threads
+self.background_errors = Queue.Queue()
+
+
+def verify_background_errors(self):
+
+Verify if there are any errors that happened on background threads.
+
+@raise Exception: Any exception stored on the background_errors queue.
+
+try:
+exc = self.background_errors.get(block=False)
+except Queue.Empty:
+pass
+else:
+raise exc[1], None, exc[2]
 
 
 def run_once(self, params):
@@ -86,6 +102,7 @@ class virt_test(test.test):
 run_func = getattr(test_module, run_%s % t_type)
 try:
 run_func(self, params, env)
+self.verify_background_errors()
 finally:
 env.save()
 test_passed = True
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] virt.virt_env_process: fail tests due to guest screen inactivity

2011-11-07 Thread Lucas Meneghel Rodrigues
In a very specific test (unattended_install), all OEM installer
mechanism will present intense guest screen activity, so screen
inactivity for a relatively long time almost always mean something
went very wrong and the installer is stuck.

So create a mechanism to detect screen inactivity for any vm that
takes place in the test - have a timer for each vm that is reset
only if the next screenshot is different than the previous. So,
if the vm got stuck somewhere at the install process, for example:

* Wrong Windows CD Key
* Guest OS does not see a disk controller due to lack of drivers
* BIOS got stuck

And other similar cases, we'll have a test failure before the full
test timeout (that for Windows may be up to 3 hours). So we save
time and know about such situations earlier.

The patch introduces the parameters on base.cfg, subtests.cfg, and
also introduces a sensible default for inactivity treshold (30 min).

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/unattended_install.py |1 +
 client/virt/virt_env_process.py |   39 +++
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/client/virt/tests/unattended_install.py 
b/client/virt/tests/unattended_install.py
index a78e2bc..57161a8 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -800,6 +800,7 @@ def run_unattended_install(test, params, env):
 else:
 raise e
 vm.verify_kernel_crash()
+test.verify_background_errors()
 if params.get(wait_no_ack, no) == no:
 client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 try:
diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index 27a60d3..5f33606 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -1,4 +1,4 @@
-import os, time, commands, re, logging, glob, threading, shutil
+import os, time, commands, re, logging, glob, threading, shutil, sys
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
 import aexpect, virt_utils, kvm_monitor, ppm_utils, virt_test_setup
@@ -16,6 +16,18 @@ _screendump_thread = None
 _screendump_thread_termination_event = None
 
 
+class VMScreenInactiveError(virt_vm.VMError):
+def __init__(self, vm, inactive_time):
+virt_vm.VMError.__init__(self)
+self.vm = vm
+self.inactive_time = inactive_time
+
+def __str__(self):
+msg = (%s screen is inactive for %d s (%d min) %
+   (self.vm.name, self.inactive_time, self.inactive_time/60))
+return msg
+
+
 def ffmpeg_path():
 try:
 return virt_utils.find_command(ffmpeg)
@@ -491,14 +503,19 @@ def _take_screendumps(test, params, env):
  virt_utils.generate_random_string(6))
 delay = float(params.get(screendump_delay, 5))
 quality = int(params.get(screendump_quality, 30))
+inactivity_treshold = float(params.get(inactivity_treshold, 1800))
+inactivity_watcher = params.get(inactivity_watcher, log)
 
 cache = {}
 counter = {}
+inactivity = {}
 
 while True:
 for vm in env.get_all_vms():
 if vm not in counter.keys():
 counter[vm] = 0
+if vm not in inactivity.keys():
+inactivity[vm] = time.time()
 if not vm.is_alive():
 continue
 try:
@@ -524,17 +541,29 @@ def _take_screendumps(test, params, env):
 counter[vm] += 1
 screendump_filename = os.path.join(screendump_dir, %04d.jpg %
counter[vm])
-hash = utils.hash_file(temp_filename)
-if hash in cache:
+image_hash = utils.hash_file(temp_filename)
+if image_hash in cache:
+time_inactive = time.time() - inactivity[vm]
+if time_inactive  inactivity_treshold:
+if inactivity_watcher == error:
+try:
+raise VMScreenInactiveError(vm, time_inactive)
+except VMScreenInactiveError:
+test.background_errors.put(sys.exc_info())
+else:
+logging.debug(%s screen is inactive for more than 
+  %d s (%d min), vm.name, time_inactive,
+  time_inactive/60)
 try:
-os.link(cache[hash], screendump_filename)
+os.link(cache[image_hash], screendump_filename)
 except OSError:
 pass
 else:
+inactivity[vm] = time.time()
 try:
 image = PIL.Image.open(temp_filename)
 image.save(screendump_filename, format=JPEG, 
quality=quality

[PATCH 3/5] virt tests: Introduce inactivity watcher for unattended_install

2011-11-07 Thread Lucas Meneghel Rodrigues
With this patch, if the screen got inactive during unattended
install for more than 30 minutes, an error will be thrown. For
any other tests, we'll just log a debug message, since in other
tests we do not expect to see much action going on the screen.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/base.cfg.sample |6 ++
 client/tests/kvm/subtests.cfg.sample |2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/base.cfg.sample b/client/tests/kvm/base.cfg.sample
index 1bda496..48a4539 100644
--- a/client/tests/kvm/base.cfg.sample
+++ b/client/tests/kvm/base.cfg.sample
@@ -111,3 +111,9 @@ login_timeout = 360
 
 # NFS directory of guest images
 images_good = fileserver.foo.com:/autotest/images_good
+
+# Guest screen max inactive time until taking actions (log or throw errors)
+inactivity_treshold = 1800
+
+# Default action if inactivity threshold is reached
+inactivity_watcher = log
diff --git a/client/tests/kvm/subtests.cfg.sample 
b/client/tests/kvm/subtests.cfg.sample
index dc07416..8625b2c 100644
--- a/client/tests/kvm/subtests.cfg.sample
+++ b/client/tests/kvm/subtests.cfg.sample
@@ -50,6 +50,8 @@ variants:
 guest_port_unattended_install = 12323
 kernel = vmlinuz
 initrd = initrd.img
+# Throw errors if guest screen is inactive
+inactivity_watcher = error
 # Set migrate_background to yes to run migration in parallel
 migrate_background = no
 # Backup image settings
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] KVM test: Verify qemu process before throwing monitor exceptions

2011-11-07 Thread Lucas Meneghel Rodrigues
When qemu suffers a segmentation fault, monitor code might still
want to issue commands to a VM, masking the segmentation fault.

So, pass the vm object to the monitor code, and before throwing
monitor exceptions, verify the state of the qemu process (whether
it crashed or not), and throw the QemuSegFaultError if the process
crashed:

22:08:44 DEBUG| QemuSegFaultError: Qemu crashed: /bin/sh: line 1:  6847
Aborted (core dumped)

This will make analyzing such failures much easier.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_monitor.py |   24 ++--
 client/virt/kvm_vm.py  |   10 ++
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index efd6aa3..049c28f 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -77,6 +77,7 @@ class Monitor:
 try:
 self._socket.connect(filename)
 except socket.error:
+self.vm.verify_userspace_crash()
 raise MonitorConnectError(Could not connect to monitor socket)
 
 
@@ -124,6 +125,7 @@ class Monitor:
 try:
 return bool(select.select([self._socket], [], [], timeout)[0])
 except socket.error, e:
+self.vm.verify_userspace_crash()
 raise MonitorSocketError(Verifying data on monitor socket, e)
 
 
@@ -133,6 +135,7 @@ class Monitor:
 try:
 data = self._socket.recv(1024)
 except socket.error, e:
+self.vm.verify_userspace_crash()
 raise MonitorSocketError(Could not receive data from monitor,
  e)
 if not data:
@@ -157,7 +160,7 @@ class HumanMonitor(Monitor):
 Wraps human monitor commands.
 
 
-def __init__(self, name, filename, suppress_exceptions=False):
+def __init__(self, name, filename, vm, suppress_exceptions=False):
 
 Connect to the monitor socket and find the (qemu) prompt.
 
@@ -174,10 +177,12 @@ class HumanMonitor(Monitor):
 Monitor.__init__(self, name, filename)
 
 self.protocol = human
+self.vm = vm
 
 # Find the initial (qemu) prompt
 s, o = self._read_up_to_qemu_prompt(20)
 if not s:
+self.vm.verify_userspace_crash()
 raise MonitorProtocolError(Could not find (qemu) prompt 
after connecting to monitor. 
Output so far: %r % o)
@@ -190,6 +195,7 @@ class HumanMonitor(Monitor):
 if suppress_exceptions:
 logging.warn(e)
 else:
+self.vm.verify_userspace_crash()
 raise
 
 
@@ -220,6 +226,7 @@ class HumanMonitor(Monitor):
 @raise MonitorSocketError: Raised if a socket error occurs
 
 if not self._acquire_lock(20):
+self.vm.verify_userspace_crash()
 raise MonitorLockError(Could not acquire exclusive lock to send 
monitor command '%s' % cmd)
 
@@ -227,6 +234,7 @@ class HumanMonitor(Monitor):
 try:
 self._socket.sendall(cmd + \n)
 except socket.error, e:
+self.vm.verify_userspace_crash()
 raise MonitorSocketError(Could not send monitor command %r %
  cmd, e)
 
@@ -253,6 +261,7 @@ class HumanMonitor(Monitor):
 logging.debug((monitor %s) Sending command '%s',
   self.name, command)
 if not self._acquire_lock(20):
+self.vm.verify_userspace_crash()
 raise MonitorLockError(Could not acquire exclusive lock to send 
monitor command '%s' % command)
 
@@ -283,6 +292,7 @@ class HumanMonitor(Monitor):
 else:
 msg = (Could not find (qemu) prompt after command '%s'. 
Output so far: %r % (command, o))
+self.vm.verify_userspace_crash()
 raise MonitorProtocolError(msg)
 
 finally:
@@ -464,7 +474,7 @@ class QMPMonitor(Monitor):
 Wraps QMP monitor commands.
 
 
-def __init__(self, name, filename, suppress_exceptions=False):
+def __init__(self, name, filename, vm, suppress_exceptions=False):
 
 Connect to the monitor socket, read the greeting message and issue the
 qmp_capabilities command.  Also make sure the json module is available.
@@ -486,6 +496,7 @@ class QMPMonitor(Monitor):
 self.protocol = qmp
 self._greeting = None
 self._events = []
+self.vm = vm
 
 # Make sure json is available
 try:
@@ -505,6 +516,7 @@ class QMPMonitor(Monitor):
 break
 time.sleep(0.1)
 else

[PATCH 4/5] virt.kvm_vm: Introduce vm.verify_userspace_crash()

2011-11-07 Thread Lucas Meneghel Rodrigues
In order to capture any qemu crashes, introduce a method
that scans qemu output and throws an error if a core dump
condition is found.

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/kvm_vm.py   |   18 ++
 client/virt/libvirt_vm.py   |7 +++
 client/virt/tests/unattended_install.py |1 +
 3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 4a29721..372cfbc 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -10,6 +10,15 @@ from autotest_lib.client.bin import utils
 import virt_utils, virt_vm, virt_test_setup, kvm_monitor, aexpect
 
 
+class QemuSegFaultError(virt_vm.VMError):
+def __init__(self, crash_message):
+virt_vm.VMError.__init__(self, crash_message)
+self.crash_message = crash_message
+
+def __str__(self):
+return (Qemu crashed: %s % self.crash_message)
+
+
 class VM(virt_vm.BaseVM):
 
 This class handles all basic VM operations.
@@ -96,6 +105,15 @@ class VM(virt_vm.BaseVM):
 raise virt_vm.VMStatusError(VM status is unexpected)
 
 
+def verify_userspace_crash(self):
+
+Verify if the userspace component (qemu) crashed.
+
+for line in self.process.get_output().splitlines():
+if (core dumped) in line:
+raise QemuSegFaultError(line)
+
+
 def clone(self, name=None, params=None, root_dir=None, address_cache=None,
   copy_state=False):
 
diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 0c32551..760ccef 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -324,6 +324,13 @@ class VM(virt_vm.BaseVM):
 return virsh_is_dead(self.name)
 
 
+def verify_userspace_crash(self):
+
+Doesn't do anything yet.
+
+pass
+
+
 def clone(self, name=None, params=None, root_dir=None, address_cache=None,
   copy_state=False):
 
diff --git a/client/virt/tests/unattended_install.py 
b/client/virt/tests/unattended_install.py
index 57161a8..bc5f29f 100644
--- a/client/virt/tests/unattended_install.py
+++ b/client/virt/tests/unattended_install.py
@@ -799,6 +799,7 @@ def run_unattended_install(test, params, env):
 break
 else:
 raise e
+vm.verify_userspace_crash()
 vm.verify_kernel_crash()
 test.verify_background_errors()
 if params.get(wait_no_ack, no) == no:
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[1.0 release work] Fix regressions found on recent KVM autotest qemu master 'sanity' jobs

2011-11-04 Thread Lucas Meneghel Rodrigues

Hi guys,

As we understand that qemu is approaching 1.0, we think it's a good idea 
to share the issues we have been seeing on recent qemu.git sanity jobs:


1) Some condition is consistently making a RHEL 6.1 linux guest not able 
to bring up the network interface, causing login failures for all linux 
guest tests. This very same guest install works perfectly on qemu-kvm, 
RHEL 5 and RHEL 6.


2) The floppy regression problem which was reported some days ago on 
this mailing list still happens, Kevin did post a patch that resolves it


diff --git a/hw/dma.c b/hw/dma.c
index 8a7302a..1d3b6f1 100644
--- a/hw/dma.c
+++ b/hw/dma.c
@@ -358,6 +358,13 @@ static void DMA_run (void)
 struct dma_cont *d;
 int icont, ichan;
 int rearm = 0;
+static int running = 0;
+
+if (running) {
+goto out;
+} else {
+running = 1;
+}

 d = dma_controllers;

@@ -374,6 +381,8 @@ static void DMA_run (void)
 }
 }

+out:
+running = 0;
 if (rearm)
 qemu_bh_schedule_idle(dma_bh);
 }

But still wasn't integrated upstream. As I understand, there are doubts 
whether this is a proper fix. Works with qemu-kvm.git. RHEL 5 and RHEL 6.


3) With Kevin's patch applied, windows install goes on until the first 
reboot. When it gets there, it gets stuck on the BIOS screen. The bios 
being used is the bin shipped on qemu.git's repo. So the install does 
not complete. Works with qemu-kvm.git, RHEL 5 and RHEL 6.


Those were the issues found on our 'sanity' job, which is the closest to 
a smoke test we have with KVM autotest. It simply installs one stable 
and recent linux guest, boot, simple migration, reboot, shutdown, rinse 
and repeat with the latest windows guest available. All guests use 
virtio disks and virtio network cards. It has 100% PASS rate, or very 
close to it for the other branches mentioned.


So qemu.git current state is not good, and those bugs need some work 
before 1.0 is out.


Please feel free to approach myself and Cleber on irc or email, as we 
can give you the details we have available, in case you need them.


Lucas
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [1.0 release work] Fix regressions found on recent KVM autotest qemu master 'sanity' jobs

2011-11-04 Thread Lucas Meneghel Rodrigues

On Fri 04 Nov 2011 02:50:53 PM BRST, Kevin Wolf wrote:

Am 04.11.2011 17:40, schrieb Lucas Meneghel Rodrigues:

2) The floppy regression problem which was reported some days ago on
this mailing list still happens, Kevin did post a patch that resolves it

[...]

But still wasn't integrated upstream. As I understand, there are doubts
whether this is a proper fix. Works with qemu-kvm.git. RHEL 5 and RHEL 6.


The first patch was buggy (even though it seemed to do the trick in most
cases), but I do have a new version queued for my next pull request.

In case you like to test it before it gets merged, this is the new version:

diff --git a/hw/dma.c b/hw/dma.c
index 8a7302a..0a9322d 100644
--- a/hw/dma.c
+++ b/hw/dma.c
@@ -358,6 +358,14 @@ static void DMA_run (void)
  struct dma_cont *d;
  int icont, ichan;
  int rearm = 0;
+static int running = 0;
+
+if (running) {
+rearm = 1;
+goto out;
+} else {
+running = 1;
+}

  d = dma_controllers;

@@ -374,6 +382,8 @@ static void DMA_run (void)
  }
  }

+running = 0;
+out:
  if (rearm)
  qemu_bh_schedule_idle(dma_bh);
  }

Kevin


Ok, we'll put it on our off tree patch stash for the next upstream jobs 
[1], thanks. We still have the bios problem to finally get a working 
windows install, I hope people might look into this.


[1] Well, currently this is the only patch on our 'stash', we only 
resort to external patches on blockers like this one.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [1.0 release work] Fix regressions found on recent KVM autotest qemu master 'sanity' jobs

2011-11-04 Thread Lucas Meneghel Rodrigues

On Fri 04 Nov 2011 02:56:30 PM BRST, Anthony Liguori wrote:

On 11/04/2011 11:40 AM, Lucas Meneghel Rodrigues wrote:

Hi guys,

As we understand that qemu is approaching 1.0, we think it's a good 
idea to

share the issues we have been seeing on recent qemu.git sanity jobs:

1) Some condition is consistently making a RHEL 6.1 linux guest not 
able to
bring up the network interface, causing login failures for all linux 
guest
tests. This very same guest install works perfectly on qemu-kvm, RHEL 
5 and RHEL 6.


Can you file a bug report with specific information about how the 
guest is being launched? Specifically, what NIC are we talking about? 
Do other types of guests work?


Ok, I will. Just FYI, it's a virtio nic. As on sanity jobs we only test 
RHEL 6.1 64 bit and Windows 7 SP1 64 bit, and Windows is blocked due to 
the other bug mentioned, I still have no idea whether other guests do 
work.


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Qemu-devel] [1.0 release work] Fix regressions found on recent KVM autotest qemu master 'sanity' jobs

2011-11-04 Thread Lucas Meneghel Rodrigues

On 11/04/2011 02:56 PM, Anthony Liguori wrote:

On 11/04/2011 11:40 AM, Lucas Meneghel Rodrigues wrote:

Hi guys,

As we understand that qemu is approaching 1.0, we think it's a good
idea to
share the issues we have been seeing on recent qemu.git sanity jobs:

1) Some condition is consistently making a RHEL 6.1 linux guest not
able to
bring up the network interface, causing login failures for all linux
guest
tests. This very same guest install works perfectly on qemu-kvm, RHEL
5 and RHEL 6.


Can you file a bug report with specific information about how the guest
is being launched? Specifically, what NIC are we talking about? Do other
types of guests work?


https://bugs.launchpad.net/qemu/+bug/886255

I believe relevant info is there. Command lines, screenshots, kernel 
versions, qemu commit hashes... If you need something else, let me know.



Regards,

Anthony Liguori



--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] virt: Encode a webm video from vm screenshots v2

2011-11-04 Thread Lucas Meneghel Rodrigues
When we are debugging issues (notably during unattended
installs), having to look individual screenshots is less
than optimal. So introduce in virt tests the ability to
get a webm file that can be played quite nicely and out
of the box in recent versions of firefox and chromium.

In order to do that, move to a sequential screenshot
naming policy for each vm, and encode videos at vm
postprocessing stage.

In order to use that feature, the host needs to have a
ffmpeg build sufficiently recent that can encode webm
files. The infrastructure will do the best possible to
find it out on your path.

Feature successfuly tested under Fedora 16.

Changes from v1:
 * Fixed some last minute changes on parameter name
 * Turns on the service by default
 * Downgrade failure messages to info level

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/base.cfg.sample |6 
 client/virt/virt_env_process.py  |   49 ++
 2 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/client/tests/kvm/base.cfg.sample b/client/tests/kvm/base.cfg.sample
index 6b3f9fd..1bda496 100644
--- a/client/tests/kvm/base.cfg.sample
+++ b/client/tests/kvm/base.cfg.sample
@@ -86,6 +86,12 @@ screendump_quality = 30
 screendump_temp_dir = /dev/shm
 screendump_verbose = no
 
+# Encode video from vm screenshots (requires ffmpeg build that can encode webm)
+encode_video_files = yes
+encode_video_framerate = 1
+keep_video_files = yes
+keep_video_files_on_error = yes
+
 # Default remote shell port (SSH under linux)
 shell_port = 22
 
diff --git a/client/virt/virt_env_process.py b/client/virt/virt_env_process.py
index e5316d2..27a60d3 100644
--- a/client/virt/virt_env_process.py
+++ b/client/virt/virt_env_process.py
@@ -16,6 +16,16 @@ _screendump_thread = None
 _screendump_thread_termination_event = None
 
 
+def ffmpeg_path():
+try:
+return virt_utils.find_command(ffmpeg)
+except ValueError:
+return None
+
+
+_ffmpeg = ffmpeg_path()
+
+
 def preprocess_image(test, params):
 
 Preprocess a single QEMU image according to the instructions in params.
@@ -156,6 +166,25 @@ def postprocess_vm(test, params, env, name):
 except kvm_monitor.MonitorError, e:
 logging.warn(e)
 
+# Encode a webm video from the screenshots produced?
+if params.get(encode_video_files, yes) == yes:
+video_framerate = int(params.get(encode_video_framerate, 1))
+if _ffmpeg is not None:
+logging.debug(Param 'encode_video_files' specified, trying to 
+  encode a video from the screenshots produced by 
+  vm %s, vm.name)
+os.chdir(test.debugdir)
+try:
+utils.run(%s -r %d -b 1800 -i screendumps_%s/%s %s.webm %
+  (_ffmpeg, video_framerate, vm.name, %04d.jpg,
+   vm.name))
+except error.CmdError, e:
+logging.info(Failed to encode video for vm %s: %s,
+ vm.name, e)
+else:
+logging.info(Param 'encode_video' specified, but ffmpeg not 
+ present, not encoding video for vm %s, vm.name)
+
 if params.get(kill_vm) == yes:
 kill_vm_timeout = float(params.get(kill_vm_timeout, 0))
 if kill_vm_timeout:
@@ -364,20 +393,27 @@ def postprocess(test, params, env):
 pass
 
 # Should we keep the PPM files?
-if params.get(keep_ppm_files) != yes:
+if params.get(keep_ppm_files, no) != yes:
 logging.debug(Param 'keep_ppm_files' not specified, removing all PPM 
   files from debug dir)
 for f in glob.glob(os.path.join(test.debugdir, '*.ppm')):
 os.unlink(f)
 
 # Should we keep the screendump dirs?
-if params.get(keep_screendumps) != yes:
+if params.get(keep_screendumps, no) != yes:
 logging.debug(Param 'keep_screendumps' not specified, removing 
   screendump dirs)
 for d in glob.glob(os.path.join(test.debugdir, screendumps_*)):
 if os.path.isdir(d) and not os.path.islink(d):
 shutil.rmtree(d, ignore_errors=True)
 
+# Should we keep the video files?
+if params.get(keep_video_files, yes) != yes:
+logging.debug(Param 'keep_videos' not specified, removing all webm 
+  files from debug dir)
+for f in glob.glob(os.path.join(test.debugdir, '*.webm')):
+os.unlink(f)
+
 # Kill all unresponsive VMs
 if params.get(kill_unresponsive_vms) == yes:
 logging.debug(Param 'kill_unresponsive_vms' specified, killing all 
@@ -457,9 +493,12 @@ def _take_screendumps(test, params, env):
 quality = int(params.get(screendump_quality, 30))
 
 cache = {}
+counter = {}
 
 while True:
 for vm in env.get_all_vms():
+if vm not in counter.keys():
+counter[vm] = 0

[PATCH 0/6] Misc bugfixes found after libvirt merge

2011-11-04 Thread Lucas Meneghel Rodrigues
Also, give it back the ability to debug Fedora and RHEL6 guest
issues.

Lucas Meneghel Rodrigues (6):
  KVM test: Adding Ubuntu 11.10 to the list of known guests
  virt: fix rebase problem - ffsb.control going to the right place
  virt: fixing softlockup test script location
  Separate command execution of watchdog commands
  virt: Fixing location of blkdebug files
  virt: Drop 'rhgb quiet' from kernel cmdline on Fedora and RHEL6
guests

 client/tests/kvm/autotest_control/ffsb.control |   16 -
 client/tests/kvm/guest-os.cfg.sample   |   11 ++
 client/virt/autotest_control/ffsb.control  |   16 +
 client/virt/blkdebug/default.conf  |   16 +
 client/virt/tests/softlockup.py|2 +-
 client/virt/tests/watchdog.py  |9 +++--
 client/virt/unattended/Fedora-10.ks|1 +
 client/virt/unattended/Fedora-11.ks|1 +
 client/virt/unattended/Fedora-12.ks|1 +
 client/virt/unattended/Fedora-13.ks|1 +
 client/virt/unattended/Fedora-14.ks|1 +
 client/virt/unattended/Fedora-15.ks|1 +
 client/virt/unattended/Fedora-8.ks |1 +
 client/virt/unattended/Fedora-9.ks |1 +
 client/virt/unattended/RHEL-6-series.ks|1 +
 client/virt/unattended/Ubuntu-11-10.preseed|   42 
 16 files changed, 101 insertions(+), 20 deletions(-)
 mode change 100644 = 100755 client/tests/cgroup/cgroup.py
 delete mode 100644 client/tests/kvm/autotest_control/ffsb.control
 create mode 100644 client/virt/autotest_control/ffsb.control
 create mode 100644 client/virt/blkdebug/default.conf
 create mode 100644 client/virt/unattended/Ubuntu-11-10.preseed

-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] KVM test: Adding Ubuntu 11.10 to the list of known guests

2011-11-04 Thread Lucas Meneghel Rodrigues
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/guest-os.cfg.sample|   11 +++
 client/virt/unattended/Ubuntu-11-10.preseed |   42 +++
 2 files changed, 53 insertions(+), 0 deletions(-)
 create mode 100644 client/virt/unattended/Ubuntu-11-10.preseed

diff --git a/client/tests/kvm/guest-os.cfg.sample 
b/client/tests/kvm/guest-os.cfg.sample
index 1462754..1e19c52 100644
--- a/client/tests/kvm/guest-os.cfg.sample
+++ b/client/tests/kvm/guest-os.cfg.sample
@@ -986,6 +986,17 @@ variants:
 md5sum_cd1 = 355ca2417522cb4a77e0295bf45c5cd5
 md5sum_1m_cd1 = 65b1514744bf99e88f6228e9b6f152a8
 
+- 11.10-server-64:
+image_name += -11.10-server-64
+unattended_install:
+kernel = images/ubuntu-server-11-10-64/vmlinuz
+initrd = images/ubuntu-server-11-10-64/initrd.gz
+boot_path = install
+unattended_install.cdrom:
+unattended_file = unattended/Ubuntu-11-10.preseed
+cdrom_cd1 = 
isos/linux/ubuntu-11.10-server-amd64.iso
+md5sum_cd1 = f8a0112b7cb5dcd6d564dbe59f18c35f
+md5sum_1m_cd1 = 3f5d0a11f4d62f82db358b329819ad9c
 
 - DSL-4.2.5:
 no setup dbench bonnie linux_s3
diff --git a/client/virt/unattended/Ubuntu-11-10.preseed 
b/client/virt/unattended/Ubuntu-11-10.preseed
new file mode 100644
index 000..b4bec84
--- /dev/null
+++ b/client/virt/unattended/Ubuntu-11-10.preseed
@@ -0,0 +1,42 @@
+debconf debconf/priority string critical
+unknown debconf/priority string critical
+d-i debconf/priority string critical
+d-i debian-installer/locale string en_US
+d-i console-tools/archs select at
+d-i console-keymaps-at/keymap select us
+
+d-i netcfg/choose_interface select auto
+d-i netcfg/get_hostname string unassigned-hostname
+d-i netcfg/get_domain string unassigned-domain
+d-i netcfg/wireless_wep string
+
+d-i clock-setup/utc boolean true
+d-i time/zone string US/Eastern
+
+d-i partman-auto/method string regular
+d-i partman-auto/choose_recipe select home
+d-i partman/confirm_write_new_label boolean true
+d-i partman/choose_partition select finish
+d-i partman/confirm boolean true
+d-i partman/confirm_nooverwrite boolean true
+
+d-i passwd/root-login boolean true
+d-i passwd/make-user boolean false
+d-i passwd/root-password password 12345678
+d-i passwd/root-password-again password 12345678
+
+tasksel tasksel/first multiselect standard
+
+d-i pkgsel/include string openssh-server build-essential
+
+d-i grub-installer/only_debian boolean true
+d-i grub-installer/with_other_os boolean true
+
+d-i apt-setup/security_host string
+base-config apt-setup/security-updates boolean false
+
+ubiquity ubiquity/summary note
+ubiquity ubiquity/reboot boolean true
+
+d-i finish-install/reboot_in_progress note
+d-i debian-installer/exit/poweroff boolean true
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] virt: fix rebase problem - ffsb.control going to the right place

2011-11-04 Thread Lucas Meneghel Rodrigues
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/tests/kvm/autotest_control/ffsb.control |   16 
 client/virt/autotest_control/ffsb.control  |   16 
 2 files changed, 16 insertions(+), 16 deletions(-)
 delete mode 100644 client/tests/kvm/autotest_control/ffsb.control
 create mode 100644 client/virt/autotest_control/ffsb.control

diff --git a/client/tests/kvm/autotest_control/ffsb.control 
b/client/tests/kvm/autotest_control/ffsb.control
deleted file mode 100644
index c7e92eb..000
--- a/client/tests/kvm/autotest_control/ffsb.control
+++ /dev/null
@@ -1,16 +0,0 @@
-AUTHOR = Onkar N Mahajan onkar.n.maha...@linux.vnet.ibm.com
-NAME = Flexible Filesystem Benchmark (FFSB)
-TEST_CATEGORY = Filesystem Benchmark
-TEST_CLASS = General
-TEST_TYPE = client
-TIME = 'MEDIUM'
-DOC = 
-The Flexible Filesystem Benchmark (FFSB) is a cross-platform
-filesystem performance measurement tool. It uses customizable
-profiles to measure of different workloads, and it supports
-multiple groups of threads across multiple filesystems.
-
-For more info, see http://sourceforge.net/projects/ffsb/
-
-
-job.run_test('ffsb')
diff --git a/client/virt/autotest_control/ffsb.control 
b/client/virt/autotest_control/ffsb.control
new file mode 100644
index 000..c7e92eb
--- /dev/null
+++ b/client/virt/autotest_control/ffsb.control
@@ -0,0 +1,16 @@
+AUTHOR = Onkar N Mahajan onkar.n.maha...@linux.vnet.ibm.com
+NAME = Flexible Filesystem Benchmark (FFSB)
+TEST_CATEGORY = Filesystem Benchmark
+TEST_CLASS = General
+TEST_TYPE = client
+TIME = 'MEDIUM'
+DOC = 
+The Flexible Filesystem Benchmark (FFSB) is a cross-platform
+filesystem performance measurement tool. It uses customizable
+profiles to measure of different workloads, and it supports
+multiple groups of threads across multiple filesystems.
+
+For more info, see http://sourceforge.net/projects/ffsb/
+
+
+job.run_test('ffsb')
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] virt: fixing softlockup test script location

2011-11-04 Thread Lucas Meneghel Rodrigues
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/softlockup.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
 mode change 100644 = 100755 client/tests/cgroup/cgroup.py

diff --git a/client/tests/cgroup/cgroup.py b/client/tests/cgroup/cgroup.py
old mode 100644
new mode 100755
diff --git a/client/virt/tests/softlockup.py b/client/virt/tests/softlockup.py
index 649b3ab..a9a92f9 100644
--- a/client/virt/tests/softlockup.py
+++ b/client/virt/tests/softlockup.py
@@ -109,7 +109,7 @@ def run_softlockup(test, params, env):
 pass
 
 # Get required files and copy them from host to guest
-monitor_path = os.path.join(test.bindir, 'deps', 'heartbeat_slu.py')
+monitor_path = os.path.join(test.virtdir, 'deps', 'heartbeat_slu.py')
 stress_path = os.path.join(os.environ['AUTODIR'], tests, stress,
stress-1.0.4.tar.gz)
 vm.copy_files_to(monitor_path, /tmp)
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] Separate command execution of watchdog commands

2011-11-04 Thread Lucas Meneghel Rodrigues
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/tests/watchdog.py |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/client/virt/tests/watchdog.py b/client/virt/tests/watchdog.py
index 446f250..603685f 100644
--- a/client/virt/tests/watchdog.py
+++ b/client/virt/tests/watchdog.py
@@ -15,7 +15,8 @@ def run_watchdog(test, params, env):
 timeout = int(params.get(login_timeout, 360))
 session = vm.wait_for_login(timeout=timeout)
 relogin_timeout = int(params.get(relogin_timeout, 240))
-watchdog_enable_cmd = chkconfig watchdog on  service watchdog start
+watchdog_enable_cmd = chkconfig watchdog on
+watchdog_start_cmd = service watchdog start
 
 def watchdog_action_reset():
 
@@ -35,8 +36,10 @@ def run_watchdog(test, params, env):
 logging.info(Waiting for kernel watchdog_action to take place)
 session = vm.wait_for_login(timeout=relogin_timeout)
 
-logging.info(Enabling watchdog service...)
-session.cmd(watchdog_enable_cmd, timeout=320)
+error.context(Enabling watchdog service)
+session.cmd(watchdog_enable_cmd)
+error.context(Starting watchdog service)
+session.cmd(watchdog_start_cmd, timeout=320)
 watchdog_action_reset()
 
 # Close stablished session
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] virt: Fixing location of blkdebug files

2011-11-04 Thread Lucas Meneghel Rodrigues
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/blkdebug/default.conf |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 client/virt/blkdebug/default.conf

diff --git a/client/virt/blkdebug/default.conf 
b/client/virt/blkdebug/default.conf
new file mode 100644
index 000..0497405
--- /dev/null
+++ b/client/virt/blkdebug/default.conf
@@ -0,0 +1,16 @@
+[inject-error]
+state = 2
+event = read_aio
+errno = 7
+immediately = off
+once = on
+
+[set-state]
+state = 1
+event = read_aio
+new_state = 2
+
+[set-state]
+state = 2
+event = read_aio
+new_state = 3
-- 
1.7.7

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] virt: Drop 'rhgb quiet' from kernel cmdline on Fedora and RHEL6 guests

2011-11-04 Thread Lucas Meneghel Rodrigues
Try to invoke grubby at first step of the guest post
script in order to remove the params rhgb quiet from
guests installed by our virt tests.

With this patch, we have full serial console log on all
virt subtests executed on these guests, giving developers
important guest debugging info.

Successfully tested with Fedora 15 guest.

CC: Eduardo Habkost ehabk...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 client/virt/unattended/Fedora-10.ks |1 +
 client/virt/unattended/Fedora-11.ks |1 +
 client/virt/unattended/Fedora-12.ks |1 +
 client/virt/unattended/Fedora-13.ks |1 +
 client/virt/unattended/Fedora-14.ks |1 +
 client/virt/unattended/Fedora-15.ks |1 +
 client/virt/unattended/Fedora-8.ks  |1 +
 client/virt/unattended/Fedora-9.ks  |1 +
 client/virt/unattended/RHEL-6-series.ks |1 +
 9 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/client/virt/unattended/Fedora-10.ks 
b/client/virt/unattended/Fedora-10.ks
index 081d41a..4102fce 100644
--- a/client/virt/unattended/Fedora-10.ks
+++ b/client/virt/unattended/Fedora-10.ks
@@ -26,6 +26,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-11.ks 
b/client/virt/unattended/Fedora-11.ks
index c339220..2309637 100644
--- a/client/virt/unattended/Fedora-11.ks
+++ b/client/virt/unattended/Fedora-11.ks
@@ -26,6 +26,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-12.ks 
b/client/virt/unattended/Fedora-12.ks
index c339220..2309637 100644
--- a/client/virt/unattended/Fedora-12.ks
+++ b/client/virt/unattended/Fedora-12.ks
@@ -26,6 +26,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-13.ks 
b/client/virt/unattended/Fedora-13.ks
index c339220..2309637 100644
--- a/client/virt/unattended/Fedora-13.ks
+++ b/client/virt/unattended/Fedora-13.ks
@@ -26,6 +26,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-14.ks 
b/client/virt/unattended/Fedora-14.ks
index e1323cd..fa5dd7f 100644
--- a/client/virt/unattended/Fedora-14.ks
+++ b/client/virt/unattended/Fedora-14.ks
@@ -27,6 +27,7 @@ dmidecode
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-15.ks 
b/client/virt/unattended/Fedora-15.ks
index ea15d80..a44915a 100644
--- a/client/virt/unattended/Fedora-15.ks
+++ b/client/virt/unattended/Fedora-15.ks
@@ -27,6 +27,7 @@ dmidecode
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-8.ks 
b/client/virt/unattended/Fedora-8.ks
index 9403191..1af7559 100644
--- a/client/virt/unattended/Fedora-8.ks
+++ b/client/virt/unattended/Fedora-8.ks
@@ -25,6 +25,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/Fedora-9.ks 
b/client/virt/unattended/Fedora-9.ks
index a7d5399..0c47598 100644
--- a/client/virt/unattended/Fedora-9.ks
+++ b/client/virt/unattended/Fedora-9.ks
@@ -26,6 +26,7 @@ ntpdate
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system('dhclient')
 os.system('chkconfig sshd on')
 os.system('iptables -F')
diff --git a/client/virt/unattended/RHEL-6-series.ks 
b/client/virt/unattended/RHEL-6-series.ks
index 166c499..215d75d 100644
--- a/client/virt/unattended/RHEL-6-series.ks
+++ b/client/virt/unattended/RHEL-6-series.ks
@@ -30,6 +30,7 @@ watchdog
 
 %post --interpreter /usr/bin/python
 import socket, os
+os.system('grubby --remove-args=rhgb quiet --update-kernel=$(grubby 
--default-kernel)')
 os.system

qemu-kvm crashes doing migration with disks + blkdebug files (does not happen with qemu)

2011-11-04 Thread Lucas Meneghel Rodrigues

Hi folks,

qemu-kvm is segfaulting when executing migration with blkdebug files.

19:50:02 DEBUG| Git repo qemu_kvm uri: git://github.com/avikivity/qemu.git
19:50:02 DEBUG| Git repo qemu_kvm branch: master
19:50:30 INFO | Commit hash for qemu_kvm is 
7879db7e9c09b92d9af1c143fbe2cc212ec89e4b (no tag found)


How to reproduce:

1) create a origin vm like:

/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std 
-monitor 
unix:'/tmp/monitor-humanmonitor1-2004-200902-95j0',server,nowait 
-qmp unix:'/tmp/monitor-qmpmonitor1-2004-200902-95j0',server,nowait 
-serial unix:'/tmp/serial-2004-200902-95j0',server,nowait -drive 
file=blkdebug:/usr/local/autotest/virt/blkdebug/default.conf:/tmp/kvm_autotest_root/images/rhel6.1-64.qcow2,index=0,if=virtio,cache=none,rerror=stop,werror=stop 
-device 
virtio-net-pci,netdev=idtzhBVb,mac='9a:d0:7b:07:18:72',id='id9JW3ZV' 
-netdev tap,id=idtzhBVb,fd=23 -m 2048 -smp 2 -vnc :0



2) create a destination vm like:

/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std 
-monitor 
unix:'/tmp/monitor-humanmonitor1-2004-201329-Ia9o',server,nowait 
-qmp unix:'/tmp/monitor-qmpmonitor1-2004-201329-Ia9o',server,nowait 
-serial unix:'/tmp/serial-2004-201329-Ia9o',server,nowait -drive 
file=blkdebug:/usr/local/autotest/virt/blkdebug/default.conf:/tmp/kvm_autotest_root/images/rhel6.1-64.qcow2,index=0,if=virtio,cache=none,rerror=stop,werror=stop 
-device 
virtio-net-pci,netdev=idup1xAf,mac='9a:d0:7b:07:18:72',id='idyvOQf3' 
-netdev tap,id=idup1xAf,fd=19 -m 2048 -smp 2 -vnc :1  -S -incoming 
exec:nc -l 5200


Note that blkdebug file contains:

[inject-error]
state = 2
event = read_aio
errno = 7
immediately = off
once = on

[set-state]
state = 1
event = read_aio
new_state = 2

[set-state]
state = 2
event = read_aio
new_state = 3

Start the migration (on this example, using exec, but it reproduces with 
tcp and unix sockets):


11/04 20:13:30 DEBUG|kvm_monito:0254| (monitor humanmonitor1) Sending 
command 'migrate -d exec:nc localhost 5200'


Then you will have:

11/04 20:13:33 INFO |   aexpect:0783| [qemu output] invalid runstate 
transition
11/04 20:13:36 INFO |   aexpect:0783| [qemu output] /bin/sh: line 1: 
14695 Aborted (core dumped) 
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std 
-monitor 
unix:'/tmp/monitor-humanmonitor1-2004-200902-95j0',server,nowait 
-qmp unix:'/tmp/monitor-qmpmonitor1-2004-200902-95j0',server,nowait 
-serial unix:'/tmp/serial-2004-200902-95j0',server,nowait -drive 
file=blkdebug:/usr/local/autotest/virt/blkdebug/default.conf:/tmp/kvm_autotest_root/images/rhel6.1-64.qcow2,index=0,if=virtio,cache=none,rerror=stop,werror=stop 
-device 
virtio-net-pci,netdev=idtzhBVb,mac='9a:d0:7b:07:18:72',id='id9JW3ZV' 
-netdev tap,id=idtzhBVb,fd=23 -m 2048 -smp 2 -vnc :0


We do have the core dumps available in case someone is interested in 
debugging the issue.


It is important to note that this problem is not happening with qemu.git 
master.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   4   5   6   7   8   9   10   >