Skip to content
Snippets Groups Projects
Commit 0333d3db authored by Bob Lantz's avatar Bob Lantz
Browse files

qcow2size(): use qemu-image instead of file

file no longer returns image size on 14.04
fixes #373
parent f2458d1d
No related branches found
No related tags found
No related merge requests found
...@@ -728,9 +728,12 @@ def generateOVF( name, osname, osid, diskname, disksize, mem=1024, cpus=1, ...@@ -728,9 +728,12 @@ def generateOVF( name, osname, osid, diskname, disksize, mem=1024, cpus=1,
def qcow2size( qcow2 ): def qcow2size( qcow2 ):
"Return virtual disk size (in bytes) of qcow2 image" "Return virtual disk size (in bytes) of qcow2 image"
output = check_output( [ 'file', qcow2 ] ) output = check_output( [ 'qemu-img', 'info', qcow2 ] )
assert 'QCOW' in output try:
bytes = int( re.findall( '(\d+) bytes', output )[ 0 ] ) assert 'format: qcow' in output
bytes = int( re.findall( '(\d+) bytes', output )[ 0 ] )
except:
raise Exception( 'Could not determine size of %s' % qcow2 )
return bytes return bytes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment