Received: from eggs.gnu.org ([2001:4830:134:3::10]:47015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkvq2-0003Ng-AI for qemu-devel@nongnu.org; Fri, 16 Sep 2016 12:18:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkvq1-0008Ha-Ae for qemu-devel@nongnu.org; Fri, 16 Sep 2016 12:18:06 -0400 References: <1473982972-8884-1-git-send-email-jsnow@redhat.com> <1473982972-8884-3-git-send-email-jsnow@redhat.com> From: John Snow Message-ID: <5ece6914-5fa2-bb3a-6e1b-62b6a9ac625a@redhat.com> Date: Fri, 16 Sep 2016 12:17:56 -0400 MIME-Version: 1.0 In-Reply-To: <1473982972-8884-3-git-send-email-jsnow@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/2] qemu: use bdrv_flush_all for vm_stop et al List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, qemu-stable@nongnu.org, qemu-devel@nongnu.org On 09/15/2016 07:42 PM, John Snow wrote: > Bypass the usual check to see if we are "allowed" to flush via the > block model, and manually flush the BDS nodes themselves instead. > > This allows us to do things like migrate when we have a device with > an open tray, but has a node that may need to be flushed. > > Specifically, this allows us to migrate when we have a CDROM with > an open tray. > How about: Reimplement bdrv_flush_all for vm_stop. In contrast to blk_flush_all, bdrv_flush_all does not have device model restrictions. This allows us to flush and halt unconditionally without error. This allows us to do things like migrate when we have a device with an open tray, but has a node that may need to be flushed. Specifically, this allows us to migrate when we have a CDROM with an open tray. > Signed-off-by: John Snow > --- > cpus.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/cpus.c b/cpus.c > index e39ccb7..96d9352 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -751,7 +751,7 @@ static int do_vm_stop(RunState state) > } > > bdrv_drain_all(); > - ret = blk_flush_all(); > + ret = bdrv_flush_all(); > > return ret; > } > @@ -1494,7 +1494,7 @@ int vm_stop_force_state(RunState state) > bdrv_drain_all(); > /* Make sure to return an error if the flush in a previous vm_stop() > * failed. */ > - return blk_flush_all(); > + return bdrv_flush_all(); > } > } > >