Do not check DataBroker shards 80/94580/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 9 Jan 2021 21:47:01 +0000 (22:47 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 10 Jan 2021 08:53:06 +0000 (09:53 +0100)
Startup checks are not necessary, as DataBroker is only injected
once initial convergence has been reached.

Remove the checks and all their configuration binding, leaving only
manual Karaf commands. These will be refactored at a later point
in time.

Change-Id: I1ec8fbf47847c024e7a4e2bdceb867e0491f35c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
hwvtepsouthbound/hwvtepsouthbound-impl/pom.xml
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProvider.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProviderConfigurator.java [deleted file]
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/resources/OSGI-INF/blueprint/hwvtepsouthbound.xml
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/resources/initial/hwvtepsouthbound.cfg [deleted file]

index 7390ae50d4a0a2de41852c461643fc949331d7dd..0e7cfbd9f3aa66bcf5ad22dd76a7dcddd96e8cad 100644 (file)
@@ -132,28 +132,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           <reuseForks>false</reuseForks>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-artifacts</id>
-            <goals>
-              <goal>attach-artifact</goal>
-            </goals>
-            <phase>package</phase>
-            <configuration>
-              <artifacts>
-                <artifact>
-                  <file>${project.build.directory}/classes/initial/hwvtepsouthbound.cfg</file>
-                  <type>cfg</type>
-                  <classifier>config</classifier>
-                </artifact>
-              </artifacts>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 
index 74cd4a5ee8e21c9c93bcd3f33df8d651cba306f6..cf1f37711c879e106bf55a24e47ca1c7d11dfa3b 100644 (file)
@@ -38,7 +38,6 @@ import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoke
 import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvokerImpl;
 import org.opendaylight.ovsdb.lib.OvsdbConnection;
 import org.opendaylight.ovsdb.utils.mdsal.utils.Scheduler;
-import org.opendaylight.ovsdb.utils.mdsal.utils.ShardStatusMonitor;
 import org.opendaylight.serviceutils.upgrade.UpgradeState;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
@@ -68,8 +67,7 @@ public class HwvtepSouthboundProvider implements ClusteredDataTreeChangeListener
     private HwvtepReconciliationManager hwvtepReconciliationManager;
     private final AtomicBoolean registered = new AtomicBoolean(false);
     private ListenerRegistration<HwvtepSouthboundProvider> operTopologyRegistration;
-    private int shardStatusCheckRetryCount = 1000;
-    private UpgradeState upgradeState;
+    private final UpgradeState upgradeState;
 
     @Inject
     public HwvtepSouthboundProvider(@Reference final DataBroker dataBroker,
@@ -93,27 +91,6 @@ public class HwvtepSouthboundProvider implements ClusteredDataTreeChangeListener
      */
     @PostConstruct
     public void init() {
-        boolean isDatastoreAvailable = false;
-        int retryCount = 0;
-        try {
-            while (retryCount < shardStatusCheckRetryCount) {
-                isDatastoreAvailable = ShardStatusMonitor.getShardStatus(ShardStatusMonitor.TOPOLOGY_SHARDS);
-                if (isDatastoreAvailable) {
-                    break;
-                }
-                LOG.warn("Hwvtep: retrying shard status check for the {} time", ++retryCount);
-                Thread.sleep(2000);
-            }
-            if (isDatastoreAvailable) {
-                LOG.info("Hwvtep is UP");
-                init2();
-            }
-        } catch (InterruptedException e) {
-            LOG.error("Error in intializing the Hwvtep Southbound ", e);
-        }
-    }
-
-    private void init2() {
         LOG.info("HwvtepSouthboundProvider Session Initiated");
         txInvoker = new TransactionInvokerImpl(dataBroker);
         cm = new HwvtepConnectionManager(dataBroker, txInvoker, entityOwnershipService, ovsdbConnection);
@@ -149,7 +126,7 @@ public class HwvtepSouthboundProvider implements ClusteredDataTreeChangeListener
     private void registerConfigListenerPostUpgrade() {
         if (upgradeState.isUpgradeInProgress()) {
             LOG.error("Upgrade is in progress delay config data change listener registration");
-            Scheduler.getScheduledExecutorService().schedule(() -> registerConfigListenerPostUpgrade(),
+            Scheduler.getScheduledExecutorService().schedule(this::registerConfigListenerPostUpgrade,
                     60, TimeUnit.SECONDS);
             return;
         }
@@ -245,10 +222,6 @@ public class HwvtepSouthboundProvider implements ClusteredDataTreeChangeListener
         }
     }
 
-    public void setShardStatusCheckRetryCount(int retryCount) {
-        this.shardStatusCheckRetryCount = retryCount;
-    }
-
     private static class HwvtepsbPluginInstanceEntityOwnershipListener implements EntityOwnershipListener {
         private final HwvtepSouthboundProvider hsp;
         private final EntityOwnershipListenerRegistration listenerRegistration;
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProviderConfigurator.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundProviderConfigurator.java
deleted file mode 100644 (file)
index 7b43cbd..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2020 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.ovsdb.hwvtepsouthbound;
-
-import java.util.Map;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Helper to let Blueprint XML configure {@link HwvtepSouthboundProvider}.
- *
- * @author Chandra Shekar S
- */
-public class HwvtepSouthboundProviderConfigurator {
-
-    private static final Logger LOG = LoggerFactory.getLogger(HwvtepSouthboundProviderConfigurator.class);
-
-    private static final String SHARD_STATUS_CHECK_RETRY_COUNT = "shard-status-check-retry-count";
-
-    private final HwvtepSouthboundProvider hwvtepSouthboundProvider;
-
-    public HwvtepSouthboundProviderConfigurator(HwvtepSouthboundProvider hwvtepSouthboundProvider) {
-        this.hwvtepSouthboundProvider = hwvtepSouthboundProvider;
-    }
-
-    public void setShardStatusCheckRetryCount(int retryCount) {
-        hwvtepSouthboundProvider.setShardStatusCheckRetryCount(retryCount);
-    }
-
-
-
-    public void updateConfigParameter(Map<String, Object> configParameters) {
-        if (configParameters != null && !configParameters.isEmpty()) {
-            LOG.debug("Config parameters received : {}", configParameters.entrySet());
-            for (Map.Entry<String, Object> paramEntry : configParameters.entrySet()) {
-                if (paramEntry.getKey().equalsIgnoreCase(SHARD_STATUS_CHECK_RETRY_COUNT)) {
-                    hwvtepSouthboundProvider
-                            .setShardStatusCheckRetryCount(Integer.parseInt((String) paramEntry.getValue()));
-                }
-            }
-        }
-    }
-}
index f9eabbb8e7265d5d5692fcb6ef7c525e77a9956b..c1345d0e49623b98a6a1831d388cf4266e9b1a24 100644 (file)
@@ -1,28 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
-  xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
-  odl:use-default-for-reference-types="true">
-
-    <!-- Read default values at startup and inject to HwvtepSouthboundProvider-->
-    <cm:property-placeholder persistent-id="org.opendaylight.ovsdb.hwvtepsouthbound" update-strategy="none">
-        <!-- Setting default values, in case hwvtepsouthbound.cfg file is not present
-        or config property is commented out. This will be overridden if user
-        specify the property in hwvtepsouthbound.cfg file-->
-        <cm:default-properties>
-            <cm:property name="shard-status-check-retry-count" value="1000"/>
-        </cm:default-properties>
-    </cm:property-placeholder>
-
-    <bean id="hwvtepSouthboundProviderConfigurator"
-          class="org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProviderConfigurator">
-        <cm:managed-properties persistent-id="org.opendaylight.ovsdb.hwvtepsouthbound"
-                               update-strategy="component-managed"
-                               update-method="updateConfigParameter"/>
-        <argument ref="hwvtepSouthboundProvider" />
-        <property name="shardStatusCheckRetryCount" value="${shard-status-check-retry-count}"/>
-    </bean>
-
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+    <!-- FIXME: convert these to proper Karaf commands -->
     <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
     <command>
         <action class="org.opendaylight.ovsdb.hwvtepsouthbound.TransactionHistoryCmd">
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/resources/initial/hwvtepsouthbound.cfg b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/resources/initial/hwvtepsouthbound.cfg
deleted file mode 100644 (file)
index e4bbc75..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#********************************************************************************************
-#                               Boot Time Configuration                                     *
-#                   Config knob changes will require controller restart                     *
-#********************************************************************************************
-#HwvtepSouthboundPlugin will check the topology SHARDS for their status to be up.
-#This the retry count to check the topoloy SHARDS status by the HwvtepSouthboundPlugin.
-shard-status-check-retry-count = 1000