]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxl: Fail domain creation if pci assignment fails
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 4 Mar 2014 13:38:18 +0000 (13:38 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 10 Mar 2014 12:01:06 +0000 (12:01 +0000)
Actually pay attention to the return value of libxl__device_pci_add.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
tools/libxl/libxl_create.c

index a604cd87013d6b47add7d9b852b8cc45bf170f44..53e7cb69448039e499fa47522cac9a1da572eacd 100644 (file)
@@ -1262,8 +1262,14 @@ static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *multidev,
         goto error_out;
     }
 
-    for (i = 0; i < d_config->num_pcidevs; i++)
-        libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+    for (i = 0; i < d_config->num_pcidevs; i++) {
+        ret = libxl__device_pci_add(gc, domid, &d_config->pcidevs[i], 1);
+        if (ret < 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                       "libxl_device_pci_add failed: %d", ret);
+            goto error_out;
+        }
+    }
 
     if (d_config->num_pcidevs > 0) {
         ret = libxl__create_pci_backend(gc, domid, d_config->pcidevs,