[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Avoid squashing errors during network startup cleanup path



 On 10/26/2010 06:18 AM, Daniel P. Berrange wrote:
When failing to start a virtual network, we have to cleanup,
tearing down any iptables rules. If the iptables rules were
not present yet though, this raises an error, which squashes
the original error we were handling.

* src/network/bridge_driver.c: When failing to start a virtual
   network, don't squash the original error in cleanup
---
  src/network/bridge_driver.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8721747..0777d85 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1171,6 +1171,7 @@ static int networkStartNetworkDaemon(struct network_driver *driver,
                                       virNetworkObjPtr network)
  {
      int err;
+    virErrorPtr save_err;

      if (virNetworkObjIsActive(network)) {
          networkReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1255,7 +1256,12 @@ static int networkStartNetworkDaemon(struct network_driver *driver,
      }

   err_delbr2:
+    save_err = virSaveLastError();
      networkRemoveIptablesRules(driver, network);
+    if (save_err) {
+        virSetError(save_err);
+        virFreeError(save_err);
+    }

   err_delbr1:
      if ((err = brSetInterfaceUp(driver->brctl, network->def->bridge, 0))) {
ACK

   Stefan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]