[libvirt] PATCH: Inform QEMU "prepare" hook of migration in progress

Adam Tilghman agt at ucsd.edu
Thu Dec 15 16:49:11 UTC 2011

>From: Eric Blake <eblake redhat com>
>Subject: Re: [libvirt-users] Wanted: method for qemu hook script to know if called for migration
>Date: Mon, 25 Jul 2011 14:17:08 -0600
>>As a feature suggestion, it would be nice if that fourth input variable,
>>currently "-", was something like "migrate" in this instance.
>Yes, that is probably a bug worth fixing.

I would also find it useful for the QEMU "prepare" hook 
to be told whether it's being called in the context of a migration.

(In our case, we use that hook to manage shared DRBD storage, and only permit
Primary/Primary mode in the context of a migration.)

The attached 1-line patch supplies the hook with an additional 
argument "migration-target" when appropriate.

Submitted as https://bugzilla.redhat.com/show_bug.cgi?id=768054

 src/qemu/qemu_process.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9123f4c..ef9f7eb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2936,7 +2936,7 @@ int qemuProcessStart(virConnectPtr conn,
         int hookret;
         hookret = virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name,
+                    VIR_HOOK_QEMU_OP_PREPARE, VIR_HOOK_SUBOP_BEGIN,  migrateFrom ? "migration-target" : NULL, xml);

Adam Tilghman   Systems Support / Academic Computing & Media Services
 agt at ucsd.edu    858-822-0711     University of California, San Diego   

More information about the libvir-list mailing list