From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lucas Meneghel Rodrigues Subject: Re: [KVM-AUTOTEST PATCH 6/8] Choose a monitor filename in the constructor of VM class Date: Mon, 08 Jun 2009 12:19:33 -0300 Message-ID: <1244474373.2849.62.camel@localhost.localdomain> References: <1244433717-3391-1-git-send-email-lmr@redhat.com> <1244433717-3391-2-git-send-email-lmr@redhat.com> <1244433717-3391-3-git-send-email-lmr@redhat.com> <1244433717-3391-4-git-send-email-lmr@redhat.com> <1244433717-3391-5-git-send-email-lmr@redhat.com> <1244433717-3391-6-git-send-email-lmr@redhat.com> <1244433717-3391-7-git-send-email-lmr@redhat.com> <1244433717-3391-8-git-send-email-lmr@redhat.com> <1244433717-3391-9-git-send-email-lmr@redhat.com> <1244433717-3391-10-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Michael Goldish To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:48657 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754768AbZFHPTf (ORCPT ); Mon, 8 Jun 2009 11:19:35 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n58FJbgg008851 for ; Mon, 8 Jun 2009 11:19:37 -0400 In-Reply-To: <1244433717-3391-10-git-send-email-lmr@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2009-06-08 at 01:01 -0300, Lucas Meneghel Rodrigues wrote: > 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(). Applied. > Risk: Low (comprehensible change, just moving a block of code). > Visibility: Small (users of kvm test). > > Signed-off-by: Michael Goldish > --- > 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)) -- Lucas Meneghel Rodrigues Software Engineer (QE) Red Hat - Emerging Technologies