1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 07:59:00 +00:00

libxl: fix AttachDeviceConfig on hostdev type

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>
(cherry picked from commit 56945e1374bd254148643d76a98fba9be67fba15)
This commit is contained in:
Chunyan Liu 2015-09-17 01:15:22 -04:00 committed by Cole Robinson
parent a45823210d
commit e60d286b8e

View File

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