From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbuEq-0003RB-5j for qemu-devel@nongnu.org; Mon, 13 May 2013 11:01:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbuEE-0000v9-OV for qemu-devel@nongnu.org; Mon, 13 May 2013 11:00:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbuEE-0000ue-Fo for qemu-devel@nongnu.org; Mon, 13 May 2013 10:59:54 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4DExqCa013347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 May 2013 10:59:53 -0400 Date: Mon, 13 May 2013 16:59:51 +0200 From: Stefan Hajnoczi Message-ID: <20130513145951.GB27673@stefanha-thinkpad.redhat.com> References: <1368452576-32262-1-git-send-email-kwolf@redhat.com> <1368452576-32262-3-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1368452576-32262-3-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] qcow2.py: Subcommand for changing header fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, rjones@redhat.com On Mon, May 13, 2013 at 03:42:55PM +0200, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf > --- > tests/qemu-iotests/qcow2.py | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/tests/qemu-iotests/qcow2.py b/tests/qemu-iotests/qcow2.py > index fecf5b9..b6abd16 100755 > --- a/tests/qemu-iotests/qcow2.py > +++ b/tests/qemu-iotests/qcow2.py > @@ -149,6 +149,17 @@ def cmd_dump_header(fd): > h.dump() > h.dump_extensions() > > +def cmd_set_header(fd, name, value): > + try: > + value = int(value, 0) > + except: > + print "'%s' is not a valid number" % value > + sys.exit(1) > + > + h = QcowHeader(fd) > + h.__dict__[name] = value > + h.update(fd) No error checking on 'name'. Since end-users are unlikely to try qcow2.py we can get away with this, but it might save some poor person time in the future if we check "name in QcowHeader.fields" and print an error.