def qcow2size(qcow2):
 output = check_output(['qemu-img', 'info', qcow2])
 try:
  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

def qcow2size ( qcow2 ) : output = check_output ( [ 'qemu-img' , 'info' , qcow2 ] ) try : 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 virtual disk size of qcow2 image .