bug 5934: if it is standalone, give cluser name as Standalone-ip/name

status 5934: resolved fixed

Conflicts:

	server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
This commit is contained in:
Anthony Xu 2010-08-18 17:33:25 -07:00
parent 09680d80a7
commit 41f7c745bd
2 changed files with 8 additions and 18 deletions

View File

@ -75,6 +75,13 @@ public class AddHostCmd extends BaseCmd {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Can't specify cluster by both id and name");
}
if (clusterName == null && clusterId == null) {
// Stand alone, assign a name to it
String[] stringarray = url.split("//");
String address = stringarray[stringarray.length - 1];
clusterName = "Standalone-" + address;
}
if ((clusterName != null || clusterId != null) && podId == null) {
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Can't specify cluster without specifying the pod");
}

View File

@ -81,7 +81,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
protected String _privateNic;
protected String _storageNic1;
protected String _storageNic2;
protected boolean _formPoolsInPod;
protected int _wait;
protected XenServerConnectionPool _connPool;
protected String _increase;
@ -132,19 +131,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
String cluster = null;
if (clusterId != null) {
cluster = Long.toString(clusterId);
} else if (_formPoolsInPod) {
if (podId != null) {
List<ClusterVO> clusters = _clusterDao.listByPodId(podId);
if (clusters.size() > 1) {
throw new DiscoveryException("There are more than one cluster in the pod and we don't know which to add to.");
} else if (clusters.size() == 1) {
clusterId = clusters.get(0).getId();
cluster = Long.toString(clusterId);
} else {
Map<Pool, Pool.Record> pools = Pool.getAllRecords(conn);
cluster = pools.values().iterator().next().uuid;
}
}
}
Map<Host, Host.Record> hosts = Host.getAllRecords(conn);
@ -300,7 +286,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
if ( resources.size() == 0 ) {
return false;
}
if (clusterId == null && !_formPoolsInPod) {
if (clusterId == null ) {
if (resources.size() > 1) {
s_logger.warn("There's no cluster specified but we found a pool of xenservers " + resources.size());
throw new DiscoveryException("There's no cluster specified but we found a pool of xenservers " + resources.size());
@ -439,9 +425,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
value = _params.get("xen.check.hvm");
_checkHvm = value == null ? true : Boolean.parseBoolean(value);
value = _params.get(Config.CreatePoolsInPod.key());
_formPoolsInPod = Boolean.parseBoolean(value);
_connPool = XenServerConnectionPool.getInstance();
_agentMgr.registerForHostEvents(this, true, false, true);