From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Michael Goldish <mgoldish@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [KVM-AUTOTEST PATCH] Use new function VM.get_name() to get the VM's name, instead of VM.name
Date: Wed, 03 Jun 2009 20:26:38 -0300 [thread overview]
Message-ID: <1244071598.2901.10.camel@localhost.localdomain> (raw)
In-Reply-To: <615550170.1060071244005307909.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com>
On Wed, 2009-06-03 at 01:01 -0400, Michael Goldish wrote:
> ----- "Lucas Meneghel Rodrigues" <lmr@redhat.com> wrote:
>
> > On Sun, 2009-05-24 at 18:46 +0300, Michael Goldish wrote:
> > > kvm_vm.py: add function VM.get_name().
> > > kvm_preprocessing.py: use VM.get_name() instead of directly
> > accessing the .name
> > > attribute.
> >
> > Are there any advantages of creating this method over directly
> > accessing
> > the attribute?
>
> Not really, it's just that everywhere else we use "get" interface
> functions and I like to be consistent. I also thought it was good
> OOP practice to make the interface independent of the internal
> implementation. For example, we may choose not to store the name
> attribute in the class instance, but rather retrieve it or generate
> it (if it gets more complex) from the params upon request.
Fair enough, now that you've put it that way I agree with you.
> > > Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> > > ---
> > > client/tests/kvm_runtest_2/kvm_preprocessing.py | 6 +++---
> > > client/tests/kvm_runtest_2/kvm_vm.py | 4 ++++
> > > 2 files changed, 7 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/client/tests/kvm_runtest_2/kvm_preprocessing.py
> > b/client/tests/kvm_runtest_2/kvm_preprocessing.py
> > > index c9eb35d..bcabf5a 100644
> > > --- a/client/tests/kvm_runtest_2/kvm_preprocessing.py
> > > +++ b/client/tests/kvm_runtest_2/kvm_preprocessing.py
> > > @@ -178,7 +178,7 @@ def preprocess(test, params, env):
> > > if vm.is_dead():
> > > continue
> > > if not vm.verify_process_identity():
> > > - kvm_log.debug("VM '%s' seems to have been replaced by
> > another process" % vm.name)
> > > + kvm_log.debug("VM '%s' seems to have been replaced by
> > another process" % vm.get_name())
> > > vm.pid = None
> > >
> > > # Destroy and remove VMs that are no longer needed in the
> > environment
> > > @@ -187,8 +187,8 @@ def preprocess(test, params, env):
> > > vm = env[key]
> > > if not kvm_utils.is_vm(vm):
> > > continue
> > > - if not vm.name in requested_vms:
> > > - kvm_log.debug("VM '%s' found in environment but not
> > required for test; removing it..." % vm.name)
> > > + if not vm.get_name() in requested_vms:
> > > + kvm_log.debug("VM '%s' found in environment but not
> > required for test; removing it..." % vm.get_name())
> > > vm.destroy()
> > > del env[key]
> > >
> > > diff --git a/client/tests/kvm_runtest_2/kvm_vm.py
> > b/client/tests/kvm_runtest_2/kvm_vm.py
> > > index fab839f..df99859 100644
> > > --- a/client/tests/kvm_runtest_2/kvm_vm.py
> > > +++ b/client/tests/kvm_runtest_2/kvm_vm.py
> > > @@ -454,6 +454,10 @@ class VM:
> > > """Return True iff the VM's PID does not exist."""
> > > return not kvm_utils.pid_exists(self.pid)
> > >
> > > + def get_name(self):
> > > + """Return the VM's name."""
> > > + return self.name
> > > +
> > > def get_params(self):
> > > """Return the VM's params dict.
> > >
> > --
> > Lucas Meneghel Rodrigues
> > Software Engineer (QE)
> > Red Hat - Emerging Technologies
--
Lucas Meneghel Rodrigues
Software Engineer (QE)
Red Hat - Emerging Technologies
next prev parent reply other threads:[~2009-06-03 23:32 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-24 15:46 [KVM-AUTOTEST PATCH] RHEL-4.7 step files: fix the initial boot barriers Michael Goldish
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] RHEL-5.3 step files: fix initial boot barriers and an inconsistent dialog Michael Goldish
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] WinXP step files: add an optional barrier to deal with a closed start menu Michael Goldish
2009-05-24 19:31 ` sudhir kumar
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] stepeditor.py: get rid of some annoying keyboard shortcuts Michael Goldish
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] Use new function VM.get_name() to get the VM's name, instead of VM.name Michael Goldish
2009-05-28 13:06 ` Lucas Meneghel Rodrigues
2009-06-03 5:01 ` Michael Goldish
2009-06-03 23:26 ` Lucas Meneghel Rodrigues [this message]
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] VM.create(): always destroy() the VM before attempting to start it Michael Goldish
2009-05-28 14:17 ` Lucas Meneghel Rodrigues
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_vm.py: choose a monitor filename in the constructor instead of VM.create() Michael Goldish
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_vm.py: make sure the bulk of VM.create() is not executed in parallel Michael Goldish
2009-05-24 19:25 ` sudhir kumar
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_vm.py: add new function VM.clone() which returns a clone of the VM Michael Goldish
2009-05-25 12:01 ` Avi Kivity
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_utils.py: remote_login(): improve regular expression matching Michael Goldish
2009-05-24 18:59 ` sudhir kumar
2009-05-29 6:12 ` Lucas Meneghel Rodrigues
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_vm.py: add new VM parameter 'x11_display' that controls $DISPLAY Michael Goldish
2009-05-28 13:26 ` Lucas Meneghel Rodrigues
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_runtest_2.py: use environment filename specified by the 'env' parameter Michael Goldish
2009-05-24 19:03 ` sudhir kumar
2009-05-28 13:26 ` Lucas Meneghel Rodrigues
2009-05-24 15:46 ` [KVM-AUTOTEST PATCH] kvm_runtest_2.py: use pickle instead of shelve when loading/saving env Michael Goldish
2009-05-28 13:26 ` 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=1244071598.2901.10.camel@localhost.localdomain \
--to=lmr@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mgoldish@redhat.com \
/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