Skip to contentSkip to conversation

KVM test: migration test: move the bulk of the code to a utility function

PATCH In review Michael Goldish 3 participants 11 messages Oct 7, 2009 – Nov 16, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 KVM test: migration test: move the bulk of the code to a utility function

Move most of the code to a utility function in kvm_test_utils.py, in order to make it reusable.

---
 client/tests/kvm/kvm_test_utils.py  |   72 +++++++++++++++++++++++++++++++++++
 client/tests/kvm/tests/migration.py |   62 +-----------------------------
 2 files changed, 74 insertions(+), 60 deletions(-)
client/tests/kvm/kvm_test_utils.py +72 -0
index 601b350..096a056 100644
@@ -59,3 +59,75 @@ def wait_for_login(vm, nic_index=0, timeout=240):
         raise error.TestFail("Could not log into guest '%s'" % vm.name)
     logging.info("Logged in")
     return session
+
+
+def migrate(vm, env=None):
+    """
+    Migrate a VM locally and re-register it in the environment.
+
+    @param vm: The VM to migrate.
+    @param env: The environment dictionary.  If omitted, the migrated VM will
+            not be registered.
+    @return: The post-migration VM.
+    """
+    # Helper functions
+    def mig_finished():
+        s, o = vm.send_monitor_cmd("info migrate")
+        return s == 0 and not "Migration status: active" in o
+
+    def mig_succeeded():
+        s, o = vm.send_monitor_cmd("info migrate")
+        return s == 0 and "Migration status: completed" in o
+
+    def mig_failed():
+        s, o = vm.send_monitor_cmd("info migrate")
+        return s == 0 and "Migration status: failed" in o
+
+    # See if migration is supported
+    s, o = vm.send_monitor_cmd("help info")
+    if not "info migrate" in o:
+        raise error.TestError("Migration is not supported")
+
+    # Clone the source VM and ask the clone to wait for incoming migration
+    dest_vm = vm.clone()
+    dest_vm.create(for_migration=True)
+
+    try:
+        # Define the migration command
+        cmd = "migrate -d tcp:localhost:%d" % dest_vm.migration_port
+        logging.debug("Migrating with command: %s" % cmd)
+
+        # Migrate
+        s, o = vm.send_monitor_cmd(cmd)
+        if s:
+            logging.error("Migration command failed (command: %r, output: %r)"
+                          % (cmd, o))
+            raise error.TestFail("Migration command failed")
+
+        # Wait for migration to finish
+        if not kvm_utils.wait_for(mig_finished, 90, 2, 2,
+                                  "Waiting for migration to finish..."):
+            raise error.TestFail("Timeout elapsed while waiting for migration "
+                                 "to finish")
+
+        # Report migration status
+        if mig_succeeded():
+            logging.info("Migration finished successfully")
+        elif mig_failed():
+            raise error.TestFail("Migration failed")
+        else:
+            raise error.TestFail("Migration ended with unknown status")
+
+        # Kill the source VM
+        vm.destroy(gracefully=False)
+
+        # Replace the source VM with the new cloned VM
+        if env is not None:
+            kvm_utils.env_register_vm(env, vm.name, dest_vm)
+
+        # Return the new cloned VM
+        return dest_vm
+
+    except:
+        dest_vm.destroy()
+        raise
client/tests/kvm/tests/migration.py +2 -60

81 lines not on this page · raw message

Signature · 1 line
1.5.4.1
#1 lore raw

PATCH 2/7 KVM test: timedrift test: move the get_time() helper function to kvm_test_utils.py

Move get_time() to kvm_test_utils.py to make it reusable.

---
 client/tests/kvm/kvm_test_utils.py  |   27 ++++++
 client/tests/kvm/tests/timedrift.py |  164 ++++++++++++++++------------------
 2 files changed, 104 insertions(+), 87 deletions(-)
client/tests/kvm/kvm_test_utils.py +27 -0
index 096a056..db9f666 100644
@@ -131,3 +131,30 @@ def migrate(vm, env=None):
     except:
         dest_vm.destroy()
         raise
+
+
+def get_time(session, time_command, time_filter_re, time_format):
+    """
+    Return the host time and guest time.  If the guest time cannot be fetched
+    a TestError exception is raised.
+
+    Note that the shell session should be ready to receive commands
+    (i.e. should "display" a command prompt and should be done with all
+    previous commands).
+
+    @param session: A shell session.
+    @param time_command: Command to issue to get the current guest time.
+    @param time_filter_re: Regex filter to apply on the output of
+            time_command in order to get the current time.
+    @param time_format: Format string to pass to time.strptime() with the
+            result of the regex filter.
+    @return: A tuple containing the host time and guest time.
+    """
+    host_time = time.time()
+    session.sendline(time_command)
+    (match, s) = session.read_up_to_prompt()
+    if not match:
+        raise error.TestError("Could not get guest time")
+    s = re.findall(time_filter_re, s)[0]
+    guest_time = time.mktime(time.strptime(s, time_format))
+    return (host_time, guest_time)
client/tests/kvm/tests/timedrift.py +77 -87

186 lines not on this page · raw message

Signature · 1 line
1.5.4.1
#2 lore raw

PATCH 3/7 KVM test: new test timedrift_with_migration

This patch adds a new test that checks the timedrift introduced by migrations. It uses the same parameters used by the timedrift test to get the guest time. In addition, the number of migrations the test performs is controlled by the parameter 'migration_iterations'.

---
 client/tests/kvm/kvm_tests.cfg.sample              |   33 ++++---
 client/tests/kvm/tests/timedrift_with_migration.py |   95 ++++++++++++++++++++
 2 files changed, 115 insertions(+), 13 deletions(-)
 create mode 100644 client/tests/kvm/tests/timedrift_with_migration.py
client/tests/kvm/kvm_tests.cfg.sample +20 -13
index 540d0a2..618c21e 100644
@@ -100,19 +100,26 @@ variants:
         type = linux_s3
 
     - timedrift:    install setup
-        type = timedrift
         extra_params += " -rtc-td-hack"
-        # Pin the VM and host load to CPU #0
-        cpu_mask = 0x1
-        # Set the load and rest durations
-        load_duration = 20
-        rest_duration = 20
-        # Fail if the drift after load is higher than 50%
-        drift_threshold = 50
-        # Fail if the drift after the rest period is higher than 10%
-        drift_threshold_after_rest = 10
-        # For now, make sure this test is executed alone
-        used_cpus = 100
+        variants:
+            - with_load:
+                type = timedrift
+                # Pin the VM and host load to CPU #0
+                cpu_mask = 0x1
+                # Set the load and rest durations
+                load_duration = 20
+                rest_duration = 20
+                # Fail if the drift after load is higher than 50%
+                drift_threshold = 50
+                # Fail if the drift after the rest period is higher than 10%
+                drift_threshold_after_rest = 10
+                # For now, make sure this test is executed alone
+                used_cpus = 100
+            - with_migration:
+                type = timedrift_with_migration
+                migration_iterations = 3
+                drift_threshold = 10
+                drift_threshold_single = 3
 
     - stress_boot:  install setup
         type = stress_boot
@@ -581,7 +588,7 @@ variants:
         extra_params += " -smp 2"
         used_cpus = 2
         stress_boot: used_cpus = 10
-        timedrift: used_cpus = 100
+        timedrift.with_load: used_cpus = 100
 
 
 variants:
client/tests/kvm/tests/timedrift_with_migration.py new file +95 -0

95 lines not on this page · raw message

Signature · 1 line
1.5.4.1
#3 lore raw

PATCH 4/7 KVM test: move the reboot code to kvm_test_utils.py

Move the reboot code from the boot test (tests/boot.py) to kvm_test_utils.py in order to make it reusable.

---
 client/tests/kvm/kvm_test_utils.py |   44 ++++++++++++++++++++++++++++++++++++
 client/tests/kvm/tests/boot.py     |   33 +++++---------------------
 2 files changed, 51 insertions(+), 26 deletions(-)
client/tests/kvm/kvm_test_utils.py +44 -0
index db9f666..4d7b1c3 100644
@@ -61,6 +61,50 @@ def wait_for_login(vm, nic_index=0, timeout=240):
     return session
 
 
+def reboot(vm, session, method="shell", sleep_before_reset=10, nic_index=0,
+           timeout=240):
+    """
+    Reboot the VM and wait for it to come back up by trying to log in until
+    timeout expires.
+
+    @param vm: VM object.
+    @param session: A shell session object.
+    @param method: Reboot method.  Can be "shell" (send a shell reboot
+            command) or "system_reset" (send a system_reset monitor command).
+    @param nic_index: Index of NIC to access in the VM, when logging in after
+            rebooting.
+    @param timeout: Time to wait before giving up (after rebooting).
+    @return: A new shell session object.
+    """
+    if method == "shell":
+        # Send a reboot command to the guest's shell
+        session.sendline(vm.get_params().get("reboot_command"))
+        logging.info("Reboot command sent; waiting for guest to go down...")
+    elif method == "system_reset":
+        # Sleep for a while before sending the command
+        time.sleep(sleep_before_reset)
+        # Send a system_reset monitor command
+        vm.send_monitor_cmd("system_reset")
+        logging.info("system_reset monitor command sent; waiting for guest to "
+                     "go down...")
+    else:
+        logging.error("Unknown reboot method: %s" % method)
+
+    # Wait for the session to become unresponsive and close it
+    if not kvm_utils.wait_for(lambda: not session.is_responsive(), 120, 0, 1):
+        raise error.TestFail("Guest refuses to go down")
+    session.close()
+
+    # Try logging into the guest until timeout expires
+    logging.info("Guest is down; waiting for it to go up again...")
+    session = kvm_utils.wait_for(lambda: vm.remote_login(nic_index=nic_index),
+                                 timeout, 0, 2)
+    if not session:
+        raise error.TestFail("Could not log into guest after reboot")
+    logging.info("Guest is up again")
+    return session
+
+
 def migrate(vm, env=None):
     """
     Migrate a VM locally and re-register it in the environment.
client/tests/kvm/tests/boot.py +7 -26
index 282efda..cd1f1d4 100644
@@ -19,33 +19,14 @@ def run_boot(test, params, env):
     session = kvm_test_utils.wait_for_login(vm)
 
     try:
-        if params.get("reboot_method") == "shell":
-            # Send a reboot command to the guest's shell
-            session.sendline(vm.get_params().get("reboot_command"))
-            logging.info("Reboot command sent; waiting for guest to go "
-                         "down...")
-        elif params.get("reboot_method") == "system_reset":
-            # Sleep for a while -- give the guest a chance to finish booting
-            time.sleep(float(params.get("sleep_before_reset", 10)))
-            # Send a system_reset monitor command
-            vm.send_monitor_cmd("system_reset")
-            logging.info("system_reset monitor command sent; waiting for "
-                         "guest to go down...")
-        else: return
+        if not params.get("reboot_method"):
+            return
 
-        # Wait for the session to become unresponsive
-        if not kvm_utils.wait_for(lambda: not session.is_responsive(),
-                                  120, 0, 1):
-            raise error.TestFail("Guest refuses to go down")
+        # Reboot the VM
+        session = kvm_test_utils.reboot(vm, session,
+                                        params.get("reboot_method"),
+                                        float(params.get("sleep_before_reset",
+                                                         10)))
 
     finally:
         session.close()
-
-    logging.info("Guest is down; waiting for it to go up again...")
-
-    session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2)
-    if not session:
-        raise error.TestFail("Could not log into guest after reboot")
-    session.close()
-
-    logging.info("Guest is up again")
Signature · 1 line
1.5.4.1
#4 lore raw

PATCH 5/7 KVM test: new test timedrift_with_reboot

Checks the time drift introduced by several reboots (default 1).

---
 client/tests/kvm/kvm_tests.cfg.sample           |    5 ++
 client/tests/kvm/tests/timedrift_with_reboot.py |   88 +++++++++++++++++++++++
 2 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/kvm/tests/timedrift_with_reboot.py
client/tests/kvm/kvm_tests.cfg.sample +5 -0
index 618c21e..e80b645 100644
@@ -120,6 +120,11 @@ variants:
                 migration_iterations = 3
                 drift_threshold = 10
                 drift_threshold_single = 3
+            - with_reboot:
+                type = timedrift_with_reboot
+                reboot_iterations = 1
+                drift_threshold = 10
+                drift_threshold_single = 3
 
     - stress_boot:  install setup
         type = stress_boot
client/tests/kvm/tests/timedrift_with_reboot.py new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
1.5.4.1
#5 lore raw

PATCH 6/7 KVM test: add option to kill all unresponsive VMs at the end of each test

This is useful for tests that may leave VMs in a bad state but can't afford to use kill_vm_on_error = yes.
For example, timedrift.with_reboot can fail because the reboot failed or because the time drift was too large. In the latter case there's no reason to kill the VM.

---
 client/tests/kvm/kvm_preprocessing.py |   12 ++++++++++++
 client/tests/kvm/kvm_tests.cfg.sample |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
client/tests/kvm/kvm_preprocessing.py +12 -0
index 26f7f8e..e624a42 100644
@@ -293,6 +293,18 @@ def postprocess(test, params, env):
                         int(params.get("post_command_timeout", "600")),
                         params.get("post_command_noncritical") == "yes")
 
+    # Kill all unresponsive VMs
+    if params.get("kill_unresponsive_vms") == "yes":
+        logging.debug("'kill_unresponsive_vms' specified; killing all VMs "
+                      "that fail to respond to a remote login request...")
+        for vm in kvm_utils.env_get_all_vms(env):
+            if vm.is_alive():
+                session = vm.remote_login()
+                if session:
+                    session.close()
+                else:
+                    vm.destroy(gracefully=False)
+
     # Kill the tailing threads of all VMs
     for vm in kvm_utils.env_get_all_vms(env):
         vm.kill_tail_thread()
client/tests/kvm/kvm_tests.cfg.sample +1 -0
index e80b645..c4d8a60 100644
@@ -13,6 +13,7 @@ convert_ppm_files_to_png_on_error = yes
 #keep_ppm_files_on_error = yes
 kill_vm = no
 kill_vm_gracefully = yes
+kill_unresponsive_vms = yes
 
 # Some default VM params
 qemu_binary = qemu
Signature · 1 line
1.5.4.1
#6 lore raw

PATCH 7/7 KVM test: kvm_preprocessing.py: fix indentation and logging messages in postprocess_vm

---
 client/tests/kvm/kvm_preprocessing.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
client/tests/kvm/kvm_preprocessing.py +6 -3
index e624a42..5bae2bd 100644
@@ -116,9 +116,12 @@ def postprocess_vm(test, params, env, name):
     vm.send_monitor_cmd("screendump %s" % scrdump_filename)
 
     if params.get("kill_vm") == "yes":
-        if not kvm_utils.wait_for(vm.is_dead,
-                float(params.get("kill_vm_timeout", 0)), 0.0, 1.0,
-                "Waiting for VM to kill itself..."):
+        kill_vm_timeout = float(params.get("kill_vm_timeout", 0))
+        if kill_vm_timeout:
+            logging.debug("'kill_vm' specified; waiting for VM to shut down "
+                          "before killing it...")
+            kvm_utils.wait_for(vm.is_dead, kill_vm_timeout, 0, 1)
+        else:
             logging.debug("'kill_vm' specified; killing VM...")
         vm.destroy(gracefully = params.get("kill_vm_gracefully") == "yes")
 
Signature · 1 line
1.5.4.1
#7 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] KVM test: new test timedrift_with_migration

In reply to Michael Goldish

Hi Michael, I am reviewing your patchset and have just a minor remark to make here:

Quoted 33 lines · Michael Goldish

This patch adds a new test that checks the timedrift introduced by migrations. It uses the same parameters used by the timedrift test to get the guest time. In addition, the number of migrations the test performs is controlled by the parameter 'migration_iterations'.

---
 client/tests/kvm/kvm_tests.cfg.sample              |   33 ++++--- client/tests/kvm/tests/timedrift_with_migration.py |   95 ++++++++++++++++++++

 2 files changed, 115 insertions(+), 13 deletions(-)

 create mode 100644 client/tests/kvm/tests/timedrift_with_migration.py

client/tests/kvm/kvm_tests.cfg.sample +0 -0
index 540d0a2..618c21e 100644
@@ -100,19 +100,26 @@ variants:

        type = linux_s3

    - timedrift:    install setup
-        type = timedrift
        extra_params += " -rtc-td-hack"
-        # Pin the VM and host load to CPU #0
-        cpu_mask = 0x1
-        # Set the load and rest durations
-        load_duration = 20
-        rest_duration = 20
-        # Fail if the drift after load is higher than 50%
-        drift_threshold = 50
-        # Fail if the drift after the rest period is higher than 10%
-        drift_threshold_after_rest = 10
-        # For now, make sure this test is executed alone
-        used_cpus = 100

Quoted 8 lines

+        variants:
+            - with_load:
+                type = timedrift
+                # Pin the VM and host load to CPU #0
+                cpu_mask = 0x1
+                # Set the load and rest durations
+                load_duration = 20
+                rest_duration = 20

Even the default duration here seems way too brief here, is there any reason why 20s was chosen instead of, let's say, 1800s? I am under the impression that 20s of load won't be enough to cause any noticeable drift...

Quoted 4 lines

+                # Fail if the drift after load is higher than 50%
+                drift_threshold = 50
+                # Fail if the drift after the rest period is higher than 10%
+                drift_threshold_after_rest = 10

I am also curious about those tresholds and the reasoning behind them. Is there any official agreement on what we consider to be an unreasonable drift?

Another thing that struck me out is drift calculation: On the original timedrift test, the guest drift is normalized against the host drift:

drift = 100.0 * (host_delta - guest_delta) / host_delta

While in the new drift tests, we consider only the guest drift. I believe is better to normalize all tests based on one drift calculation criteria, and those values should be reviewed, and at least a certain level of agreement on our development community should be reached.

Other than this concern that came to my mind, the new tests look good and work fine here. I had to do a slight rebase in one of the patches, very minor stuff. The default values and the drift calculation can be changed on a later time. Thanks!

#8 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] KVM test: new test timedrift_with_migration

Quoted 34 lines · Lucas Meneghel Rodrigues

Hi Michael, I am reviewing your patchset and have just a minor remark to make here:

Quoted 30 lines · Michael Goldish

This patch adds a new test that checks the timedrift introduced by migrations. It uses the same parameters used by the timedrift test to get the guest time. In addition, the number of migrations the test performs is controlled by the parameter 'migration_iterations'.

---
  client/tests/kvm/kvm_tests.cfg.sample              |   33 ++++---
  client/tests/kvm/tests/timedrift_with_migration.py |   95 ++++++++++++++++++++
  2 files changed, 115 insertions(+), 13 deletions(-)

create mode 100644 client/tests/kvm/tests/timedrift_with_migration.py

client/tests/kvm/kvm_tests.cfg.sample +0 -9
index 540d0a2..618c21e 100644
@@ -100,19 +100,26 @@ variants:
         type = linux_s3
 
     - timedrift:    install setup
-        type = timedrift
         extra_params += " -rtc-td-hack"
-        # Pin the VM and host load to CPU #0
-        cpu_mask = 0x1
-        # Set the load and rest durations
-        load_duration = 20
-        rest_duration = 20
-        # Fail if the drift after load is higher than 50%
-        drift_threshold = 50
-        # Fail if the drift after the rest period is higher than 10%
Quoted 8 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 108

Quoted 8 lines
client/tests/kvm/kvm_tests.cfg.sample +5 -3
-        drift_threshold_after_rest = 10
-        # For now, make sure this test is executed alone
-        used_cpus = 100
+        variants:
+            - with_load:
+                type = timedrift
+                # Pin the VM and host load to CPU #0
+                cpu_mask = 0x1

Let's use -smp 2 always.

btw: we need not to parallel the load test with standard tests.

Quoted 21 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 111

Quoted 3 lines
client/tests/kvm/kvm_tests.cfg.sample +3 -0
+                # Set the load and rest durations
+                load_duration = 20
+                rest_duration = 20

Even the default duration here seems way too brief here, is there any reason why 20s was chosen instead of, let's say, 1800s? I am under the impression that 20s of load won't be enough to cause any noticeable drift...

client/tests/kvm/kvm_tests.cfg.sample variants: · line 115

Quoted 4 lines
client/tests/kvm/kvm_tests.cfg.sample +4 -0
+                # Fail if the drift after load is higher than 50%
+                drift_threshold = 50
+                # Fail if the drift after the rest period is higher than 10%
+                drift_threshold_after_rest = 10

I am also curious about those tresholds and the reasoning behind them. Is there any official agreement on what we consider to be an unreasonable drift?

Another thing that struck me out is drift calculation: On the original timedrift test, the guest drift is normalized against the host drift:

Quoted 7 lines

drift = 100.0 * (host_delta - guest_delta) / host_delta

While in the new drift tests, we consider only the guest drift. I believe is better to normalize all tests based on one drift calculation criteria, and those values should be reviewed, and at least a certain level of agreement on our development community should be reached.

I think we don't need to calculate drift ratio. We should define a threshold in seconds, let's say 2 seconds. Beyond that, there should not be any drift.

Do we support migration to a different host? We should, especially in this test too. The destination host reading should also be used.

Apart for that, good patchset, and good thing you refactored some of the code to shared utils.

Quoted 9 lines

Other than this concern that came to my mind, the new tests look good and work fine here. I had to do a slight rebase in one of the patches, very minor stuff. The default values and the drift calculation can be changed on a later time. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] KVM test: new test timedrift_with_migration

Quoted 55 lines · ----- "Dor Laor
Quoted 1 line · Lucas Meneghel Rodrigues

Hi Michael, I am reviewing your patchset and have just a minor

remark

Quoted 3 lines

to make here:

On Wed, Oct 7, 2009 at 2:54 PM, Michael Goldish<[email protected]>

Quoted 1 line · wrote:
Quoted 1 line

This patch adds a new test that checks the timedrift introduced by

migrations.

Quoted 1 line
Quoted 1 line

It uses the same parameters used by the timedrift test to get the

guest time.

Quoted 1 line
Quoted 1 line

In addition, the number of migrations the test performs is

controlled by the

Quoted 5 lines
Quoted 5 lines

parameter 'migration_iterations'.

---
  client/tests/kvm/kvm_tests.cfg.sample              |   33

++++---

Quoted 1 line
Quoted 1 line
  client/tests/kvm/tests/timedrift_with_migration.py |   95

++++++++++++++++++++

Quoted 2 lines
Quoted 2 lines
  2 files changed, 115 insertions(+), 13 deletions(-)

create mode 100644

client/tests/kvm/tests/timedrift_with_migration.py

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/client/tests/kvm/kvm_tests.cfg.sample

Quoted 6 lines
Quoted 6 lines

index 540d0a2..618c21e 100644

client/tests/kvm/kvm_tests.cfg.sample +0 -0
@@ -100,19 +100,26 @@ variants:
         type = linux_s3
 
Quoted 11 lines

client/tests/kvm/kvm_tests.cfg.sample variants:

Quoted 11 lines
client/tests/kvm/kvm_tests.cfg.sample +0 -9
     - timedrift:    install setup
-        type = timedrift
         extra_params += " -rtc-td-hack"
-        # Pin the VM and host load to CPU #0
-        cpu_mask = 0x1
-        # Set the load and rest durations
-        load_duration = 20
-        rest_duration = 20
-        # Fail if the drift after load is higher than 50%
-        drift_threshold = 50
-        # Fail if the drift after the rest period is higher than

10%

Quoted 8 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 108

Quoted 8 lines
client/tests/kvm/kvm_tests.cfg.sample +5 -3
-        drift_threshold_after_rest = 10
-        # For now, make sure this test is executed alone
-        used_cpus = 100
+        variants:
+            - with_load:
+                type = timedrift
+                # Pin the VM and host load to CPU #0
+                cpu_mask = 0x1
Quoted 1 line

Let's use -smp 2 always.

We can also just make -smp 2 the default for all tests. Does that sound good?

Quoted 1 line

btw: we need not to parallel the load test with standard tests.

We already don't, because the load test has used_cpus = 100 which forces it to run alone.

Quoted 33 lines
Quoted 5 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 111

Quoted 3 lines
client/tests/kvm/kvm_tests.cfg.sample +3 -0
+                # Set the load and rest durations
+                load_duration = 20
+                rest_duration = 20

Even the default duration here seems way too brief here, is there

any

Quoted 1 line

reason why 20s was chosen instead of, let's say, 1800s? I am under

the

Quoted 6 lines

impression that 20s of load won't be enough to cause any noticeable drift...

Quoted 3 lines
client/tests/kvm/kvm_tests.cfg.sample +3 -0
+                # Fail if the drift after load is higher than 50%
+                drift_threshold = 50
+                # Fail if the drift after the rest period is

higher than 10%

Quoted 3 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 115

Quoted 1 line
client/tests/kvm/kvm_tests.cfg.sample +1 -0
+                drift_threshold_after_rest = 10

I am also curious about those tresholds and the reasoning behind

them.

Quoted 4 lines

Is there any official agreement on what we consider to be an unreasonable drift?

Another thing that struck me out is drift calculation: On the

original

Quoted 1 line

timedrift test, the guest drift is normalized against the host

drift:

Quoted 7 lines

drift = 100.0 * (host_delta - guest_delta) / host_delta

While in the new drift tests, we consider only the guest drift. I believe is better to normalize all tests based on one drift calculation criteria, and those values should be reviewed, and at least a certain level of agreement on our development community

Quoted 6 lines

should

Quoted 1 line

be reached.

I think we don't need to calculate drift ratio. We should define a threshold in seconds, let's say 2 seconds. Beyond that, there should not be any drift.

Are you talking about the timedrift with load or timedrift with migration or reboot tests? I was told that when running the load test for e.g 60 secs, the drift should be given in % of that duration. In the case of migration and reboot, absolute durations are used (in seconds, no %). Should we do that in the load test too?

Quoted 4 lines

Do we support migration to a different host? We should, especially in this test too. The destination host reading should also be used. Apart for that, good patchset, and good thing you refactored some of the code to shared utils.

We don't, and it would be very messy to implement with the framework right now. We should probably do that as some sort of server side test, but we don't have server side tests right now, so doing it may take a little time and effort. I got the impression that there are more important things to do at the moment, but please correct me if I'm wrong.

Quoted 12 lines
Quoted 2 lines

Other than this concern that came to my mind, the new tests look

good

Quoted 1 line

and work fine here. I had to do a slight rebase in one of the

patches,

Quoted 1 line

very minor stuff. The default values and the drift calculation can

be

Quoted 5 lines

changed on a later time. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [Autotest] [KVM-AUTOTEST PATCH 3/7] KVM test: new test timedrift_with_migration

Quoted 58 lines · Michael Goldish
Quoted 55 lines · ----- "Dor Laor
Quoted 1 line · Lucas Meneghel Rodrigues

Hi Michael, I am reviewing your patchset and have just a minor

remark

Quoted 3 lines

to make here:

On Wed, Oct 7, 2009 at 2:54 PM, Michael Goldish<[email protected]>

Quoted 1 line · wrote:
Quoted 1 line

This patch adds a new test that checks the timedrift introduced by

migrations.

Quoted 1 line
Quoted 1 line

It uses the same parameters used by the timedrift test to get the

guest time.

Quoted 1 line
Quoted 1 line

In addition, the number of migrations the test performs is

controlled by the

Quoted 5 lines
Quoted 5 lines

parameter 'migration_iterations'.

---
   client/tests/kvm/kvm_tests.cfg.sample              |   33

++++---

Quoted 1 line
Quoted 1 line
   client/tests/kvm/tests/timedrift_with_migration.py |   95

++++++++++++++++++++

Quoted 2 lines
Quoted 2 lines
   2 files changed, 115 insertions(+), 13 deletions(-)

create mode 100644

client/tests/kvm/tests/timedrift_with_migration.py

Quoted 2 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/client/tests/kvm/kvm_tests.cfg.sample

Quoted 6 lines
Quoted 6 lines

index 540d0a2..618c21e 100644

client/tests/kvm/kvm_tests.cfg.sample +0 -0
@@ -100,19 +100,26 @@ variants:
          type = linux_s3
 
Quoted 11 lines

client/tests/kvm/kvm_tests.cfg.sample variants:

Quoted 11 lines
client/tests/kvm/kvm_tests.cfg.sample +0 -9
      - timedrift:    install setup
-        type = timedrift
          extra_params += " -rtc-td-hack"
-        # Pin the VM and host load to CPU #0
-        cpu_mask = 0x1
-        # Set the load and rest durations
-        load_duration = 20
-        rest_duration = 20
-        # Fail if the drift after load is higher than 50%
-        drift_threshold = 50
-        # Fail if the drift after the rest period is higher than

10%

Quoted 8 lines
Quoted 8 lines
client/tests/kvm/kvm_tests.cfg.sample +5 -3
-        drift_threshold_after_rest = 10
-        # For now, make sure this test is executed alone
-        used_cpus = 100
+        variants:
+            - with_load:
+                type = timedrift
+                # Pin the VM and host load to CPU #0
+                cpu_mask = 0x1
Quoted 4 lines
Quoted 1 line

Let's use -smp 2 always.

We can also just make -smp 2 the default for all tests. Does that sound good?

Yes

Quoted 5 lines
Quoted 2 lines

btw: we need not to parallel the load test with standard tests.

We already don't, because the load test has used_cpus = 100 which forces it to run alone.

Soon I'll have 100 on my laptop :), better change it to -1 or MAX_INT

Quoted 41 lines
Quoted 34 lines
Quoted 6 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 111

Quoted 4 lines
client/tests/kvm/kvm_tests.cfg.sample +3 -0
+                # Set the load and rest durations
+                load_duration = 20
+                rest_duration = 20

Even the default duration here seems way too brief here, is there

any

Quoted 1 line

reason why 20s was chosen instead of, let's say, 1800s? I am under

the

Quoted 6 lines

impression that 20s of load won't be enough to cause any noticeable drift...

Quoted 3 lines
client/tests/kvm/kvm_tests.cfg.sample +3 -0
+                # Fail if the drift after load is higher than 50%
+                drift_threshold = 50
+                # Fail if the drift after the rest period is

higher than 10%

Quoted 3 lines

client/tests/kvm/kvm_tests.cfg.sample variants: · line 115

Quoted 1 line
client/tests/kvm/kvm_tests.cfg.sample +1 -0
+                drift_threshold_after_rest = 10

I am also curious about those tresholds and the reasoning behind

them.

Quoted 4 lines

Is there any official agreement on what we consider to be an unreasonable drift?

Another thing that struck me out is drift calculation: On the

original

Quoted 1 line

timedrift test, the guest drift is normalized against the host

drift:

Quoted 7 lines

drift = 100.0 * (host_delta - guest_delta) / host_delta

While in the new drift tests, we consider only the guest drift. I believe is better to normalize all tests based on one drift calculation criteria, and those values should be reviewed, and at least a certain level of agreement on our development community

Quoted 6 lines

should

Quoted 1 line

be reached.

I think we don't need to calculate drift ratio. We should define a threshold in seconds, let's say 2 seconds. Beyond that, there should not be any drift.

Quoted 5 lines

Are you talking about the timedrift with load or timedrift with migration or reboot tests? I was told that when running the load test for e.g 60 secs, the drift should be given in % of that duration. In the case of migration and reboot, absolute durations are used (in seconds, no %). Should we do that in the load test too?

Yes, but: during extreme load, we do predict that a guest *without* pv clock will drift and won't be able to catchup until the load stops and only then it will catchup. So my recommendation is to do the following:
- pvclock guest - can check with 'cat /sys/devices/system/clocksource/clocksource0/current_clocksource ' don't allow drift during huge loads.
Exist (+safe) for rhel5.4 guests and ~2.6.29 (from 2.6.27).
- non-pv clock - run the load, stop the load, wait 5 seconds, measure time

For both, use absolute times.

Quoted 11 lines
Quoted 5 lines

Do we support migration to a different host? We should, especially in this test too. The destination host reading should also be used. Apart for that, good patchset, and good thing you refactored some of the code to shared utils.

We don't, and it would be very messy to implement with the framework right now. We should probably do that as some sort of server side test, but we don't have server side tests right now, so doing it may take a little time and effort. I got the impression that there are more important things to do at the moment, but please correct me if I'm wrong.

It is needed and will help us checking migration from one physical cpu to another, different host versions and of course the time gap potential bug upon migration.

Quoted 17 lines
Quoted 13 lines
Quoted 3 lines

Other than this concern that came to my mind, the new tests look

good

Quoted 1 line

and work fine here. I had to do a slight rebase in one of the

patches,

Quoted 1 line

very minor stuff. The default values and the drift calculation can

be

Quoted 5 lines

changed on a later time. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html