mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fix add host
This commit is contained in:
parent
eed58597f2
commit
47380dc20e
@ -39,7 +39,7 @@ import com.cloud.utils.script.Script;
|
||||
public class KVMHABase {
|
||||
private long _timeout = 60000; /*1 minutes*/
|
||||
protected static String _heartBeatPath;
|
||||
protected long _heartBeatUpdateTimeout = 5000; /*5 sec*/
|
||||
protected long _heartBeatUpdateTimeout = 60000;
|
||||
protected long _heartBeatUpdateFreq = 60000;
|
||||
protected long _heartBeatUpdateMaxRetry = 3;
|
||||
public static enum PoolType {
|
||||
|
||||
@ -33,7 +33,7 @@ public class KVMHAChecker extends KVMHABase implements Callable<Boolean> {
|
||||
private static final Logger s_logger = Logger.getLogger(KVMHAChecker.class);
|
||||
private List<NfsStoragePool> _pools;
|
||||
private String _hostIP;
|
||||
private long _heartBeatCheckerTimeout = 300000; /*5 minutes*/
|
||||
private long _heartBeatCheckerTimeout = 360000; /*6 minutes*/
|
||||
public KVMHAChecker(List<NfsStoragePool> pools, String host) {
|
||||
this._pools = pools;
|
||||
this._hostIP = host;
|
||||
@ -50,7 +50,7 @@ public class KVMHAChecker extends KVMHABase implements Callable<Boolean> {
|
||||
cmd.add("-m", pool._mountDestPath);
|
||||
cmd.add("-h", _hostIP);
|
||||
cmd.add("-r");
|
||||
cmd.add("-t", String.valueOf(_heartBeatUpdateFreq/1000 * 2));
|
||||
cmd.add("-t", String.valueOf((_heartBeatUpdateFreq + _heartBeatUpdateTimeout)/1000 * 2));
|
||||
OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
|
||||
String result = cmd.execute(parser);
|
||||
s_logger.debug("pool: " + pool._poolIp);
|
||||
|
||||
@ -229,15 +229,6 @@ public class LibvirtStorageResource {
|
||||
s_logger.debug(spd.toString());
|
||||
addStoragePool(uuid);
|
||||
|
||||
synchronized (getStoragePool(uuid)) {
|
||||
sp = conn.storagePoolDefineXML(spd.toString(), 0);
|
||||
|
||||
if (sp == null) {
|
||||
s_logger.debug("Failed to define storage pool");
|
||||
return null;
|
||||
}
|
||||
sp.create(0);
|
||||
}
|
||||
} else if (protocal.equalsIgnoreCase("DIR")) {
|
||||
_storageLayer.mkdir(targetPath);
|
||||
spd = new LibvirtStoragePoolDef(poolType.DIR, uuid, uuid,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ import com.cloud.utils.db.GenericSearchBuilder;
|
||||
import com.cloud.utils.db.JoinBuilder;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Func;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
@ -84,7 +85,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
|
||||
AvailHyperSearch = createSearchBuilder();
|
||||
AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
AvailHyperSearch.groupBy(AvailHyperSearch.entity().getHypervisorType());
|
||||
AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType());
|
||||
AvailHyperSearch.done();
|
||||
}
|
||||
|
||||
|
||||
@ -162,26 +162,26 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
|
||||
throw new DiscoveredWithErrorException("Authetication error");
|
||||
}
|
||||
|
||||
if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "lsmod|grep kvm >& /dev/null", 3)) {
|
||||
if (!SSHCmdHelper.sshExecuteCmd(sshConnection, "lsmod|grep kvm", 3)) {
|
||||
s_logger.debug("It's not a KVM enabled machine");
|
||||
return null;
|
||||
}
|
||||
|
||||
String parameters = " -m=" + _hostIp + " -z=" + dcId + " -p=" + podId + " -c=" + clusterId + " -g=" + guid + " -a";
|
||||
String parameters = " -m " + _hostIp + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a";
|
||||
|
||||
if (_kvmPublicNic != null) {
|
||||
parameters += " --pubNic= " + _kvmPublicNic;
|
||||
parameters += " --pubNic=" + _kvmPublicNic;
|
||||
}
|
||||
|
||||
if (_kvmPrivateNic != null) {
|
||||
parameters += " --prvNic= " + _kvmPrivateNic;
|
||||
parameters += " --prvNic=" + _kvmPrivateNic;
|
||||
}
|
||||
|
||||
if (_kvmGuestNic != null) {
|
||||
parameters += " --guestNic=" + _kvmGuestNic;
|
||||
}
|
||||
|
||||
SSHCmdHelper.sshExecuteCmd(sshConnection, "cloud-setup-agent " + parameters + " >& /dev/null", 3);
|
||||
SSHCmdHelper.sshExecuteCmd(sshConnection, "cloud-setup-agent " + parameters, 3);
|
||||
|
||||
KvmDummyResourceBase kvmResource = new KvmDummyResourceBase();
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
|
||||
@ -142,7 +142,8 @@ public class SSHCmdHelper {
|
||||
}
|
||||
}
|
||||
|
||||
s_logger.debug(cmd + " output:" + new String(buffer));
|
||||
if (buffer[0] != 0)
|
||||
s_logger.debug(cmd + " output:" + new String(buffer));
|
||||
|
||||
Thread.sleep(1000);
|
||||
return sshSession.getExitStatus();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user