kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [Autotest] [PATCH 1/3] KVM test: Use customized command to get the version of kvm and its
Date: Thu, 6 May 2010 14:16:45 -0300	[thread overview]
Message-ID: <m2p6ac58f4f1005061016xa66ab257o1dd3ecef96fbe41f@mail.gmail.com> (raw)
In-Reply-To: <20100426100726.26501.73186.stgit@localhost.localdomain>

On Mon, Apr 26, 2010 at 7:07 AM, Jason Wang <jasowang@redhat.com> wrote:
> userspace
>
> Current method may or may not work for various kinds of
> distribution. So this patch enable the ability to use customized
> commands to get the version of kvm and its userspace. "kvm_ver_cmd" is
> used for kvm verison and "kvm_userspace_ver_cmd" is for its userspace.

The method we are currently using is pretty satisfactory - if we fail
in getting /sys/module/kvm/version we use the kernel version as a
fallback, which is good for the kernel module. For qemu, we make a
regular expression searching for numbers following the string version,
so I don't see a reason on why we should make it configurable. Care to
provide an example of a situation where the current method fails?

> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  client/tests/kvm/kvm_preprocessing.py |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/client/tests/kvm/kvm_preprocessing.py b/client/tests/kvm/kvm_preprocessing.py
> index 4b9290c..16200ab 100644
> --- a/client/tests/kvm/kvm_preprocessing.py
> +++ b/client/tests/kvm/kvm_preprocessing.py
> @@ -225,10 +225,10 @@ def preprocess(test, params, env):
>     # Get the KVM kernel module version and write it as a keyval
>     logging.debug("Fetching KVM module version...")
>     if os.path.exists("/dev/kvm"):
> -        try:
> -            kvm_version = open("/sys/module/kvm/version").read().strip()
> -        except:
> -            kvm_version = os.uname()[2]
> +        kvm_ver_cmd = params.get("kvm_ver_cmd", "cat /sys/module/kvm/version")
> +        s, kvm_version = commands.getstatusoutput(kvm_ver_cmd)
> +        if s != 0:
> +            kvm_version = "Unknown"
>     else:
>         kvm_version = "Unknown"
>         logging.debug("KVM module not loaded")
> @@ -239,11 +239,11 @@ def preprocess(test, params, env):
>     logging.debug("Fetching KVM userspace version...")
>     qemu_path = kvm_utils.get_path(test.bindir, params.get("qemu_binary",
>                                                            "qemu"))
> -    version_line = commands.getoutput("%s -help | head -n 1" % qemu_path)
> -    matches = re.findall("[Vv]ersion .*?,", version_line)
> -    if matches:
> -        kvm_userspace_version = " ".join(matches[0].split()[1:]).strip(",")
> -    else:
> +    def_qemu_ver_cmd = "%s -help | head -n 1 | awk '{ print $5}'" % qemu_path
> +    kvm_userspace_ver_cmd = params.get("kvm_userspace_ver_cmd",
> +                                       def_qemu_ver_cmd)
> +    s, kvm_userspace_version = commands.getstatusoutput(kvm_userspace_ver_cmd)
> +    if s != 0:
>         kvm_userspace_version = "Unknown"
>         logging.debug("Could not fetch KVM userspace version")
>     logging.debug("KVM userspace version: %s" % kvm_userspace_version)
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>



-- 
Lucas

  parent reply	other threads:[~2010-05-06 17:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 10:07 [PATCH 1/3] KVM test: Use customized command to get the version of kvm and its Jason Wang
2010-04-26 10:07 ` [PATCH 2/3] KVM test: Create ksm scanner through pre_command Jason Wang
2010-05-06 17:05   ` [Autotest] " Lucas Meneghel Rodrigues
2010-04-26 10:07 ` [PATCH 3/3] KVM test: Remove the duplicated KERNEL paramters in the pxe configuration file Jason Wang
2010-05-06 17:01   ` [Autotest] " Lucas Meneghel Rodrigues
2010-05-06 17:16 ` Lucas Meneghel Rodrigues [this message]
2010-05-07 10:10   ` [Autotest] [PATCH 1/3] KVM test: Use customized command to get the version of kvm and its Jason Wang
2010-05-07 12:17     ` 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=m2p6ac58f4f1005061016xa66ab257o1dd3ecef96fbe41f@mail.gmail.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=jasowang@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).