On Mon, May 13, 2013 at 03:42:55PM +0200, Kevin Wolf wrote: > Signed-off-by: Kevin Wolf <kw...@redhat.com> > --- > 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.