public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Goldish <mgoldish@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org
Cc: Eduardo Habkost <ehabkost@raisama.net>
Subject: [KVM-AUTOTEST PATCH 2/4] KVM test: use kvm_utils.Env wherever appropriate
Date: Tue, 28 Dec 2010 17:43:08 +0200	[thread overview]
Message-ID: <1293550990-10669-3-git-send-email-mgoldish@redhat.com> (raw)
In-Reply-To: <1293550990-10669-1-git-send-email-mgoldish@redhat.com>

The new Env object is backward compatible with the regular env dict, so
all the kvm_utils.env_*() functions should work as usual.

Signed-off-by: Eduardo Habkost <ehabkost@raisama.net>
---
 client/tests/kvm/kvm.py           |   10 +++++-----
 client/tests/kvm/kvm_scheduler.py |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/client/tests/kvm/kvm.py b/client/tests/kvm/kvm.py
index ceee88f..9d942d3 100644
--- a/client/tests/kvm/kvm.py
+++ b/client/tests/kvm/kvm.py
@@ -43,7 +43,7 @@ class kvm(test.test):
         logging.info("Unpickling env. You may see some harmless error "
                      "messages.")
         env_filename = os.path.join(self.bindir, params.get("env", "env"))
-        env = kvm_utils.load_env(env_filename, self.env_version)
+        env = kvm_utils.Env(env_filename, self.env_version)
 
         test_passed = False
 
@@ -68,13 +68,13 @@ class kvm(test.test):
                     try:
                         kvm_preprocessing.preprocess(self, params, env)
                     finally:
-                        kvm_utils.dump_env(env, env_filename)
+                        env.save()
                     # Run the test function
                     run_func = getattr(test_module, "run_%s" % t_type)
                     try:
                         run_func(self, params, env)
                     finally:
-                        kvm_utils.dump_env(env, env_filename)
+                        env.save()
                     test_passed = True
 
                 except Exception, e:
@@ -85,7 +85,7 @@ class kvm(test.test):
                         kvm_preprocessing.postprocess_on_error(
                             self, params, env)
                     finally:
-                        kvm_utils.dump_env(env, env_filename)
+                        env.save()
                     raise
 
             finally:
@@ -99,7 +99,7 @@ class kvm(test.test):
                         logging.error("Exception raised during "
                                       "postprocessing: %s", e)
                 finally:
-                    kvm_utils.dump_env(env, env_filename)
+                    env.save()
 
         except Exception, e:
             if params.get("abort_on_error") != "yes":
diff --git a/client/tests/kvm/kvm_scheduler.py b/client/tests/kvm/kvm_scheduler.py
index aa581ad..95282e4 100644
--- a/client/tests/kvm/kvm_scheduler.py
+++ b/client/tests/kvm/kvm_scheduler.py
@@ -74,13 +74,13 @@ class scheduler:
             # The scheduler wants this worker to free its used resources
             elif cmd[0] == "cleanup":
                 env_filename = os.path.join(self.bindir, self_dict["env"])
-                env = kvm_utils.load_env(env_filename, {})
+                env = kvm_utils.Env(env_filename)
                 for obj in env.values():
                     if isinstance(obj, kvm_vm.VM):
                         obj.destroy()
                     elif isinstance(obj, kvm_subprocess.Spawn):
                         obj.close()
-                kvm_utils.dump_env(env, env_filename)
+                env.save()
                 w.write("cleanup_done\n")
                 w.write("ready\n")
 
-- 
1.7.3.4

  parent reply	other threads:[~2010-12-28 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 15:43 [KVM-AUTOTEST PATCH 0/4] KVM test: replace 'env' dict with an Env object Michael Goldish
2010-12-28 15:43 ` [KVM-AUTOTEST PATCH 1/4] KVM test: introduce the Env class Michael Goldish
2010-12-28 15:43 ` Michael Goldish [this message]
2010-12-28 15:43 ` [KVM-AUTOTEST PATCH 3/4] KVM test: use the new Env methods instead of the old env_* functions Michael Goldish
2010-12-28 15:43 ` [KVM-AUTOTEST PATCH 4/4] KVM test: get rid of the kvm_utils.env_* functions Michael Goldish
2010-12-28 15:49 ` [KVM-AUTOTEST PATCH 0/4] KVM test: replace 'env' dict with an Env object Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1293550990-10669-3-git-send-email-mgoldish@redhat.com \
    --to=mgoldish@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=ehabkost@raisama.net \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox