mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Native HA support improvements
This commit is contained in:
parent
1f8c4864d6
commit
33d804846f
@ -702,8 +702,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
|
||||
+ discoverer.getName());
|
||||
}
|
||||
if (resources != null) {
|
||||
for (Map.Entry<? extends ServerResource, Map<String, String>> entry : resources
|
||||
.entrySet()) {
|
||||
for (Map.Entry<? extends ServerResource, Map<String, String>> entry : resources.entrySet()) {
|
||||
ServerResource resource = entry.getKey();
|
||||
AgentAttache attache = simulateStart(resource,
|
||||
entry.getValue(), true);
|
||||
@ -720,8 +719,12 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
|
||||
|
||||
s_logger.warn("Unable to find the server resources at " + url);
|
||||
throw new DiscoveryException("Unable to add the external cluster");
|
||||
} catch(Throwable e) {
|
||||
s_logger.error("Unexpected exception ", e);
|
||||
throw new DiscoveryException("Unable to add the external cluster due to unhandled exception");
|
||||
} finally {
|
||||
if (!success) {
|
||||
_clusterDetailsDao.deleteDetails(clusterId);
|
||||
_clusterDao.remove(clusterId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ public interface ClusterDetailsDao extends GenericDao<ClusterDetailsVO, Long> {
|
||||
Map<String, String> findDetails(long clusterId);
|
||||
|
||||
void persist(long clusterId, Map<String, String> details);
|
||||
void persist(long clusterId, String name, String value);
|
||||
|
||||
ClusterDetailsVO findDetail(long clusterId, String name);
|
||||
|
||||
|
||||
@ -74,4 +74,19 @@ public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void persist(long clusterId, String name, String value) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
SearchCriteria<ClusterDetailsVO> sc = DetailSearch.create();
|
||||
sc.setParameters("clusterId", clusterId);
|
||||
sc.setParameters("name", name);
|
||||
expunge(sc);
|
||||
|
||||
ClusterDetailsVO vo = new ClusterDetailsVO(clusterId, name, value);
|
||||
persist(vo);
|
||||
txn.commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ public abstract class Task implements Runnable {
|
||||
public final void run() {
|
||||
try {
|
||||
doTask(this);
|
||||
} catch (Exception e) {
|
||||
} catch (Throwable e) {
|
||||
s_logger.warn("Caught the following exception but pushing on", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user