From: Jim Fehlig Date: Wed, 30 Mar 2016 21:12:35 +0000 (-0600) Subject: libxl: fix net device detach X-Git-Tag: v1.3.3-rc2^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff825f9defbe13b5cb86c2833e22070f9ec4b0f5;p=thirdparty%2Flibvirt.git libxl: fix net device detach Chunyan sent a nice cleanup patch for libxlDomainDetachNetDevice https://www.redhat.com/archives/libvir-list/2016-March/msg00926.html which I incorrectly modified before pushing as commit b5534e53. My modification caused network devices of type hostdev to no longer be removed. This patch changes b5534e53 to resemble Chunyan's original, correct patch. --- diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 9955cc7bbb..bf97c9c116 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3449,12 +3449,14 @@ libxlDomainDetachNetDevice(libxlDriverPrivatePtr driver, goto cleanup; } - networkReleaseActualDevice(vm->def, detach); - virDomainNetRemove(vm->def, detachidx); ret = 0; cleanup: libxl_device_nic_dispose(&nic); + if (!ret) { + networkReleaseActualDevice(vm->def, detach); + virDomainNetRemove(vm->def, detachidx); + } virObjectUnref(cfg); return ret; }