Reputation: 269
I have a form where user can upload images (images of different OS).
How can I detect whether the image is QEMU image of type "qcow2" ?
Upvotes: 9
Views: 9128
Reputation: 2655
You can use qemu-img info
to check the image format.
qemu-img info image-qcow.qcow2
the result will be something like this
image: image-qcow.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 136K
cluster_size: 65536
Source: http://lnx.cx/docs/vdg/html/ch02s03.html
After that, if you want to get the file format you can parse the output to get it.
Hope this helps
Upvotes: 10