qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qemu-img: allow qemu-img measure --object without a filename

In most qemu-img sub-commands the --object option only makes sense when
there is a filename. qemu-img measure is an exception because objects
may be referenced from the image creation options instead of an existing
image file. Allow --object without a filename.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200221112522.1497712-4-stefanha@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>

authored by

Stefan Hajnoczi and committed by
Max Reitz
c3673dcf a9da6e49

+11 -13
+2 -4
qemu-img.c
··· 4932 4932 filename = argv[optind]; 4933 4933 } 4934 4934 4935 - if (!filename && 4936 - (object_opts || image_opts || fmt || snapshot_name || sn_opts)) { 4937 - error_report("--object, --image-opts, -f, and -l " 4938 - "require a filename argument."); 4935 + if (!filename && (image_opts || fmt || snapshot_name || sn_opts)) { 4936 + error_report("--image-opts, -f, and -l require a filename argument."); 4939 4937 goto out; 4940 4938 } 4941 4939 if (filename && img_size != UINT64_MAX) {
+1 -1
tests/qemu-iotests/178
··· 50 50 $QEMU_IMG measure # missing arguments 51 51 $QEMU_IMG measure --size 2G "$TEST_IMG" # only one allowed 52 52 $QEMU_IMG measure "$TEST_IMG" a # only one filename allowed 53 - $QEMU_IMG measure --object secret,id=sec0,data=MTIzNDU2,format=base64 # missing filename 53 + $QEMU_IMG measure --object secret,id=sec0,data=MTIzNDU2,format=base64 # size or filename needed 54 54 $QEMU_IMG measure --image-opts # missing filename 55 55 $QEMU_IMG measure -f qcow2 # missing filename 56 56 $QEMU_IMG measure -l snap1 # missing filename
+4 -4
tests/qemu-iotests/178.out.qcow2
··· 5 5 qemu-img: Either --size N or one filename must be specified. 6 6 qemu-img: --size N cannot be used together with a filename. 7 7 qemu-img: At most one filename argument is allowed. 8 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 9 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 10 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 11 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 8 + qemu-img: Either --size N or one filename must be specified. 9 + qemu-img: --image-opts, -f, and -l require a filename argument. 10 + qemu-img: --image-opts, -f, and -l require a filename argument. 11 + qemu-img: --image-opts, -f, and -l require a filename argument. 12 12 qemu-img: Invalid option list: , 13 13 qemu-img: Invalid parameter 'snapshot.foo' 14 14 qemu-img: Failed in parsing snapshot param 'snapshot.foo'
+4 -4
tests/qemu-iotests/178.out.raw
··· 5 5 qemu-img: Either --size N or one filename must be specified. 6 6 qemu-img: --size N cannot be used together with a filename. 7 7 qemu-img: At most one filename argument is allowed. 8 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 9 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 10 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 11 - qemu-img: --object, --image-opts, -f, and -l require a filename argument. 8 + qemu-img: Either --size N or one filename must be specified. 9 + qemu-img: --image-opts, -f, and -l require a filename argument. 10 + qemu-img: --image-opts, -f, and -l require a filename argument. 11 + qemu-img: --image-opts, -f, and -l require a filename argument. 12 12 qemu-img: Invalid option list: , 13 13 qemu-img: Invalid parameter 'snapshot.foo' 14 14 qemu-img: Failed in parsing snapshot param 'snapshot.foo'