public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 3/3] KVM test: Removing scripts/check_image.py
Date: Tue, 18 Jan 2011 21:45:53 -0200	[thread overview]
Message-ID: <1295394353-11688-4-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1295394353-11688-1-git-send-email-lmr@redhat.com>

As its functionality was implemented as part of the
framework on previous patches.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/tests/kvm/scripts/check_image.py |   99 -------------------------------
 1 files changed, 0 insertions(+), 99 deletions(-)
 delete mode 100644 client/tests/kvm/scripts/check_image.py

diff --git a/client/tests/kvm/scripts/check_image.py b/client/tests/kvm/scripts/check_image.py
deleted file mode 100644
index 2b5c227..0000000
--- a/client/tests/kvm/scripts/check_image.py
+++ /dev/null
@@ -1,99 +0,0 @@
-import os, sys, commands
-
-
-class ImageCheckError(Exception):
-    """
-    Simple wrapper for the builtin Exception class.
-    """
-    pass
-
-
-class ImageCheck(object):
-    """
-    Check qcow2 image by qemu-img info/check command.
-    """
-    def __init__(self):
-        """
-        Gets params from environment variables and sets class attributes.
-        """
-        self.image_path_list = []
-        client_dir =  os.environ['AUTODIR']
-        self.kvm_dir = os.path.join(client_dir, 'tests/kvm')
-        img_to_check = os.environ['KVM_TEST_images'].split()
-
-        for img in img_to_check:
-            img_name_str = "KVM_TEST_image_name_%s" % img
-            if not os.environ.has_key(img_name_str):
-                img_name_str = "KVM_TEST_image_name"
-            img_format_str = "KVM_TEST_image_format_%s" % img
-            if os.environ.has_key(img_format_str):
-                image_format = os.environ[img_format_str]
-            else:
-                image_format = os.environ['KVM_TEST_image_format']
-            if image_format != "qcow2":
-                continue
-            image_name = os.environ[img_name_str]
-            image_filename = "%s.%s" % (image_name, image_format)
-            image_filename = os.path.join(self.kvm_dir, image_filename)
-            self.image_path_list.append(image_filename)
-        if os.environ.has_key('KVM_TEST_qemu_img_binary'):
-            self.qemu_img_path = os.environ['KVM_TEST_qemu_img_binary']
-        else:
-            self.qemu_img_path = os.path.join(self.kvm_dir, 'qemu-img')
-        self.qemu_img_check = True
-        cmd = "%s |grep check" % self.qemu_img_path
-        (s1, output) = commands.getstatusoutput(cmd)
-        if s1:
-            self.qemu_img_check = False
-            print "Command qemu-img check not available, not checking..."
-        cmd = "%s |grep info" % self.qemu_img_path
-        (s2, output) = commands.getstatusoutput(cmd)
-        if s2:
-            self.qemu_img_check = False
-            print "Command qemu-img info not available, not checking..."
-
-    def exec_img_cmd(self, cmd_type, image_path):
-        """
-        Run qemu-img info/check on given image.
-
-        @param cmd_type: Sub command used together with qemu.
-        @param image_path: Real path of the image.
-        """
-        cmd = ' '.join([self.qemu_img_path, cmd_type, image_path])
-        print "Checking image with command %s" % cmd
-        (status, output) = commands.getstatusoutput(cmd)
-        print output
-        if status or (cmd_type == "check" and not "No errors" in output):
-            msg = "Command %s failed" % cmd
-            return False, msg
-        else:
-            return True, ''
-
-
-    def check_image(self):
-        """
-        Run qemu-img info/check to check the image in list.
-
-        If the image checking is failed, raise an exception.
-        """
-        # Check all the image in list.
-        errmsg = []
-        for image_path in self.image_path_list:
-            if not os.path.exists(image_path):
-                print "Image %s does not exist!" % image_path
-                continue
-            s, o = self.exec_img_cmd('info', image_path)
-            if not s:
-                errmsg.append(o)
-            s, o = self.exec_img_cmd('check', image_path)
-            if not s:
-                errmsg.append(o)
-
-        if len(errmsg) > 0:
-            raise ImageCheckError('Errors were found, please check log!')
-
-
-if __name__ == "__main__":
-    image_check = ImageCheck()
-    if image_check.qemu_img_check:
-        image_check.check_image()
-- 
1.7.3.4

      parent reply	other threads:[~2011-01-18 23:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18 23:45 [PATCH 0/3] Removing scripts/check_image.py Lucas Meneghel Rodrigues
2011-01-18 23:45 ` [PATCH 1/3] KVM test: Introduce check_image postprocess directive Lucas Meneghel Rodrigues
2011-01-18 23:58   ` Amos Kong
2011-01-19  5:56   ` Michael Goldish
2011-01-18 23:45 ` [PATCH 2/3] KVM test: Modify enospc test to not require scripts/check_image.py Lucas Meneghel Rodrigues
2011-01-19  6:05   ` [Autotest] " Michael Goldish
2011-01-18 23:45 ` Lucas Meneghel Rodrigues [this message]

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=1295394353-11688-4-git-send-email-lmr@redhat.com \
    --to=lmr@redhat.com \
    --cc=autotest@test.kernel.org \
    --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