bug 7007: if host is added before, refused to add it

status 7007: resolved fixed
This commit is contained in:
edison 2010-11-04 15:01:58 -07:00
parent f4e2631dbe
commit 1c7e3649d2
1 changed files with 7 additions and 2 deletions

View File

@ -197,6 +197,12 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
InetAddress ia = InetAddress.getByName(hostname);
agentIp = ia.getHostAddress();
String guid = UUID.nameUUIDFromBytes(agentIp.getBytes()).toString();
guid = guid + "-LibvirtComputingResource";/*tail added by agent.java*/
if (_hostDao.findByGuid(guid) != null) {
s_logger.debug("Skipping " + agentIp + " because " + guid + " is already in the database.");
return null;
}
sshConnection = new com.trilead.ssh2.Connection(agentIp, 22);
sshConnection.connect(null, 60000, 60000);
@ -218,8 +224,7 @@ public class KvmServerDiscoverer extends DiscovererBase implements Discoverer,
KvmDummyResourceBase kvmResource = new KvmDummyResourceBase();
Map<String, Object> params = new HashMap<String, Object>();
guid = guid + "-LibvirtComputingResource";/*tail added by agent.java*/
params.put("zone", Long.toString(dcId));
params.put("pod", Long.toString(podId));
params.put("cluster", Long.toString(clusterId));