From bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 Mon Sep 17 00:00:00 2001 From: RajithaY Date: Tue, 25 Apr 2017 03:31:15 -0700 Subject: Adding qemu as a submodule of KVMFORNFV This Patch includes the changes to add qemu as a submodule to kvmfornfv repo and make use of the updated latest qemu for the execution of all testcase Change-Id: I1280af507a857675c7f81d30c95255635667bdd7 Signed-off-by:RajithaY --- qemu/tests/qemu-iotests/qed.py | 235 ----------------------------------------- 1 file changed, 235 deletions(-) delete mode 100755 qemu/tests/qemu-iotests/qed.py (limited to 'qemu/tests/qemu-iotests/qed.py') diff --git a/qemu/tests/qemu-iotests/qed.py b/qemu/tests/qemu-iotests/qed.py deleted file mode 100755 index 748068d7f..000000000 --- a/qemu/tests/qemu-iotests/qed.py +++ /dev/null @@ -1,235 +0,0 @@ -#!/usr/bin/env python -# -# Tool to manipulate QED image files -# -# Copyright (C) 2010 IBM, Corp. -# -# Authors: -# Stefan Hajnoczi -# -# This work is licensed under the terms of the GNU GPL, version 2 or later. -# See the COPYING file in the top-level directory. - -import sys -import struct -import random -import optparse - -# This can be used as a module -__all__ = ['QED_F_NEED_CHECK', 'QED'] - -QED_F_NEED_CHECK = 0x02 - -header_fmt = ']- Show header or l1/l2 tables''' - if not args or args[0] == 'header': - print qed.header - elif args[0] == 'l1': - print qed.l1_table - elif len(args) == 2 and args[0] == 'l2': - offset = int(args[1]) - print qed.read_table(offset) - else: - err('unrecognized sub-command') - -def cmd_duplicate(qed, table_level): - '''duplicate l1|l2 - Duplicate a random table element''' - if table_level == 'l1': - offset = qed.header['l1_table_offset'] - table = qed.l1_table - elif table_level == 'l2': - _, offset = random_table_item(qed.l1_table) - table = qed.read_table(offset) - else: - err('unrecognized sub-command') - corrupt_table_duplicate(table) - qed.write_table(offset, table) - -def cmd_invalidate(qed, table_level): - '''invalidate l1|l2 - Plant an invalid table element at random''' - if table_level == 'l1': - offset = qed.header['l1_table_offset'] - table = qed.l1_table - elif table_level == 'l2': - _, offset = random_table_item(qed.l1_table) - table = qed.read_table(offset) - else: - err('unrecognized sub-command') - corrupt_table_invalidate(qed, table) - qed.write_table(offset, table) - -def cmd_need_check(qed, *args): - '''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit''' - if not args: - print bool(qed.header['features'] & QED_F_NEED_CHECK) - return - - if args[0] == 'on': - qed.header['features'] |= QED_F_NEED_CHECK - elif args[0] == 'off': - qed.header['features'] &= ~QED_F_NEED_CHECK - else: - err('unrecognized sub-command') - qed.store_header() - -def cmd_zero_cluster(qed, pos, *args): - '''zero-cluster [] - Zero data clusters''' - pos, n = int(pos), 1 - if args: - if len(args) != 1: - err('expected one argument') - n = int(args[0]) - - for i in xrange(n): - l1_index = pos / qed.header['cluster_size'] / len(qed.l1_table) - if qed.l1_table[l1_index] == 0: - err('no l2 table allocated') - - l2_offset = qed.l1_table[l1_index] - l2_table = qed.read_table(l2_offset) - - l2_index = (pos / qed.header['cluster_size']) % len(qed.l1_table) - l2_table[l2_index] = 1 # zero the data cluster - qed.write_table(l2_offset, l2_table) - pos += qed.header['cluster_size'] - -def cmd_copy_metadata(qed, outfile): - '''copy-metadata - Copy metadata only (for scrubbing corrupted images)''' - out = open(outfile, 'wb') - - # Match file size - out.seek(qed.filesize - 1) - out.write('\0') - - # Copy header clusters - out.seek(0) - header_size_bytes = qed.header['header_size'] * qed.header['cluster_size'] - out.write(qed.raw_pread(0, header_size_bytes)) - - # Copy L1 table - out.seek(qed.header['l1_table_offset']) - s = ''.join(pack_table_elem(x) for x in qed.l1_table) - out.write(s) - - # Copy L2 tables - for l2_offset in qed.l1_table: - if l2_offset == 0: - continue - l2_table = qed.read_table(l2_offset) - out.seek(l2_offset) - s = ''.join(pack_table_elem(x) for x in l2_table) - out.write(s) - - out.close() - -def usage(): - print 'Usage: %s [, ...]' % sys.argv[0] - print - print 'Supported commands:' - for cmd in sorted(x for x in globals() if x.startswith('cmd_')): - print globals()[cmd].__doc__ - sys.exit(1) - -def main(): - if len(sys.argv) < 3: - usage() - filename, cmd = sys.argv[1:3] - - cmd = 'cmd_' + cmd.replace('-', '_') - if cmd not in globals(): - usage() - - qed = QED(open(filename, 'r+b')) - try: - globals()[cmd](qed, *sys.argv[3:]) - except TypeError as e: - sys.stderr.write(globals()[cmd].__doc__ + '\n') - sys.exit(1) - -if __name__ == '__main__': - main() -- cgit 1.2.3-korg