[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qcow2.py: Subcommand for changing header fi
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qcow2.py: Subcommand for changing header fields |
Date: |
Mon, 13 May 2013 16:59:51 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, May 13, 2013 at 03:42:55PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> 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.