How can I use Python to convert a qcow2 image file into a raw image file?
I know of qemu-img
, but I'm curious about any Python libraries that might allow me to avoid asking my users to install that tool. It's not packaged with a default Fedora install, and that's what I'm developing for. If there are no other options however, I'll use qemu-img
.
It seems that
qemu-img
is a necessity for converting qcow2 image files to raw images. I did not find a solution that avoided calling on this tool. This isn't a big issue though, becauseqemu-img
is widely available in distros' repositories, and is sometimes packaged with distros. In order to make use of this tool in Python, simply ensure that it's installed to the system and then call it programmatically via thesubprocess
module, like so: