diff mbox

[v3,2/2] qemu: use bdrv_flush_all for vm_stop et al

Message ID 1473982972-8884-3-git-send-email-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

John Snow Sept. 15, 2016, 11:42 p.m. UTC
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.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 cpus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

John Snow Sept. 16, 2016, 4:17 p.m. UTC | #1
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 <jsnow@redhat.com>
> ---
>  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();
>      }
>  }
>
>
Kevin Wolf Sept. 19, 2016, 8:01 a.m. UTC | #2
Am 16.09.2016 um 18:17 hat John Snow geschrieben:
> 
> 
> 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

I'd add:

    , or nodes that aren't currently attached to any device and need to
    be flushed.

> Specifically, this allows us to migrate when we have a CDROM with
> an open tray.

Looks good otherwise.

Kevin
diff mbox

Patch

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();
     }
 }