]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
conf: shmem: Add ABI stability check
authorPeter Krempa <pkrempa@redhat.com>
Tue, 7 Oct 2014 12:26:32 +0000 (14:26 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 15 Oct 2014 08:27:50 +0000 (10:27 +0200)
Although the device will probably inhibit migration add checks to make
sure that the configuration change gets caught.

src/conf/domain_conf.c

index 55a1cc56571d5882f92f930a5165e92939879b8d..5e3c389723f5f44c44eccb1f4af01db407791134 100644 (file)
@@ -14998,6 +14998,44 @@ virDomainPanicCheckABIStability(virDomainPanicDefPtr src,
 }
 
 
+static bool
+virDomainShmemDefCheckABIStability(virDomainShmemDefPtr src,
+                                   virDomainShmemDefPtr dst)
+{
+    if (STRNEQ_NULLABLE(src->name, dst->name)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target shared memory name '%s' does not match source "
+                         "'%s'"), dst->name, src->name);
+        return false;
+    }
+
+    if (src->size != dst->size) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target shared memory size '%llu' does not match "
+                         "source size '%llu'"), dst->size, src->size);
+        return false;
+    }
+
+    if (src->server.enabled != dst->server.enabled) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Target shared memory server usage doesn't match "
+                         "source"));
+        return false;
+    }
+
+    if (src->msi.vectors != dst->msi.vectors ||
+        src->msi.enabled != dst->msi.enabled ||
+        src->msi.ioeventfd != dst->msi.ioeventfd) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Target shared memory MSI configuration doesn't match "
+                         "source"));
+        return false;
+    }
+
+    return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info);
+}
+
+
 /* This compares two configurations and looks for any differences
  * which will affect the guest ABI. This is primarily to allow
  * validation of custom XML config passed in during migration
@@ -15399,6 +15437,18 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
     if (!virDomainPanicCheckABIStability(src->panic, dst->panic))
         goto error;
 
+    if (src->nshmems != dst->nshmems) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain shared memory device count %zu "
+                         "does not match source %zu"), dst->nshmems, src->nshmems);
+        goto error;
+    }
+
+    for (i = 0; i < src->nshmems; i++) {
+        if (!virDomainShmemDefCheckABIStability(src->shmems[i], dst->shmems[i]))
+            goto error;
+    }
+
     return true;
 
  error: