]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: migration: Forbid migration with memory modules lacking info
authorPeter Krempa <pkrempa@redhat.com>
Mon, 19 Jan 2015 13:28:14 +0000 (14:28 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 23 Mar 2015 13:25:15 +0000 (14:25 +0100)
Make sure that libvirt has all vital information needed to reliably
represent configuration of guest's memory devices in case of a
migration.

This patch forbids migration in case the required slot number and module
base address are not present (failed to be loaded from qemu via
monitor).

src/qemu/qemu_migration.c

index f54208756789dad1fa991379e4cf2132df4ba146..d34bb02dc4202756c7b4a2e9c029df5cfbde16b0 100644 (file)
@@ -2021,6 +2021,20 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
         }
     }
 
+    /* Verify that memory device config can be transferred reliably */
+    for (i = 0; i < def->nmems; i++) {
+        virDomainMemoryDefPtr mem = def->mems[i];
+
+        if (mem->model == VIR_DOMAIN_MEMORY_MODEL_DIMM &&
+            mem->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("domain's dimm info lacks slot ID "
+                             "or base address"));
+
+            return false;
+        }
+    }
+
     return true;
 }