23dece19da
Until now, with auto-read-only=on we tried to open the file read-write first and if that failed, read-only was tried. This is actually not good enough for libvirt, which gives QEMU SELinux permissions for read-write only as soon as it actually intends to write to the image. So we need to be able to switch between read-only and read-write at runtime. This patch makes auto-read-only dynamic, i.e. the file is opened read-only as long as no user of the node has requested write permissions, but it is automatically reopened read-write as soon as the first writer is attached. Conversely, if the last writer goes away, the file is reopened read-only again. bs->read_only is no longer set for auto-read-only=on files even if the file descriptor is opened read-only because it will be transparently upgraded as soon as a writer is attached. This changes the output of qemu-iotests 232. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
80 lines
4.0 KiB
Plaintext
80 lines
4.0 KiB
Plaintext
QA output created by 232
|
|
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
|
|
|
|
=== -drive with read-write image: read-only/auto-read-only combinations ===
|
|
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
|
=== -drive with read-only image: read-only/auto-read-only combinations ===
|
|
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
|
QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
|
QEMU_PROG: -drive driver=file,file=TEST_DIR/t.IMGFMT,if=none,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
NODE_NAME: TEST_DIR/t.IMGFMT (file)
|
|
|
|
=== -blockdev with read-write image: read-only/auto-read-only combinations ===
|
|
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
|
|
=== -blockdev with read-only image: read-only/auto-read-only combinations ===
|
|
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
node0: TEST_DIR/t.IMGFMT (file, read-only)
|
|
|
|
QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
|
QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0,auto-read-only=off: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
node0: TEST_DIR/t.IMGFMT (file)
|
|
QEMU_PROG: -blockdev driver=file,filename=TEST_DIR/t.IMGFMT,node-name=node0: Could not open 'TEST_DIR/t.IMGFMT': Permission denied
|
|
|
|
=== Try commit to backing file with auto-read-only ===
|
|
|
|
Formatting 'TEST_DIR/t.IMGFMT.0', fmt=IMGFMT size=134217728
|
|
Formatting 'TEST_DIR/t.IMGFMT.1', fmt=IMGFMT size=134217728
|
|
Formatting 'TEST_DIR/t.IMGFMT.2', fmt=IMGFMT size=134217728
|
|
Formatting 'TEST_DIR/t.IMGFMT.3', fmt=IMGFMT size=134217728
|
|
Formatting 'TEST_DIR/t.IMGFMT.4', fmt=IMGFMT size=134217728
|
|
QMP_VERSION
|
|
{"return": {}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "job0"}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "job0"}}
|
|
{"return": {}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "job0"}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "job0"}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "job0", "len": 134217728, "offset": 134217728, "speed": 0, "type": "commit"}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "job0"}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "job0"}}
|
|
{"return": {}}
|
|
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
|
|
*** done
|