Amos Kong | 1 Nov 2010 11:34
Picon
Favicon
Gravatar

[PATCH 0/5] Bonding tet patchsets V2

I've updated bonding patchsets according to jason and lucas' comments,
this's bonding test V2.

---

Amos Kong (5):
      Add serial login into kvm_test_utils.wait_for_login()
      KVM-test: guest_test: Put "cmd /c" into command itself
      KVM-test: Add a option of login guest by serial
      KVM-test: Move serial init from vm.create to vm.serial_login
      KVM-test: Add a new bonding subtest

 0 files changed, 0 insertions(+), 0 deletions(-)

--

-- 
Amos
Amos Kong | 1 Nov 2010 11:34
Picon
Favicon
Gravatar

[PATCH 1/5] Add serial login into kvm_test_utils.wait_for_login()

Changes from v1:
- Convert all net tests to use new function
- Update debug info

Signed-off-by: Amos Kong <akong <at> redhat.com>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_test_utils.py b/client/tests/kvm/kvm_test_utils.py
index 014f265..11e3e58 100644
--- a/client/tests/kvm/kvm_test_utils.py
+++ b/client/tests/kvm/kvm_test_utils.py
 <at>  <at>  -44,7 +44,7  <at>  <at>  def get_living_vm(env, vm_name):
     return vm

 
-def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2):
+def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2, serial=None):
     """
     Try logging into a VM repeatedly.  Stop on success or when timeout expires.

 <at>  <at>  -53,9 +53,16  <at>  <at>  def wait_for_login(vm, nic_index=0, timeout=240, start=0, step=2):
      <at> param timeout: Time to wait before giving up.
      <at> return: A shell session object.
     """
-    logging.info("Trying to log into guest '%s', timeout %ds", vm.name, timeout)
-    session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index),
-                                 timeout, start, step)
+    if serial:
+        logging.info("Trying to log into guest using serial connection,"
(Continue reading)

Amos Kong | 1 Nov 2010 11:34
Picon
Favicon
Gravatar

[PATCH 2/5] KVM-test: guest_test: Put "cmd /c" into command itself

guest_test is used to execute test on Linux and Windows, "cmd /c" is only
useful for Windows guests.

Changes from v1:
- Drop the judgement of Windows guest
- Update cmd of guest_test

Signed-off-by: Amos Kong <akong <at> redhat.com>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py
index b6bebc7..e396952 100644
--- a/client/tests/kvm/tests/guest_test.py
+++ b/client/tests/kvm/tests/guest_test.py
 <at>  <at>  -63,7 +63,7  <at>  <at>  def run_guest_test(test, params, env):
             script_path = kvm_utils.get_path(test.bindir, script)
             vm.copy_files_to(script_path, dst_rsc_path, timeout=60)

-        command = "cmd /c %s %s %s" %(interpreter, dst_rsc_path, script_params)
+        command = "%s %s %s" %(interpreter, dst_rsc_path, script_params)

         logging.info("---------------- Script output ----------------")
         status = session.get_command_status(command,
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 40ecf4a..7b5aac2 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
 <at>  <at>  -290,7 +290,7  <at>  <at>  variants:
         reboot = yes
(Continue reading)

Amos Kong | 1 Nov 2010 11:35
Picon
Favicon
Gravatar

[PATCH 3/5] KVM-test: Add a option of login guest by serial

Signed-off-by: Amos Kong <akong <at> redhat.com>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/tests/guest_test.py b/client/tests/kvm/tests/guest_test.py
index e396952..84595d6 100644
--- a/client/tests/kvm/tests/guest_test.py
+++ b/client/tests/kvm/tests/guest_test.py
 <at>  <at>  -20,7 +20,9  <at>  <at>  def run_guest_test(test, params, env):
     reboot = params.get("reboot", "no")

     vm = kvm_test_utils.get_living_vm(env, params.get("main_vm"))
-    session = kvm_test_utils.wait_for_login(vm, timeout=login_timeout)
+    serial_login = (params.get("serial_login", "no") == "yes")
+    session = kvm_test_utils.wait_for_login(vm, timeout=login_timeout,
+                                            serial=serial_login)

     if reboot == "yes":
         logging.debug("Rebooting guest before test ...")
Amos Kong | 1 Nov 2010 11:35
Picon
Favicon
Gravatar

[PATCH 4/5] KVM-test: Move serial init from vm.create to vm.serial_login

If we put serial init to vm.create(), we could not re-get available session
after close it.
This patch just changes serial to be same as ssh/nc/telnet.

Signed-off-by: Amos Kong <akong <at> redhat.com>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index a860437..c609bd0 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
 <at>  <at>  -731,14 +731,6  <at>  <at>  class VM:

             logging.debug("VM appears to be alive with PID %s", self.get_pid())

-            # Establish a session with the serial console -- requires a version
-            # of netcat that supports -U
-            self.serial_console = kvm_subprocess.kvm_shell_session(
-                "nc -U %s" % self.get_serial_console_filename(),
-                auto_close=False,
-                output_func=kvm_utils.log_line,
-                output_params=("serial-%s.log" % name,))
-
             return True

         finally:
 <at>  <at>  -1147,6 +1139,14  <at>  <at>  class VM:
         linesep = eval("'%s'" % self.params.get("shell_linesep", r"\n"))
         status_test_command = self.params.get("status_test_command", "")
(Continue reading)

Amos Kong | 1 Nov 2010 11:35
Picon
Favicon
Gravatar

[PATCH 5/5] KVM-test: Add a new bonding subtest

In this test, execute run_guest_test() to setup bonding, ping guest from
host when repeatedly down/up interfaces, and check the lost packet ratio.
But this test always fail of lose packets, we maybe need adjust the
check_ratio in config file. Then execute file transfer test between guest
and host.

Changes from v1:
- Add file transfer test
- Setup bonding by serial
- Fix bonding_setup.py

Signed-off-by: Feng Yang <fyang <at> redhat.com>
Signed-off-by: Amos Kong <akong <at> redhat.com>
---
 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/client/tests/kvm/scripts/bonding_setup.py b/client/tests/kvm/scripts/bonding_setup.py
new file mode 100644
index 0000000..dd5550a
--- /dev/null
+++ b/client/tests/kvm/scripts/bonding_setup.py
 <at>  <at>  -0,0 +1,31  <at>  <at> 
+import os, re, commands
+
+eth_nums = 0
+ifconfig_output = commands.getoutput("ifconfig")
+re_eth = "eth[0-9]*"
+for ename in re.findall(re_eth, ifconfig_output):
+    eth_config_file = "/etc/sysconfig/network-scripts/ifcfg-%s" % ename
+    eth_config = """DEVICE=%s
(Continue reading)

Qingtang Zhou | 1 Nov 2010 13:43
Picon
Favicon
Gravatar

Re: [PATCH 5/5] KVM-test: Add a new bonding subtest

* On 2010-11-01 18:35:17 +0800, Amos Kong (akong <at> redhat.com) wrote:
> In this test, execute run_guest_test() to setup bonding, ping guest from
> host when repeatedly down/up interfaces, and check the lost packet ratio.
> But this test always fail of lose packets, we maybe need adjust the
> check_ratio in config file. Then execute file transfer test between guest
> and host.
Hi Akong, 
I think we may check the packet loss ratio(PLR) between physical machines,
and compare it with PLR between host to guest.

> 
> Changes from v1:
> - Add file transfer test
> - Setup bonding by serial
> - Fix bonding_setup.py
> 
> Signed-off-by: Feng Yang <fyang <at> redhat.com>
> Signed-off-by: Amos Kong <akong <at> redhat.com>
> ---
>  0 files changed, 0 insertions(+), 0 deletions(-)
> 
> diff --git a/client/tests/kvm/scripts/bonding_setup.py b/client/tests/kvm/scripts/bonding_setup.py
> new file mode 100644
> index 0000000..dd5550a
> --- /dev/null
> +++ b/client/tests/kvm/scripts/bonding_setup.py
>  <at>  <at>  -0,0 +1,31  <at>  <at> 
> +import os, re, commands
> +
> +eth_nums = 0
(Continue reading)

Michael Goldish | 1 Nov 2010 16:45
Picon
Favicon

Re: [PATCH 0/3] Launch other test during migration

On 09/25/2010 11:36 AM, Jason Wang wrote:
> We could give a further test of migration by launch test during migartion. So
> the following series implements:
> 
> - A simple class to run a specified test in the background which could be used
> to launch other test during migartion. Its design is rather simple and its usage
> is a little tricky, but it work well.
> - Two sample tests which take advantages of the background class: Test reboot
> during guest migration and test file_transfer during guest migration.
> 
> In the future, we could even lauch autotest client test during guest migation.
> 
> ---
> 
> Jason Wang (3):
>       KVM Test: Introduce a helper class to run a test in the background
>       KVM test: Test reboot during migration
>       KVM test: Test the file transfer during migartion
> 
> 
>  client/tests/kvm/kvm_test_utils.py                 |   44 +++++++++++++++
>  .../kvm/tests/migration_with_file_transfer.py      |   59 ++++++++++++++++++++
>  client/tests/kvm/tests/migration_with_reboot.py    |   45 +++++++++++++++
>  client/tests/kvm/tests_base.cfg.sample             |   12 ++++
>  4 files changed, 159 insertions(+), 1 deletions(-)
>  create mode 100644 client/tests/kvm/tests/migration_with_file_transfer.py
>  create mode 100644 client/tests/kvm/tests/migration_with_reboot.py

It seems to me that this method is only applicable to tests/functions
that don't require a VM object (i.e. that require only a shell session
(Continue reading)

Gregory P. Smith | 2 Nov 2010 01:35
Picon
Favicon

Re: [PATCH 1/6] client/bin/kernel.py: default kernel arguments shall be kept

We're running into an unfortunate side effect of this change.


boottool --update-kernel --args=X is buggy when used with lilo and the lilo.conf does not already have an append= section below that kernel's image= line.

What I'm doing as a hack to work around this is the following as the boottool perl code is pretty gross and much less easy to fix for this:


--- client/bin/kernel.py.before 2010-11-01 16:49:45.371159000 -0700
+++ client/bin/kernel.py        2010-11-01 17:25:30.786743000 -0700
<at> <at> -59,13 +59,17 <at> <at>
         else:
             arglist.append(arg)
 
-    # add the kernel entry. it will keep all arguments from the default entry
-    bootloader.add_kernel(image, tag, initrd=initrd, root=root)
+    # Add the kernel entry. it will keep all arguments from the default entry.
+    # args='_dummy_' is used to workaround a boottool limitation of not being
+    # able to add arguments to a kernel that does not already have any of its
+    # own by way of its own append= section below the image= line in lilo.conf.
+    bootloader.add_kernel(image, tag, initrd=initrd, root=root, args='_dummy_')
     # Now, for each argument in arglist, try to add it to the kernel that was
     # just added. In each step, if the arg already existed on the args string,
     # that particular arg will be skipped
     for a in arglist:
         bootloader.add_args(kernel=tag, args=a)
+    bootloader.remove_args(kernel=tag, args='_dummy_')
 
 
 class BootableKernel(object):
--- client/bin/kernel_unittest.py.before        2010-11-01 17:10:15.043835000 -0700
+++ client/bin/kernel_unittest.py       2010-11-01 17:25:54.656370000 -0700
<at> <at> -20,10 +20,11 <at> <at>
         # record
         bootloader.remove_kernel.expect_call(tag)
         bootloader.add_kernel.expect_call(image, tag, initrd=initrd,
-                                          root=bootloader_root)
+                                          args='_dummy_', root=bootloader_root)
 
         for a in bootloader_args.split():
             bootloader.add_args.expect_call(kernel=tag, args=a)
+        bootloader.remove_args.expect_call(kernel=tag, args='_dummy_')
 
         # run and check
         kernel._add_kernel_to_bootloader(



On Mon, Oct 18, 2010 at 10:29 AM, Lucas Meneghel Rodrigues <lmr <at> redhat.com> wrote:
When adding a new kernel to bootload we want the arguments of
the default entry to be kept in the new entry, otherwise that
entry might not boot (example, if we disregard LVM parameters
and the root is on an LVM volume, the entry won't boot).

So, instead of setting the arguments while the kernel entry
is being created (doing this with boottool will completely
disregard any arguments of the default entry), create the
new entry *then* add the additional arguments, one by one.
In every new addition, if the arg is already on the arg list,
the arg won't be added, therefore avoiding duplicate args.

Changes from v1:
- Fix kernel_unittest.py

Signed-off-by: Lucas Meneghel Rodrigues <lmr <at> redhat.com>
---
 client/bin/kernel.py          |   10 +++++++---
 client/bin/kernel_unittest.py |    4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index 4b333ea..c71efc2 100644
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
<at> <at> -59,9 +59,13 <at> <at> def _add_kernel_to_bootloader(bootloader, base_args, tag, args, image, initrd):
        else:
            arglist.append(arg)

-    # add the kernel entry
-    bootloader.add_kernel(image, tag, initrd=initrd, args=' '.join(arglist),
-                          root=root)
+    # add the kernel entry. it will keep all arguments from the default entry
+    bootloader.add_kernel(image, tag, initrd=initrd, root=root)
+    # Now, for each argument in arglist, try to add it to the kernel that was
+    # just added. In each step, if the arg already existed on the args string,
+    # that particular arg will be skipped
+    for a in arglist:
+        bootloader.add_args(kernel=tag, args=a)


 class BootableKernel(object):
diff --git a/client/bin/kernel_unittest.py b/client/bin/kernel_unittest.py
index fe40e6a..3adba6c 100755
--- a/client/bin/kernel_unittest.py
+++ b/client/bin/kernel_unittest.py
<at> <at> -18,9 +18,11 <at> <at> class TestAddKernelToBootLoader(unittest.TestCase):
        # record
        bootloader.remove_kernel.expect_call(tag)
        bootloader.add_kernel.expect_call(image, tag, initrd=initrd,
-                                          args=bootloader_args,
                                          root=bootloader_root)

+        for a in bootloader_args.split():
+            bootloader.add_args.expect_call(kernel=tag, args=a)
+
        # run and check
        kernel._add_kernel_to_bootloader(bootloader, base_args, tag, args,
                                         image, initrd)
--
1.7.2.3

_______________________________________________
Autotest mailing list
Autotest <at> test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

_______________________________________________
Autotest mailing list
Autotest <at> test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
Jason Wang | 2 Nov 2010 06:34
Picon
Favicon

Re: [PATCH 0/3] Launch other test during migration

Michael Goldish writes:
 > On 09/25/2010 11:36 AM, Jason Wang wrote:
 > > We could give a further test of migration by launch test during migartion. So
 > > the following series implements:
 > > 
 > > - A simple class to run a specified test in the background which could be used
 > > to launch other test during migartion. Its design is rather simple and its usage
 > > is a little tricky, but it work well.
 > > - Two sample tests which take advantages of the background class: Test reboot
 > > during guest migration and test file_transfer during guest migration.
 > > 
 > > In the future, we could even lauch autotest client test during guest migation.
 > > 
 > > ---
 > > 
 > > Jason Wang (3):
 > >       KVM Test: Introduce a helper class to run a test in the background
 > >       KVM test: Test reboot during migration
 > >       KVM test: Test the file transfer during migartion
 > > 
 > > 
 > >  client/tests/kvm/kvm_test_utils.py                 |   44 +++++++++++++++
 > >  .../kvm/tests/migration_with_file_transfer.py      |   59 ++++++++++++++++++++
 > >  client/tests/kvm/tests/migration_with_reboot.py    |   45 +++++++++++++++
 > >  client/tests/kvm/tests_base.cfg.sample             |   12 ++++
 > >  4 files changed, 159 insertions(+), 1 deletions(-)
 > >  create mode 100644 client/tests/kvm/tests/migration_with_file_transfer.py
 > >  create mode 100644 client/tests/kvm/tests/migration_with_reboot.py
 > 
 > It seems to me that this method is only applicable to tests/functions
 > that don't require a VM object (i.e. that require only a shell session
 > object).  kvm_test_utils.reboot() operates on a VM object, and the same
 > VM is destroyed by migrate() which runs in the background, so eventually
 > reboot() tries logging into a destroyed VM, which fails because
 > vm.get_address() fails.  Any monitor operation will also fail.  If the
 > autotest wrapper requires a VM object (currently it does) then it can't
 > be used either.
 > 

You are right and that's an issue when running test in parallel with
migration, but reboot through shell should work. The aim of this kind
of test is just to add some stress ( such as run_autotest) during
migartion, so most (probably all) of the tests only needs a
session. So I think it's not a very big issue in this situation.

 > An alternative (somewhat ugly) way to migrate in the background is to
 > pass a boolean 'migrate' flag to various functions/tests, such as
 > reboot() and run_autotest().  If 'migrate' is True, these functions will
 > do something like
 > 
 > vm = kvm_test_utils.migrate(vm, ...)
 > 
 > in their waiting loops, where wait_for() is normally used.  This
 > guarantees that 'vm' is always a valid VM object.  For example:
 > 
 > # Log in after reboot
 > while time.time() < end_time:
 >     if migrate_in_bg:
 >         vm = kvm_test_utils.migrate(vm, ...)
 >     session = vm.remote_login()
 >     if session:
 >         break
 >     time.sleep(2)
 > 
 > This is much longer than the usual wait_for(...) but it does the job.
 > What do you think?

This makes sense but it would let testcases need to care about the
migration and it's also hard to put all related codes into a wrapper
which would complicate the codes.

Despite the issue of vm object, all tests that only depends on the
shell session should works well with my method and it's more easy to
be extended. Maybe we could just warn the user of its usage and adapt
my method?

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

Gmane