[libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor

2014-08-12 Thread Peter Krempa
In qemuMigrationToFile we enter the monitor multiple times and don't
check if the VM is still alive after returning form the monitor. Add the
checks to skip pieces of code in case the VM crashes while saving it's
state.
---
 src/qemu/qemu_migration.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 767d840..50a1eab 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4731,6 +4731,13 @@ qemuMigrationToFile(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 qemuDomainObjExitMonitor(driver, vm);
 }

+if (!virDomainObjIsActive(vm)) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(guest unexpectedly quit));
+/* nothing to tear down */
+return -1;
+}
+
 if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) 
 (!compressor || pipe(pipeFD) == 0)) {
 /* All right! We can use fd migration, which means that qemu
@@ -4818,6 +4825,12 @@ qemuMigrationToFile(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 }
 qemuDomainObjExitMonitor(driver, vm);

+if (!virDomainObjIsActive(vm)) {
+virReportError(VIR_ERR_INTERNAL_ERROR, %s,
+   _(guest unexpectedly quit));
+goto cleanup;
+}
+
 if (rc  0)
 goto cleanup;

@@ -4827,7 +4840,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 if (rc == -2) {
 orig_err = virSaveLastError();
 virCommandAbort(cmd);
-if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
+if (virDomainObjIsActive(vm) 
+qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
 qemuMonitorMigrateCancel(priv-mon);
 qemuDomainObjExitMonitor(driver, vm);
 }
@@ -4845,7 +4859,8 @@ qemuMigrationToFile(virQEMUDriverPtr driver, 
virDomainObjPtr vm,
 orig_err = virSaveLastError();

 /* Restore max migration bandwidth */
-if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
+if (virDomainObjIsActive(vm) 
+qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
 qemuMonitorSetMigrationSpeed(priv-mon, saveMigBandwidth);
 priv-migMaxBandwidth = saveMigBandwidth;
 qemuDomainObjExitMonitor(driver, vm);
-- 
2.0.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor

2014-08-12 Thread Ján Tomko
On 08/12/2014 03:44 PM, Peter Krempa wrote:
 In qemuMigrationToFile we enter the monitor multiple times and don't
 check if the VM is still alive after returning form the monitor. Add the
 checks to skip pieces of code in case the VM crashes while saving it's
 state.
 ---
  src/qemu/qemu_migration.c | 19 +--
  1 file changed, 17 insertions(+), 2 deletions(-)

ACK

Jan



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor

2014-08-12 Thread Peter Krempa
On 08/12/14 17:17, Ján Tomko wrote:
 On 08/12/2014 03:44 PM, Peter Krempa wrote:
 In qemuMigrationToFile we enter the monitor multiple times and don't
 check if the VM is still alive after returning form the monitor. Add the
 checks to skip pieces of code in case the VM crashes while saving it's
 state.
 ---
  src/qemu/qemu_migration.c | 19 +--
  1 file changed, 17 insertions(+), 2 deletions(-)
 
 ACK
 

I've tweaked the commit message in 1/3 and pushed 1/3 and 3/3.

Thanks.

Peter




signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 3/3] qemu: migration: Check domain live state after exitting the monitor

2014-08-12 Thread Eric Blake
On 08/12/2014 07:44 AM, Peter Krempa wrote:

s/exitting/exiting/ in the title

 In qemuMigrationToFile we enter the monitor multiple times and don't
 check if the VM is still alive after returning form the monitor. Add the
 checks to skip pieces of code in case the VM crashes while saving it's

s/it's/its/ (it's is only correct if you can replace it with it is)

 state.

Oh well, I see this was already pushed; so we'll live with the typos :)

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list