diff --git a/api/src/com/cloud/api/commands/AddHostCmd.java b/api/src/com/cloud/api/commands/AddHostCmd.java index 71810ea5756..a2440343329 100644 --- a/api/src/com/cloud/api/commands/AddHostCmd.java +++ b/api/src/com/cloud/api/commands/AddHostCmd.java @@ -67,13 +67,13 @@ public class AddHostCmd extends BaseCmd { @Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the host") private String hypervisor; - @Parameter(name=ApiConstants.HOST_CPU_CAPACITY, type=CommandType.LONG, description="Only for hypervisor is BareMetal, HZ per CPU of host") - private Long cpuCapacity; + @Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.LONG, description="Only for hypervisor is BareMetal, HZ per CPU of host") + private Long cpuSpeed; - @Parameter(name=ApiConstants.HOST_CPU_NUM, type=CommandType.LONG, description="Only for hypervisor is BareMetal, number of CPU on host") + @Parameter(name=ApiConstants.CPU_NUMBER, type=CommandType.LONG, description="Only for hypervisor is BareMetal, number of CPU on host") private Long cpuNum; - @Parameter(name=ApiConstants.HOST_MEM_CAPACITY, type=CommandType.LONG, description="Only for hypervisor is BareMetal, memory capacity of host(in MB)") + @Parameter(name=ApiConstants.MEMORY, type=CommandType.LONG, description="Only for hypervisor is BareMetal, memory capacity of host(in MB)") private Long memCapacity; @Parameter(name=ApiConstants.HOST_MAC, type=CommandType.STRING, description="Only for hypervisor is BareMetal, Mac of PXE nic") @@ -127,8 +127,8 @@ public class AddHostCmd extends BaseCmd { return hostTags; } - public Long getCpuCapacity() { - return cpuCapacity; + public Long getCpuSpeed() { + return cpuSpeed; } public Long getCpuNum() { diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 4e3adef32a5..f7b52d8285e 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -753,7 +753,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, String username = cmd.getUsername(); String password = cmd.getPassword(); Long memCapacity = cmd.getMemCapacity(); - Long cpuCapacity = cmd.getCpuCapacity(); + Long cpuSpeed = cmd.getCpuSpeed(); Long cpuNum = cmd.getCpuNum(); String mac = cmd.getMac(); String hostTag = cmd.getHostTag(); @@ -768,8 +768,8 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, if (memCapacity == null) { memCapacity = Long.valueOf(0); } - if (cpuCapacity == null) { - cpuCapacity = Long.valueOf(0); + if (cpuSpeed == null) { + cpuSpeed = Long.valueOf(0); } if (cpuNum == null) { cpuNum = Long.valueOf(0); @@ -779,7 +779,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, } bareMetalParams.put("cpuNum", cpuNum.toString()); - bareMetalParams.put("cpuCapacity", cpuCapacity.toString()); + bareMetalParams.put("cpuCapacity", cpuSpeed.toString()); bareMetalParams.put("memCapacity", memCapacity.toString()); bareMetalParams.put("mac", mac); if (hostTag != null) { diff --git a/ui/jsp/resource.jsp b/ui/jsp/resource.jsp index 3369749a34a..b03207c4f5e 100644 --- a/ui/jsp/resource.jsp +++ b/ui/jsp/resource.jsp @@ -866,7 +866,7 @@
  1. + :
  2. + +
  3. + + + +
  4. +
  5. + + + +
  6. +
  7. + + + +
  8. +
  9. + + + +
  10. +
  11. + + + +
diff --git a/ui/scripts/cloud.core.resource.js b/ui/scripts/cloud.core.resource.js index ff6ca1516c3..a6a10a6f9bc 100644 --- a/ui/scripts/cloud.core.resource.js +++ b/ui/scripts/cloud.core.resource.js @@ -838,10 +838,16 @@ function initAddHostShortcut() { if(clusterObj.hypervisortype == "VMware") { $('li[input_group="vmware"]', $dialogAddHost).show(); $('li[input_group="general"]', $dialogAddHost).hide(); - } else { + $('li[input_group="baremetal"]', $dialogAddHost).hide(); + } else if (clusterObj.hypervisortype == "BareMetal") { + $('li[input_group="vmware"]', $dialogAddHost).hide(); + $('li[input_group="general"]', $dialogAddHost).show(); + $('li[input_group="baremetal"]', $dialogAddHost).show(); + } else { $('li[input_group="vmware"]', $dialogAddHost).hide(); $('li[input_group="general"]', $dialogAddHost).show(); - } + $('li[input_group="baremetal"]', $dialogAddHost).hide(); + } }); $("#add_host_shortcut").unbind("click").bind("click", function(event) { @@ -871,11 +877,17 @@ function initAddHostShortcut() { isValid &= validateString("vCenter Password", $thisDialog.find("#host_vcenter_password"), $thisDialog.find("#host_vcenter_password_errormsg")); isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg")); isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg")); - } else { - isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg")); - isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg")); - isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg")); - } + } else { + if (hypervisor == "BareMetal") { + isValid &= validateString("CPU Cores", $thisDialog.find("#host_baremetal_cpucores"), $thisDialog.find("#host_baremetal_cpucores_errormsg")); + isValid &= validateString("CPU", $thisDialog.find("#host_baremetal_cpu"), $thisDialog.find("#host_baremetal_cpu_errormsg")); + isValid &= validateString("Memory", $thisDialog.find("#host_baremetal_memory"), $thisDialog.find("#host_baremetal_memory_errormsg")); + isValid &= validateString("MAC", $thisDialog.find("#host_baremetal_mac"), $thisDialog.find("#host_baremetal_mac_errormsg")); + } + isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg")); + isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg")); + isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg")); + } } if (!isValid) return; @@ -921,6 +933,19 @@ function initAddHostShortcut() { array1.push("&url="+todb(url)); } else { + if (hypervisor == "BareMetal") { + var cpuCores = trim($thisDialog.find("#host_baremetal_cpucores").val()); + array1.push("&cpunumber="+todb(cpuCores)); + + var cpuSpeed = trim($thisDialog.find("#host_baremetal_cpu").val()); + array1.push("&cpuspeeed="+todb(cpuSpeed)); + + var memory = trim($thisDialog.find("#host_baremetal_memory").val()); + array1.push("&memory="+todb(memory)); + + var mac = trim($thisDialog.find("#host_baremetal_mac").val()); + array1.push("&hostmac="+todb(mac)); + } var username = trim($thisDialog.find("#host_username").val()); array1.push("&username="+todb(username));