05.02.2019 23:14, Andrey Shinkevich wrote: > A new test file 242 added to the qemu-iotests set. It checks > the format of qcow2 specific information for the new added > section that lists details of bitmaps. > > Signed-off-by: Andrey Shinkevich <andrey.shinkev...@virtuozzo.com> > --- > tests/qemu-iotests/242 | 100 +++++++++++++++++++++++++++ > tests/qemu-iotests/242.out | 167 > +++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 268 insertions(+) > create mode 100755 tests/qemu-iotests/242 > create mode 100644 tests/qemu-iotests/242.out > > diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242 > new file mode 100755 > index 0000000..95c1f18 > --- /dev/null > +++ b/tests/qemu-iotests/242
[..] > + > +def toggle_flag(offset): > + f = open(disk, "r+b") > + f.seek(offset, 0) > + c = f.read(1) > + toggled = chr(ord(c) ^ bitmap_flag_unknown) > + f.seek(-1, 1) > + f.write(toggled) > + f.close() ok, but better use "with", like with open(disk, "r+b") as f: ... as file will be closed on any exception With or without that fixed: Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> -- Best regards, Vladimir