[KVM-AUTOTEST PATCH 6/8] Choose a monitor filename in the constructor of VM class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Risk: Low (comprehensible change, just moving a block of code).
Visibility: Small (users of kvm test).

Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx>
---
 client/tests/kvm/kvm_vm.py |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 76b0251..3001648 100644
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -115,6 +115,17 @@ class VM:
         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. If .pid
@@ -297,16 +308,6 @@ class VM:
                     logging.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.6.2.2

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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux