mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
qemu: save/restore original error when recovering from failed bridge attach
Not only was the original error code destroyed in the case of encountering an error during recovery from a failed attach to the bridge (and then *that* error was destroyed by logging a *second* error about the failure to recover - virNetDevBridgeAddPort() already logs an error, so the one about failing to recover was redundant), but if the recovery was successful, the function would then return success to the caller even though it had failed. Fixes:2711ac8716
(overwritten errors were introduced along with this functionality) Fixes:6bde0a1a37
(the wrong return value was introduced by a refactor) Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
057c07eddd
commit
3f8b57a61f
@ -3352,14 +3352,13 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
|
||||
ret = virNetDevBridgeAddPort(newbridge, olddev->ifname);
|
||||
virDomainAuditNet(vm, NULL, newdev, "attach", ret == 0);
|
||||
if (ret < 0) {
|
||||
virErrorPtr err;
|
||||
|
||||
virErrorPreserveLast(&err);
|
||||
ret = virNetDevBridgeAddPort(oldbridge, olddev->ifname);
|
||||
virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0);
|
||||
if (ret < 0) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("unable to recover former state by adding port "
|
||||
"to bridge %s"), oldbridge);
|
||||
}
|
||||
return ret;
|
||||
virErrorRestore(&err);
|
||||
return -1;
|
||||
}
|
||||
/* caller will replace entire olddev with newdev in domain nets list */
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user