When hostdev parent is network device, should call
libxlDomainDetachNetDevice to detach the device from a higher level.
Signed-off-by: Chunyan Liu <cyliu(a)suse.com>
---
src/libxl/libxl_driver.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 74ebea4..328dac8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3443,8 +3443,10 @@ libxlDomainDetachNetDevice(libxlDriverPrivatePtr driver,
cleanup:
libxl_device_nic_dispose(&nic);
- if (!ret)
+ if (!ret) {
+ networkReleaseActualDevice(vm->def, detach);
virDomainNetRemove(vm->def, detachidx);
+ }
virObjectUnref(cfg);
return ret;
}
@@ -3467,8 +3469,12 @@ libxlDomainDetachDeviceLive(libxlDriverPrivatePtr driver,
break;
case VIR_DOMAIN_DEVICE_HOSTDEV:
- ret = libxlDomainDetachHostDevice(driver, vm,
- dev->data.hostdev);
+ if (dev->data.hostdev->parent.type == VIR_DOMAIN_DEVICE_NET)
+ ret = libxlDomainDetachNetDevice(driver, vm,
+
dev->data.hostdev->parent.data.net);
+ else
+ ret = libxlDomainDetachHostDevice(driver, vm,
+ dev->data.hostdev);
break;
default:
--
2.1.4