def findBaseImage(flavor, size='8G'):
 image = path.join(VMImageDir, (flavor + '-base.qcow2'))
 if path.exists(image):
  perms = (stat(image)[ST_MODE] & 511)
  if (perms != 292):
   raise Exception((('Error - base image %s is writable.' % image) + (' Are multiple builds running? if not, remove %s and try again.' % image)))
 else:
  run(('mkdir -p %s' % VMImageDir))
  iso = findiso(flavor)
  log('* Creating image file', image)
  run(('qemu-img create -f qcow2 %s %s' % (image, size)))
  installUbuntu(iso, image)
  log('* Write-protecting image', image)
  os.chmod(image, 292)
 (kernel, initrd) = extractKernel(image, flavor)
 log('* Using base image', image, 'and kernel', kernel)
 return (image, kernel, initrd)

def findBaseImage ( flavor , size = '8G' ) : image = path . join ( VMImageDir , ( flavor + '-base.qcow2' ) ) if path . exists ( image ) : perms = ( stat ( image ) [ ST_MODE ] & 511 ) if ( perms != 292 ) : raise Exception ( ( ( 'Error - base image %s is writable.' % image ) + ( ' Are multiple builds running? if not, remove %s and try again.' % image ) ) ) else : run ( ( 'mkdir -p %s' % VMImageDir ) ) iso = findiso ( flavor ) log ( '* Creating image file' , image ) run ( ( 'qemu-img create -f qcow2 %s %s' % ( image , size ) ) ) installUbuntu ( iso , image ) log ( '* Write-protecting image' , image ) os . chmod ( image , 292 ) ( kernel , initrd ) = extractKernel ( image , flavor ) log ( '* Using base image' , image , 'and kernel' , kernel ) return ( image , kernel , initrd )
return base vm image and kernel .