From: Lucas Meneghel Rodrigues <lmr@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH 6/6] KVM test: Removing enospc pre and post scripts
Date: Fri, 21 Jan 2011 23:30:50 -0200 [thread overview]
Message-ID: <1295659850-29609-6-git-send-email-lmr@redhat.com> (raw)
In-Reply-To: <1295659850-29609-1-git-send-email-lmr@redhat.com>
As their functionality has been reimplemented as
framework functionality
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
client/tests/kvm/scripts/enospc-post.py | 77 -------------------------------
client/tests/kvm/scripts/enospc-pre.py | 73 -----------------------------
2 files changed, 0 insertions(+), 150 deletions(-)
delete mode 100755 client/tests/kvm/scripts/enospc-post.py
delete mode 100755 client/tests/kvm/scripts/enospc-pre.py
diff --git a/client/tests/kvm/scripts/enospc-post.py b/client/tests/kvm/scripts/enospc-post.py
deleted file mode 100755
index c6714f2..0000000
--- a/client/tests/kvm/scripts/enospc-post.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python
-"""
-Simple script to setup enospc test environment
-"""
-import os, commands, sys
-
-SCRIPT_DIR = os.path.dirname(sys.modules[__name__].__file__)
-KVM_TEST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
-
-class SetupError(Exception):
- """
- Simple wrapper for the builtin Exception class.
- """
- pass
-
-
-def find_command(cmd):
- """
- Searches for a command on common paths, error if it can't find it.
-
- @param cmd: Command to be found.
- """
- if os.path.exists(cmd):
- return cmd
- for dir in ["/usr/local/sbin", "/usr/local/bin",
- "/usr/sbin", "/usr/bin", "/sbin", "/bin"]:
- file = os.path.join(dir, cmd)
- if os.path.exists(file):
- return file
- raise ValueError('Missing command: %s' % cmd)
-
-
-def run(cmd, info=None):
- """
- Run a command and throw an exception if it fails.
- Optionally, you can provide additional contextual info.
-
- @param cmd: Command string.
- @param reason: Optional string that explains the context of the failure.
-
- @raise: SetupError if command fails.
- """
- print "Running '%s'" % cmd
- cmd_name = cmd.split(' ')[0]
- find_command(cmd_name)
- status, output = commands.getstatusoutput(cmd)
- if status:
- e_msg = ('Command %s failed.\nStatus:%s\nOutput:%s' %
- (cmd, status, output))
- if info is not None:
- e_msg += '\nAdditional Info:%s' % info
- raise SetupError(e_msg)
-
- return (status, output)
-
-
-if __name__ == "__main__":
- qemu_img_binary = os.environ['KVM_TEST_qemu_img_binary']
- if not os.path.isabs(qemu_img_binary):
- qemu_img_binary = os.path.join(KVM_TEST_DIR, qemu_img_binary)
- if not os.path.exists(qemu_img_binary):
- raise SetupError('The qemu-img binary that is supposed to be used '
- '(%s) does not exist. Please verify your '
- 'configuration' % qemu_img_binary)
-
- run("lvremove -f vgtest")
- status, output = run("losetup -a")
- loopback_device = None
- if output:
- for line in output.splitlines():
- device = line.split(":")[0]
- if "/tmp/enospc.raw" in line:
- loopback_device = device
- break
- if loopback_device is not None:
- run("losetup -d %s" % loopback_device)
- run("rm -rf /tmp/enospc.raw /tmp/kvm_autotest_root/images/enospc.qcow2")
diff --git a/client/tests/kvm/scripts/enospc-pre.py b/client/tests/kvm/scripts/enospc-pre.py
deleted file mode 100755
index 1313de3..0000000
--- a/client/tests/kvm/scripts/enospc-pre.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-"""
-Simple script to setup enospc test environment
-"""
-import os, commands, sys
-
-SCRIPT_DIR = os.path.dirname(sys.modules[__name__].__file__)
-KVM_TEST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
-
-class SetupError(Exception):
- """
- Simple wrapper for the builtin Exception class.
- """
- pass
-
-
-def find_command(cmd):
- """
- Searches for a command on common paths, error if it can't find it.
-
- @param cmd: Command to be found.
- """
- if os.path.exists(cmd):
- return cmd
- for dir in ["/usr/local/sbin", "/usr/local/bin",
- "/usr/sbin", "/usr/bin", "/sbin", "/bin"]:
- file = os.path.join(dir, cmd)
- if os.path.exists(file):
- return file
- raise ValueError('Missing command: %s' % cmd)
-
-
-def run(cmd, info=None):
- """
- Run a command and throw an exception if it fails.
- Optionally, you can provide additional contextual info.
-
- @param cmd: Command string.
- @param reason: Optional string that explains the context of the failure.
-
- @raise: SetupError if command fails.
- """
- print "Running '%s'" % cmd
- cmd_name = cmd.split(' ')[0]
- find_command(cmd_name)
- status, output = commands.getstatusoutput(cmd)
- if status:
- e_msg = ('Command %s failed.\nStatus:%s\nOutput:%s' %
- (cmd, status, output))
- if info is not None:
- e_msg += '\nAdditional Info:%s' % info
- raise SetupError(e_msg)
-
- return (status, output.strip())
-
-
-if __name__ == "__main__":
- qemu_img_binary = os.environ['KVM_TEST_qemu_img_binary']
- if not os.path.isabs(qemu_img_binary):
- qemu_img_binary = os.path.join(KVM_TEST_DIR, qemu_img_binary)
- if not os.path.exists(qemu_img_binary):
- raise SetupError('The qemu-img binary that is supposed to be used '
- '(%s) does not exist. Please verify your '
- 'configuration' % qemu_img_binary)
-
- run("%s create -f raw /tmp/enospc.raw 10G" % qemu_img_binary)
- status, loopback_device = run("losetup -f")
- run("losetup -f /tmp/enospc.raw")
- run("pvcreate %s" % loopback_device)
- run("vgcreate vgtest %s" % loopback_device)
- run("lvcreate -L200M -n lvtest vgtest")
- run("%s create -f qcow2 /dev/vgtest/lvtest 10G" % qemu_img_binary)
- run("ln -s /dev/vgtest/lvtest /tmp/kvm_autotest_root/images/enospc.qcow2")
--
1.7.3.4
prev parent reply other threads:[~2011-01-22 1:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 1:30 [PATCH 1/6] KVM test: Introducing test_setup library Lucas Meneghel Rodrigues
2011-01-22 1:30 ` [PATCH 2/6] KVM test: Make unattended _install use the new pre script Lucas Meneghel Rodrigues
2011-01-22 1:30 ` [PATCH 3/6] KVM test: Removing scripts/unattended.py Lucas Meneghel Rodrigues
2011-01-22 1:30 ` [PATCH 4/6] KVM config: Move HugePageConfig() to test_setup Lucas Meneghel Rodrigues
2011-01-22 1:30 ` [PATCH 5/6] KVM test: Turn enospc test pre/post actions into infrastructure Lucas Meneghel Rodrigues
2011-01-22 1:30 ` 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=1295659850-29609-6-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