Bug 981663

Summary: disk-format "qemu-img info: JSON parse error" when target file does not exist
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acathrow, bfan, leiwang, mbooth, qguan, wshi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 980337 Environment:
Last Closed: 2013-07-18 13:27:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 980338    

Description Richard W.M. Jones 2013-07-05 12:34:46 UTC
The disk-format command (in guestfish, or the guestfs_disk_format
API) takes a host file and tries to work out the disk format.

This works fine for any file which exists on the host.

However if the host file does not exist, you get a strange error:

$ guestfish disk-format /etc/nosuchfile
libguestfs: error: qemu-img info: JSON parse error: parse error: premature EOF
                                       
                     (right here) ------^

libguestfs: error: qemu-img info: /etc/nosuchfile: qemu-img info exited with error status 1.
To see full error messages you may need to enable debugging.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs