def extract_snapshot(disk_path, source_fmt, snapshot_name, out_path, dest_fmt):
 if (dest_fmt == 'iso'):
  dest_fmt = 'raw'
 qemu_img_cmd = ('qemu-img', 'convert', '-f', source_fmt, '-O', dest_fmt)
 if (CONF.libvirt_snapshot_compression and (dest_fmt == 'qcow2')):
  qemu_img_cmd += ('-c',)
 if (snapshot_name is not None):
  qemu_img_cmd += ('-s', snapshot_name)
 qemu_img_cmd += (disk_path, out_path)
 execute(*qemu_img_cmd)

def extract_snapshot ( disk_path , source_fmt , snapshot_name , out_path , dest_fmt ) : if ( dest_fmt == 'iso' ) : dest_fmt = 'raw' qemu_img_cmd = ( 'qemu-img' , 'convert' , '-f' , source_fmt , '-O' , dest_fmt ) if ( CONF . libvirt_snapshot_compression and ( dest_fmt == 'qcow2' ) ) : qemu_img_cmd += ( '-c' , ) if ( snapshot_name is not None ) : qemu_img_cmd += ( '-s' , snapshot_name ) qemu_img_cmd += ( disk_path , out_path ) execute ( * qemu_img_cmd )
extract a named snapshot from a disk image .