]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
libxl: fix AttachDeviceConfig on hostdev type
authorChunyan Liu <cyliu@suse.com>
Thu, 17 Sep 2015 05:15:22 +0000 (01:15 -0400)
committerJim Fehlig <jfehlig@suse.com>
Thu, 17 Sep 2015 14:59:13 +0000 (08:59 -0600)
After attach-device a <hostdev> with --config, new device doesn't
show up in dumpxml and in guest.

To fix that, set dev->data.hostdev = NULL after work so that the
pointer is not freed, since vmdef has the pointer and still need it.

Signed-off-by: Chunyan Liu <cyliu@suse.com>
src/libxl/libxl_driver.c

index e2797d5275027ddc9385cb82300360fe0e2ae266..8087c27797957f0d1cfe336425f4d72129f4bdbd 100644 (file)
@@ -3312,6 +3312,7 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
 
             if (virDomainHostdevInsert(vmdef, hostdev) < 0)
                 return -1;
+            dev->data.hostdev = NULL;
             break;
 
         default: