Received: from eggs.gnu.org ([2001:4830:134:3::10]:44841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fO0pV-0002u3-2Z for qemu-devel@nongnu.org; Wed, 30 May 2018 09:07:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fO0pT-0002vd-WC for qemu-devel@nongnu.org; Wed, 30 May 2018 09:07:53 -0400 Date: Wed, 30 May 2018 16:07:25 +0300 From: Roman Kagan Message-ID: <20180530130725.GA2448@rkaganb.sw.ru> References: <20180426161958.2872-1-rkagan@virtuozzo.com> <20180426161958.2872-4-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 03/17] iotests: ask qemu for supported formats List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , Markus Armbruster , qemu-block@nongnu.org, qemu-devel@nongnu.org On Wed, May 30, 2018 at 02:17:55PM +0200, Max Reitz wrote: > On 2018-04-26 18:19, Roman Kagan wrote: > > @@ -550,13 +561,26 @@ def verify_cache_mode(supported_cache_modes=[]): > > if supported_cache_modes and (cachemode not in supported_cache_modes): > > notrun('not suitable for this cache mode: %s' % cachemode) > > > > +rw_formats = None > > + > > +def supports_format(format_name): > > + format_message = qemu_pipe('-drive', 'format=?') > > + global rw_formats > > + if rw_formats is None: > > + rw_formats = format_message.splitlines()[0].split(':')[1].split() > > Isn't it sufficient to call qemu_pipe() only if rw_formats is None? Sure it is, and this was exactly my intention with this global, but I managed to forget moving the most relevant part under 'if' :$ Thanks for catching, Roman.