This will reduce the number of monitor files left in /tmp, because the
constructor is called fewer times than VM.create().

Signed-off-by: Michael Goldish <mgold...@redhat.com>
---
 client/tests/kvm_runtest_2/kvm_vm.py |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/client/tests/kvm_runtest_2/kvm_vm.py 
b/client/tests/kvm_runtest_2/kvm_vm.py
index a1462c6..3ce2003 100644
--- a/client/tests/kvm_runtest_2/kvm_vm.py
+++ b/client/tests/kvm_runtest_2/kvm_vm.py
@@ -106,6 +106,14 @@ class VM:
         self.image_dir = image_dir
         self.iso_dir = iso_dir
 
+        # Find available monitor filename
+        while True:
+            # The monitor filename should be unique
+            self.instance = time.strftime("%Y%m%d-%H%M%S-") + 
kvm_utils.generate_random_string(4)
+            self.monitor_file_name = os.path.join("/tmp", "monitor-" + 
self.instance)
+            if not os.path.exists(self.monitor_file_name):
+                break
+
     def verify_process_identity(self):
         """Make sure .pid really points to the original qemu process.
 
@@ -281,14 +289,6 @@ class VM:
                     kvm_log.error("Actual MD5 sum differs from expected one")
                     return False
 
-        # Find available monitor filename
-        while True:
-            # The monitor filename should be unique
-            self.instance = time.strftime("%Y%m%d-%H%M%S-") + 
kvm_utils.generate_random_string(4)
-            self.monitor_file_name = os.path.join("/tmp", "monitor-" + 
self.instance)
-            if not os.path.exists(self.monitor_file_name):
-                break
-
         # Handle port redirections
         redir_names = kvm_utils.get_sub_dict_names(params, "redirs")
         host_ports = kvm_utils.find_free_ports(5000, 6000, len(redir_names))
-- 
1.5.4.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

Reply via email to