mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuDomainAttachNetDevice: Don't overwrite error on rollback
If there is an error hotpluging a net device (for whatever reason) a rollback operation is performed. However, whilst doing so various helper functions that are called report errors on their own. This results in the original error to be overwritten and thus misleading the user. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -935,6 +935,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
virDomainNetDefPtr net)
|
virDomainNetDefPtr net)
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
virErrorPtr originalError = NULL;
|
||||||
char **tapfdName = NULL;
|
char **tapfdName = NULL;
|
||||||
int *tapfd = NULL;
|
int *tapfd = NULL;
|
||||||
size_t tapfdSize = 0;
|
size_t tapfdSize = 0;
|
||||||
@@ -1320,6 +1321,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
if (!virDomainObjIsActive(vm))
|
if (!virDomainObjIsActive(vm))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
originalError = virSaveLastError();
|
||||||
if (vlan < 0) {
|
if (vlan < 0) {
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
|
||||||
char *netdev_name;
|
char *netdev_name;
|
||||||
@@ -1350,6 +1352,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
ignore_value(qemuDomainObjExitMonitor(driver, vm));
|
||||||
VIR_FREE(hostnet_name);
|
VIR_FREE(hostnet_name);
|
||||||
}
|
}
|
||||||
|
virSetError(originalError);
|
||||||
|
virFreeError(originalError);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user