[libvirt] [PATCH] qemuMigrationIsAllowed: Forbid migration of rebooting domain

Daniel P. Berrange berrange at redhat.com
Thu Nov 21 14:42:41 UTC 2013


On Thu, Nov 21, 2013 at 03:26:33PM +0100, Michal Privoznik wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=744967
> 
> If a domain is rebooting and a migrate API is called meanwhile we would
> have to transfer the fakeReboot attribute to the destination in order to
> prevent domain doing plain shutdown over there. What about forbidding
> this silly corner case instead? Same goes for saving a domain to a file.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index e87ea85..6dffbb1 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1399,6 +1399,14 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
>      size_t i;
>  
>      if (vm) {
> +        qemuDomainObjPrivatePtr priv = vm->privateData;
> +
> +        if (priv->fakeReboot) {
> +            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
> +                           _("domain is rebooting"));
> +            return false;
> +        }
> +
>          if (qemuProcessAutoDestroyActive(driver, vm)) {
>              virReportError(VIR_ERR_OPERATION_INVALID,
>                             "%s", _("domain is marked for auto destroy"));

If the guest never responds to the 'shutdown' request, then we'll never
do the reboot and so the 'fakeReboot' flag won't get cleared. In such a
case it would be valid, and even desirable, to be able to migrate or
save to a file.

At the end of the day fake-reboot is a crappy solution with a number of
unfixable edge cases. IMHO this is at most a documentation issue and we
shouldn't try to do anything more clever.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list