Uploaded image for project: 'netvirt'
  1. netvirt
  2. NETVIRT-1077

get rid of WriteTransactions which will never be submitted

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Medium Medium
    • Magnesium
    • None
    • None
    • None

      In NeutronvpnManager, NeutronvpnUtil, in functions, that perform WriteOnlyTransaction to ConfigDS you can often meet this references check for WriteTransaction object:

      method UpdateSomething(...., Something something, WriteTransaction wrtConfigTxn) {

      if (wrtConfigTxn == null)

      {      wrtConfigTxn = dataBroker.newWriteOnlyTransaction(); }

      ...

      and then there is a transaction call:

      LOG.info("Updating something", something);
      wrtConfigTxn.put(LogicalDatastoreType.CONFIGURATION, something, something.build());

      ....

      }

      So if wrtConfigTxn was null, newly created WriteOnlyTransaction will never be submitted to ConfigDS, because there is no any call wrtConfigTxn.submit().get().

      So  in such methods bodies, we always sure, that existed wrtConfigTxn is passed by arguments, it is not null, except the moment, when we perform if (wrtConfigTxn == null).

      Fortunately, some methods are really the case, we always call them with already existed wrtConfigTxn, so this check will be never executed.

      Need to sanitize the code of neutron-vpn and vpnmanager packages, add  wrtConfigTxn.submit, when we create new transaction object inside a method.

       

            valentina.krasnobaeva Valentina Krasnobaeva
            valentina.krasnobaeva Valentina Krasnobaeva
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: