You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2020/01/14 13:42:24 UTC

[cloudstack] branch ha-config-to-master created (now af98ff8)

This is an automated email from the ASF dual-hosted git repository.

dahn pushed a change to branch ha-config-to-master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git.


      at af98ff8  Merge branch '4.13' into ha-config-to-master

This branch includes the following new commits:

     new af98ff8  Merge branch '4.13' into ha-config-to-master

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[cloudstack] 01/01: Merge branch '4.13' into ha-config-to-master

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch ha-config-to-master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit af98ff812a8a3eee39ce79518cca92be669f6da7
Merge: cc093c6 54cc73a
Author: Daan Hoogland <da...@shapeblue.com>
AuthorDate: Tue Jan 14 14:37:40 2020 +0100

    Merge branch '4.13' into ha-config-to-master

 .../java/com/cloud/ha/HighAvailabilityManager.java |  46 +++++-
 .../main/java/com/cloud/configuration/Config.java  |  43 +----
 .../configuration/ConfigurationManagerImpl.java    | 174 ++++++++++-----------
 .../com/cloud/ha/HighAvailabilityManagerImpl.java  | 114 +++++++-------
 .../main/java/com/cloud/test/DatabaseConfig.java   |  59 +++----
 5 files changed, 219 insertions(+), 217 deletions(-)

diff --cc server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
index 348a417,076f500..01df157
--- a/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java
@@@ -16,32 -16,9 +16,6 @@@
  // under the License.
  package com.cloud.ha;
  
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.concurrent.Executors;
- import java.util.concurrent.ScheduledExecutorService;
- import java.util.concurrent.TimeUnit;
- 
- import javax.inject.Inject;
- import javax.naming.ConfigurationException;
- 
- import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
- import org.apache.cloudstack.framework.config.ConfigKey;
- import org.apache.cloudstack.framework.config.Configurable;
- import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
- import org.apache.cloudstack.managed.context.ManagedContext;
- import org.apache.cloudstack.managed.context.ManagedContextRunnable;
- import org.apache.cloudstack.management.ManagementServerHost;
- import org.apache.log4j.Logger;
- import org.apache.log4j.NDC;
- 
--import com.cloud.agent.AgentManager;
--import com.cloud.alert.AlertManager;
--import com.cloud.cluster.ClusterManagerListener;
- import com.cloud.configuration.Config;
  import com.cloud.dc.ClusterDetailsDao;
  import com.cloud.dc.DataCenterVO;
  import com.cloud.dc.HostPodVO;
@@@ -103,14 -100,11 +97,16 @@@ import javax.naming.ConfigurationExcept
   *         ha.retry.wait | time to wait before retrying the work item | seconds | 120 || || stop.retry.wait | time to wait
   *         before retrying the stop | seconds | 120 || * }
   **/
- public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvailabilityManager, ClusterManagerListener, Configurable {
+ public class HighAvailabilityManagerImpl extends ManagerBase implements Configurable, HighAvailabilityManager, ClusterManagerListener {
+ 
+     private static final int SECONDS_TO_MILLISECONDS_FACTOR = 1000;
  
      protected static final Logger s_logger = Logger.getLogger(HighAvailabilityManagerImpl.class);
 +    private ConfigKey<Integer> MaxRetries = new ConfigKey<>("Advanced", Integer.class,
 +            "max.retries","5",
 +            "Total number of attempts for trying migration of a VM.",
 +            true, ConfigKey.Scope.Cluster);
 +
      WorkerThread[] _workers;
      boolean _stopped;
      long _timeToSleep;
@@@ -1037,17 -988,23 +1015,37 @@@
          return haWorks.size() > 0;
      }
  
 +    @Override
 +    public boolean hasPendingMigrationsWork(long vmId) {
 +        List<HaWorkVO> haWorks = _haDao.listPendingMigrationsForVm(vmId);
 +        for (HaWorkVO work : haWorks) {
 +            if (work.getTimesTried() <= _maxRetries) {
 +                return true;
 +            } else {
 +                s_logger.warn("HAWork Job of migration type " + work + " found in database which has max " +
 +                        "retries more than " + _maxRetries + " but still not in Done, Cancelled, or Error State");
 +            }
 +        }
 +        return false;
 +    }
++
+     /**
+      * @return The name of the component that provided this configuration
+      * variable.  This value is saved in the database so someone can easily
+      * identify who provides this variable.
+      **/
+     @Override
+     public String getConfigComponentName() {
+         return HighAvailabilityManager.class.getSimpleName();
+     }
+ 
+     /**
+      * @return The list of config keys provided by this configuable.
+      */
+     @Override
+     public ConfigKey<?>[] getConfigKeys() {
+         return new ConfigKey[] {TimeBetweenCleanup, MaxRetries, TimeToSleep, TimeBetweenFailures,
+             StopRetryInterval, RestartRetryInterval, MigrateRetryInterval, InvestigateRetryInterval,
+             HAWorkers, ForceHA};
+     }
  }