Skip to content

Commit e8c2fa4

Browse files
committed
Remove baremetal specific parameters from AddHostCmd
1 parent ac7d731 commit e8c2fa4

7 files changed

Lines changed: 8 additions & 63 deletions

File tree

‎api/src/com/cloud/api/commands/AddHostCmd.java‎

100644100755
Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,7 @@ public class AddHostCmd extends BaseCmd {
6767

6868
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the host")
6969
private String hypervisor;
70-
71-
@Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.LONG, description="Only for hypervisor is BareMetal, HZ per CPU of host")
72-
private Long cpuSpeed;
73-
74-
@Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.LONG, description="Only for hypervisor is BareMetal, number of CPU on host")
75-
private Long cpuNum;
76-
77-
@Parameter(name=ApiConstants.MEMORY, type=CommandType.LONG, description="Only for hypervisor is BareMetal, memory capacity of host(in MB)")
78-
private Long memCapacity;
79-
80-
@Parameter(name=ApiConstants.HOST_MAC, type=CommandType.STRING, description="Only for hypervisor is BareMetal, Mac of PXE nic")
81-
private String mac;
82-
70+
8371
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Host for allocation of new resources")
8472
private String allocationState;
8573

@@ -125,22 +113,6 @@ public String getHypervisor() {
125113
public List<String> getHostTags() {
126114
return hostTags;
127115
}
128-
129-
public Long getCpuSpeed() {
130-
return cpuSpeed;
131-
}
132-
133-
public Long getCpuNum() {
134-
return cpuNum;
135-
}
136-
137-
public Long getMemCapacity() {
138-
return memCapacity;
139-
}
140-
141-
public String getMac() {
142-
return mac;
143-
}
144116

145117
public String getAllocationState() {
146118
return allocationState;

‎server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public boolean processTimeout(long agentId, long seq) {
124124
@Override
125125
public Map<? extends ServerResource, Map<String, String>> find(long dcId,
126126
Long podId, Long clusterId, URI uri, String username,
127-
String password) throws DiscoveryException {
127+
String password, List<String> hostTags) throws DiscoveryException {
128128

129129
ClusterVO cluster = _clusterDao.findById(clusterId);
130130
if(cluster == null || cluster.getHypervisorType() != HypervisorType.KVM) {

‎server/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected XcpServerDiscoverer() {
111111
}
112112

113113
@Override
114-
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url, String username, String password) throws DiscoveryException {
114+
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List<String> hostTags) throws DiscoveryException {
115115
Map<CitrixResourceBase, Map<String, String>> resources = new HashMap<CitrixResourceBase, Map<String, String>>();
116116
Connection conn = null;
117117
if (!url.getScheme().equals("http")) {

‎server/src/com/cloud/resource/Discoverer.java‎

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public interface Discoverer extends Adapter {
3939
* @param password
4040
* @return ServerResource
4141
*/
42-
Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI uri, String username, String password) throws DiscoveryException;
42+
Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI uri, String username, String password, List<String> hostTags) throws DiscoveryException;
4343

4444
void postDiscovery(List<HostVO> hosts, long msId) throws DiscoveryException;
4545

‎server/src/com/cloud/resource/DummyHostDiscoverer.java‎

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DummyHostDiscoverer implements Discoverer {
3939
private String _name;
4040

4141
@Override
42-
public Map<ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url, String username, String password) {
42+
public Map<ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List<String> hostTags) {
4343
if (!url.getScheme().equals("dummy")) {
4444
return null;
4545
}

‎server/src/com/cloud/resource/ResourceManagerImpl.java‎

100644100755
Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws Illegal
254254

255255
List<HostVO> hosts = new ArrayList<HostVO>();
256256
Map<? extends ServerResource, Map<String, String>> resources = null;
257-
resources = discoverer.find(dcId, podId, clusterId, uri, username, password);
257+
resources = discoverer.find(dcId, podId, clusterId, uri, username, password, null);
258258

259259
if (resources != null) {
260260
for (Map.Entry<? extends ServerResource, Map<String, String>> entry : resources.entrySet()) {
@@ -306,12 +306,7 @@ public List<? extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgument
306306
String url = cmd.getUrl();
307307
String username = cmd.getUsername();
308308
String password = cmd.getPassword();
309-
Long memCapacity = cmd.getMemCapacity();
310-
Long cpuSpeed = cmd.getCpuSpeed();
311-
Long cpuNum = cmd.getCpuNum();
312-
String mac = cmd.getMac();
313309
List<String> hostTags = cmd.getHostTags();
314-
Map<String, String> bareMetalParams = new HashMap<String, String>();
315310

316311
dcId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), dcId);
317312

@@ -334,28 +329,6 @@ public List<? extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgument
334329
}
335330
}
336331

337-
if (cmd.getHypervisor().equalsIgnoreCase(Hypervisor.HypervisorType.BareMetal.toString())) {
338-
if (memCapacity == null) {
339-
memCapacity = Long.valueOf(0);
340-
}
341-
if (cpuSpeed == null) {
342-
cpuSpeed = Long.valueOf(0);
343-
}
344-
if (cpuNum == null) {
345-
cpuNum = Long.valueOf(0);
346-
}
347-
if (mac == null) {
348-
mac = "unknown";
349-
}
350-
351-
bareMetalParams.put("cpuNum", cpuNum.toString());
352-
bareMetalParams.put("cpuCapacity", cpuSpeed.toString());
353-
bareMetalParams.put("memCapacity", memCapacity.toString());
354-
bareMetalParams.put("mac", mac);
355-
if (hostTags != null && hostTags.size() > 0) {
356-
bareMetalParams.put("hostTag", hostTags.get(0));
357-
}
358-
}
359332
String allocationState = cmd.getAllocationState();
360333
if (allocationState == null) {
361334
allocationState = Host.HostAllocationState.Enabled.toString();
@@ -480,7 +453,7 @@ private List<HostVO> discoverHostsFull(Long dcId, Long podId, Long clusterId, St
480453
Map<? extends ServerResource, Map<String, String>> resources = null;
481454

482455
try {
483-
resources = discoverer.find(dcId, podId, clusterId, uri, username, password);
456+
resources = discoverer.find(dcId, podId, clusterId, uri, username, password, hostTags);
484457
} catch(DiscoveryException e) {
485458
throw e;
486459
} catch (Exception e) {

‎server/src/com/cloud/storage/secondary/SecondaryStorageDiscoverer.java‎

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected SecondaryStorageDiscoverer() {
8383
}
8484

8585
@Override
86-
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI uri, String username, String password) {
86+
public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI uri, String username, String password, List<String> hostTags) {
8787
if (!uri.getScheme().equalsIgnoreCase("nfs") && !uri.getScheme().equalsIgnoreCase("file")
8888
&& !uri.getScheme().equalsIgnoreCase("iso") && !uri.getScheme().equalsIgnoreCase("dummy")) {
8989
s_logger.debug("It's not NFS or file or ISO, so not a secondary storage server: " + uri.toString());

0 commit comments

Comments
 (0)