@@ -2605,6 +2605,20 @@ static int img_info(int argc, char **argv)
list = collect_image_info_list(image_opts, filename, fmt, chain,
force_share, &local_err);
+ if (!list && !force_share) {
+ Error *local_err2 = NULL;
+ list = collect_image_info_list(image_opts, filename, fmt, chain,
+ true, &local_err2);
+ if (list) {
+ warn_report("--force-share (-U) is not used but it "
+ "seems the image is attached to a running guest; "
+ "the information may be inaccurate if it is being "
+ "updated");
+ error_free(local_err);
+ } else {
+ error_free(local_err2);
+ }
+ }
if (!list) {
error_reportf_err(local_err, "Could not open '%s': ", filename);
return 1;
@@ -41,8 +41,7 @@ Is another process using the image?
no file open, try 'help open'
_qemu_img_wrapper info TEST_DIR/t.qcow2
-qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" lock
-Is another process using the image?
+qemu-img: warning: --force-share (-U) is not used but it seems the image is attached to a running guest; the information may be inaccurate if it is being updated
_qemu_img_wrapper check TEST_DIR/t.qcow2
qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" lock