mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'baremetal' to master
modifies: api/src/com/cloud/api/ApiConstants.java api/src/com/cloud/api/commands/AddHostCmd.java api/src/com/cloud/api/commands/CreatePodCmd.java api/src/com/cloud/api/commands/DeployVMCmd.java api/src/com/cloud/dc/Pod.java api/src/com/cloud/network/NetworkService.java server/src/com/cloud/agent/manager/AgentManagerImpl.java server/src/com/cloud/configuration/ConfigurationManagerImpl.java server/src/com/cloud/dc/HostPodVO.java server/src/com/cloud/network/NetworkManager.java server/src/com/cloud/network/NetworkManagerImpl.java server/src/com/cloud/vm/UserVmManagerImpl.java setup/db/create-schema.sql utils/src/com/cloud/utils/SerialVersionUID.java
This commit is contained in:
commit
105db3b15a
@ -10,5 +10,4 @@ public class PrepareLinMinPxeServerAnswer extends Answer {
|
|||||||
public PrepareLinMinPxeServerAnswer(PrepareLinMinPxeServerCommand cmd, String details) {
|
public PrepareLinMinPxeServerAnswer(PrepareLinMinPxeServerCommand cmd, String details) {
|
||||||
super(cmd, false, details);
|
super(cmd, false, details);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,62 +2,9 @@ package com.cloud.agent.api.baremetal;
|
|||||||
|
|
||||||
import com.cloud.agent.api.Command;
|
import com.cloud.agent.api.Command;
|
||||||
|
|
||||||
public class PrepareLinMinPxeServerCommand extends Command {
|
public class PrepareLinMinPxeServerCommand extends PreparePxeServerCommand {
|
||||||
String ip;
|
|
||||||
String mac;
|
|
||||||
String netMask;
|
|
||||||
String gateway;
|
|
||||||
String dns;
|
|
||||||
String template;
|
|
||||||
String vmName;
|
|
||||||
String hostName;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean executeInSequence() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PrepareLinMinPxeServerCommand(String ip, String mac, String netMask, String gateway, String dns, String template, String vmName, String hostName) {
|
public PrepareLinMinPxeServerCommand(String ip, String mac, String netMask, String gateway, String dns, String template, String vmName, String hostName) {
|
||||||
this.ip = ip;
|
super(ip, mac, netMask, gateway, dns, template, vmName, hostName);
|
||||||
this.mac = mac;
|
|
||||||
this.netMask = netMask;
|
|
||||||
this.gateway = gateway;
|
|
||||||
this.dns = dns;
|
|
||||||
this.template = template;
|
|
||||||
this.vmName = vmName;
|
|
||||||
this.hostName = hostName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIp() {
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMac() {
|
|
||||||
return mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNetMask() {
|
|
||||||
return netMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGateWay() {
|
|
||||||
return gateway;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDns() {
|
|
||||||
return dns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTemplate() {
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVmName() {
|
|
||||||
return vmName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHostName() {
|
|
||||||
return hostName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
package com.cloud.agent.api.baremetal;
|
||||||
|
|
||||||
|
import com.cloud.agent.api.Answer;
|
||||||
|
|
||||||
|
public class PreparePxeServerAnswer extends Answer {
|
||||||
|
public PreparePxeServerAnswer(PreparePxeServerCommand cmd) {
|
||||||
|
super(cmd, true, "SUCCESS");
|
||||||
|
}
|
||||||
|
|
||||||
|
public PreparePxeServerAnswer(PreparePxeServerCommand cmd, String details) {
|
||||||
|
super(cmd, false, details);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.cloud.agent.api.baremetal;
|
||||||
|
|
||||||
|
import com.cloud.agent.api.Command;
|
||||||
|
|
||||||
|
public class PreparePxeServerCommand extends Command {
|
||||||
|
|
||||||
|
String ip;
|
||||||
|
String mac;
|
||||||
|
String netMask;
|
||||||
|
String gateway;
|
||||||
|
String dns;
|
||||||
|
String template;
|
||||||
|
String vmName;
|
||||||
|
String hostName;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean executeInSequence() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PreparePxeServerCommand(String ip, String mac, String netMask, String gateway, String dns, String template, String vmName, String hostName) {
|
||||||
|
this.ip = ip;
|
||||||
|
this.mac = mac;
|
||||||
|
this.netMask = netMask;
|
||||||
|
this.gateway = gateway;
|
||||||
|
this.dns = dns;
|
||||||
|
this.template = template;
|
||||||
|
this.vmName = vmName;
|
||||||
|
this.hostName = hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMac() {
|
||||||
|
return mac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetMask() {
|
||||||
|
return netMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGateWay() {
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDns() {
|
||||||
|
return dns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTemplate() {
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVmName() {
|
||||||
|
return vmName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHostName() {
|
||||||
|
return hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -24,6 +24,9 @@ public class DhcpEntryCommand extends NetworkElementCommand {
|
|||||||
String vmMac;
|
String vmMac;
|
||||||
String vmIpAddress;
|
String vmIpAddress;
|
||||||
String vmName;
|
String vmName;
|
||||||
|
String dns;
|
||||||
|
String gateway;
|
||||||
|
String nextServer;
|
||||||
|
|
||||||
protected DhcpEntryCommand() {
|
protected DhcpEntryCommand() {
|
||||||
|
|
||||||
@ -40,6 +43,20 @@ public class DhcpEntryCommand extends NetworkElementCommand {
|
|||||||
this.vmName = vmName;
|
this.vmName = vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String dns, String gateway) {
|
||||||
|
this(vmMac, vmIpAddress, vmName);
|
||||||
|
this.dns = dns;
|
||||||
|
this.gateway = gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDns() {
|
||||||
|
return dns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGateway() {
|
||||||
|
return gateway;
|
||||||
|
}
|
||||||
|
|
||||||
public String getVmMac() {
|
public String getVmMac() {
|
||||||
return vmMac;
|
return vmMac;
|
||||||
}
|
}
|
||||||
@ -52,4 +69,12 @@ public class DhcpEntryCommand extends NetworkElementCommand {
|
|||||||
return vmName;
|
return vmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNextServer(String ip) {
|
||||||
|
nextServer = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNextServer() {
|
||||||
|
return nextServer;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,5 +215,9 @@ public class ApiConstants {
|
|||||||
public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
|
public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
|
||||||
public static final String ALLOCATION_STATE = "allocationstate";
|
public static final String ALLOCATION_STATE = "allocationstate";
|
||||||
public static final String STORAGE_ID="storageid";
|
public static final String STORAGE_ID="storageid";
|
||||||
|
public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
|
||||||
|
public static final String PING_DIR = "pingdir";
|
||||||
|
public static final String TFTP_DIR = "tftpdir";
|
||||||
|
public static final String PING_CIFS_USERNAME = "pingcifsusername";
|
||||||
|
public static final String PING_CIFS_PASSWORD = "pingcifspassword";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,21 +68,18 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the host")
|
@Parameter(name=ApiConstants.HYPERVISOR, type=CommandType.STRING, required=true, description="hypervisor type of the host")
|
||||||
private String hypervisor;
|
private String hypervisor;
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.HOST_CPU_CAPACITY, type=CommandType.LONG, description="Only for hypervisor is BareMetal, HZ per CPU of host")
|
@Parameter(name=ApiConstants.CPU_SPEED, type=CommandType.LONG, description="Only for hypervisor is BareMetal, HZ per CPU of host")
|
||||||
private Long cpuCapacity;
|
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;
|
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;
|
private Long memCapacity;
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.HOST_MAC, type=CommandType.STRING, description="Only for hypervisor is BareMetal, Mac of PXE nic")
|
@Parameter(name=ApiConstants.HOST_MAC, type=CommandType.STRING, description="Only for hypervisor is BareMetal, Mac of PXE nic")
|
||||||
private String mac;
|
private String mac;
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.HOST_TAG, type=CommandType.STRING, description="Only for hypervisor is BareMetal, Tag of host")
|
|
||||||
private String hostTag;
|
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Host for allocation of new resources")
|
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Host for allocation of new resources")
|
||||||
private String allocationState;
|
private String allocationState;
|
||||||
|
|
||||||
@ -129,8 +126,8 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
return hostTags;
|
return hostTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCpuCapacity() {
|
public Long getCpuSpeed() {
|
||||||
return cpuCapacity;
|
return cpuSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getCpuNum() {
|
public Long getCpuNum() {
|
||||||
@ -145,10 +142,6 @@ public class AddHostCmd extends BaseCmd {
|
|||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHostTag() {
|
|
||||||
return hostTag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAllocationState() {
|
public String getAllocationState() {
|
||||||
return allocationState;
|
return allocationState;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,8 @@ import com.cloud.api.Parameter;
|
|||||||
import com.cloud.api.ServerApiException;
|
import com.cloud.api.ServerApiException;
|
||||||
import com.cloud.api.response.IPAddressResponse;
|
import com.cloud.api.response.IPAddressResponse;
|
||||||
import com.cloud.async.AsyncJob;
|
import com.cloud.async.AsyncJob;
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
@ -39,6 +41,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.IpAddress;
|
import com.cloud.network.IpAddress;
|
||||||
import com.cloud.network.Network;
|
import com.cloud.network.Network;
|
||||||
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.user.UserContext;
|
import com.cloud.user.UserContext;
|
||||||
|
|
||||||
@ -91,12 +94,23 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
|
|||||||
return networkId;
|
return networkId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataCenter zone = _configService.getZone(getZoneId());
|
||||||
|
if (zone.getNetworkType() == NetworkType.Advanced) {
|
||||||
List<? extends Network> networks = _networkService.getVirtualNetworksOwnedByAccountInZone(getAccountName(), getDomainId(), getZoneId());
|
List<? extends Network> networks = _networkService.getVirtualNetworksOwnedByAccountInZone(getAccountName(), getDomainId(), getZoneId());
|
||||||
if (networks.size() == 0) {
|
if (networks.size() == 0) {
|
||||||
throw new InvalidParameterValueException("Account name=" + getAccountName() + " domainId=" + getDomainId() + " doesn't have virtual networks in zone " + getZoneId());
|
throw new InvalidParameterValueException("Account name=" + getAccountName() + " domainId=" + getDomainId() + " doesn't have virtual networks in zone " + getZoneId());
|
||||||
}
|
}
|
||||||
assert (networks.size() <= 1) : "Too many virtual networks. This logic should be obsolete";
|
assert (networks.size() <= 1) : "Too many virtual networks. This logic should be obsolete";
|
||||||
return networks.get(0).getId();
|
return networks.get(0).getId();
|
||||||
|
} else {
|
||||||
|
Network defaultGuestNetwork = _networkService.getSystemNetworkByZoneAndTrafficType(zone.getId(), TrafficType.Guest);
|
||||||
|
|
||||||
|
if (defaultGuestNetwork == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find a default Guest network for account " + getAccountName() + " in domain id=" + getDomainId());
|
||||||
|
} else {
|
||||||
|
return defaultGuestNetwork.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -61,7 +61,6 @@ public class CreatePodCmd extends BaseCmd {
|
|||||||
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Pod for allocation of new resources")
|
@Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="Allocation state of this Pod for allocation of new resources")
|
||||||
private String allocationState;
|
private String allocationState;
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
/////////////////// Accessors ///////////////////////
|
/////////////////// Accessors ///////////////////////
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -31,4 +31,6 @@ public interface Pod extends Grouping {
|
|||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
AllocationState getAllocationState();
|
AllocationState getAllocationState();
|
||||||
|
|
||||||
|
boolean getExternalDhcp();
|
||||||
}
|
}
|
||||||
|
|||||||
28
api/src/com/cloud/exception/UnsupportedServiceException.java
Normal file
28
api/src/com/cloud/exception/UnsupportedServiceException.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cloud.exception;
|
||||||
|
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
|
public class UnsupportedServiceException extends CloudRuntimeException{
|
||||||
|
|
||||||
|
public UnsupportedServiceException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -34,6 +34,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
import com.cloud.network.Network.Capability;
|
import com.cloud.network.Network.Capability;
|
||||||
import com.cloud.network.Network.Service;
|
import com.cloud.network.Network.Service;
|
||||||
|
import com.cloud.network.Networks.TrafficType;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.user.Account;
|
import com.cloud.user.Account;
|
||||||
import com.cloud.vm.VirtualMachine.Type;
|
import com.cloud.vm.VirtualMachine.Type;
|
||||||
@ -80,4 +81,6 @@ public interface NetworkService {
|
|||||||
Network updateNetwork(long networkId, String name, String displayText, Account caller);
|
Network updateNetwork(long networkId, String name, String displayText, Account caller);
|
||||||
|
|
||||||
Integer getNetworkRate(long networkId, Long vmId);
|
Integer getNetworkRate(long networkId, Long vmId);
|
||||||
|
|
||||||
|
Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -213,6 +213,7 @@
|
|||||||
<fileset dir="${scripts.dir}">
|
<fileset dir="${scripts.dir}">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/fsimage.so"/>
|
<exclude name="**/fsimage.so"/>
|
||||||
|
<exclude name="**/ping.tar.bz2"/>
|
||||||
<exclude name="**/vhd-util"/>
|
<exclude name="**/vhd-util"/>
|
||||||
<exclude name="**/.*" />
|
<exclude name="**/.*" />
|
||||||
</fileset>
|
</fileset>
|
||||||
@ -223,6 +224,7 @@
|
|||||||
<copy todir="${scripts.target.dir}">
|
<copy todir="${scripts.target.dir}">
|
||||||
<fileset dir="${scripts.dir}">
|
<fileset dir="${scripts.dir}">
|
||||||
<include name="**/fsimage.so"/>
|
<include name="**/fsimage.so"/>
|
||||||
|
<include name="**/ping.tar.bz2"/>
|
||||||
<include name="**/vhd-util"/>
|
<include name="**/vhd-util"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|||||||
@ -304,6 +304,7 @@ Obsoletes: %{name}-premium-plugin-zynga < %{version}-%{release}
|
|||||||
Provides: %{name}-premium-vendor-zynga = %{version}-%{release}
|
Provides: %{name}-premium-vendor-zynga = %{version}-%{release}
|
||||||
Obsoletes: %{name}-premium-vendor-zynga < %{version}-%{release}
|
Obsoletes: %{name}-premium-vendor-zynga < %{version}-%{release}
|
||||||
Requires: java >= 1.6.0
|
Requires: java >= 1.6.0
|
||||||
|
Requires: ipmitool
|
||||||
Requires: %{name}-utils = %{version}
|
Requires: %{name}-utils = %{version}
|
||||||
License: CSL 1.1
|
License: CSL 1.1
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
|
|||||||
106
scripts/network/exdhcp/dhcpd_edithosts.py
Normal file
106
scripts/network/exdhcp/dhcpd_edithosts.py
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
# Usage: dhcpd_edithosts.py mac ip hostname dns gateway nextserver
|
||||||
|
import sys, os
|
||||||
|
from os.path import exists
|
||||||
|
from time import sleep
|
||||||
|
from os import remove
|
||||||
|
|
||||||
|
usage = '''dhcpd_edithosts.py mac ip hostname dns gateway nextserver'''
|
||||||
|
conf_path = "/etc/dhcpd.conf"
|
||||||
|
file_lock = "/etc/dhcpd.conf_locked"
|
||||||
|
sleep_max = 20
|
||||||
|
host_entry = 'host %s { hardware ethernet %s; fixed-address %s; option domain-name-servers %s; option domain-name "%s"; option routers %s; default-lease-time infinite; max-lease-time infinite; min-lease-time infinite; filename "pxelinux.0";}'
|
||||||
|
host_entry1 = 'host %s { hardware ethernet %s; fixed-address %s; option domain-name-servers %s; option domain-name "%s"; option routers %s; default-lease-time infinite; max-lease-time infinite; min-lease-time infinite; next-server %s; filename "pxelinux.0";}'
|
||||||
|
def lock():
|
||||||
|
if exists(file_lock):
|
||||||
|
count = 0
|
||||||
|
while(exists(file_lock)):
|
||||||
|
sleep(1)
|
||||||
|
count = count + 1
|
||||||
|
if count > sleep_max:
|
||||||
|
print "Can not get file lock at %s, time expired" % file_lock
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open(file_lock, "w")
|
||||||
|
f.close()
|
||||||
|
return True
|
||||||
|
except IOError,e:
|
||||||
|
print "Cannot create file lock at /etc/dhcpd.conf_locked,", e
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def unlock():
|
||||||
|
if exists(file_lock) == False:
|
||||||
|
print "Cannot find %s when unlocking, race condition happens" % file_lock
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
remove(file_lock)
|
||||||
|
return True
|
||||||
|
except IOError, e:
|
||||||
|
print "Cannot remove file lock at %s" % file_lock
|
||||||
|
return False
|
||||||
|
|
||||||
|
def insert_host_entry(mac, ip, hostname, dns, gateway, next_server):
|
||||||
|
if lock() == False:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
cmd = 'sed -i /"fixed-address %s"/d %s' % (ip, conf_path)
|
||||||
|
ret = os.system(cmd)
|
||||||
|
if ret != 0:
|
||||||
|
print "Command %s failed" % cmd
|
||||||
|
unlock()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
cmd = 'sed -i /"hardware ethernet %s"/d %s' % (mac, conf_path)
|
||||||
|
ret = os.system(cmd)
|
||||||
|
if ret != 0:
|
||||||
|
print "Command %s failed" % cmd
|
||||||
|
unlock()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if next_server != "null":
|
||||||
|
entry = host_entry1 % (hostname, mac, ip, dns, "cloudnine.internal", gateway, next_server)
|
||||||
|
else:
|
||||||
|
entry = host_entry % (hostname, mac, ip, dns, "cloudnine.internal", gateway)
|
||||||
|
cmd = '''echo '%s' >> %s''' % (entry, conf_path)
|
||||||
|
ret = os.system(cmd)
|
||||||
|
if ret != 0:
|
||||||
|
print "Command %s failed" % cmd
|
||||||
|
unlock()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
cmd = 'service dhcpd restart'
|
||||||
|
ret = os.system(cmd)
|
||||||
|
if ret != 0:
|
||||||
|
print "Command %s failed" % cmd
|
||||||
|
unlock()
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if unlock() == False:
|
||||||
|
return 1
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 7:
|
||||||
|
print usage
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
mac = sys.argv[1]
|
||||||
|
ip = sys.argv[2]
|
||||||
|
hostname = sys.argv[3]
|
||||||
|
dns = sys.argv[4]
|
||||||
|
gateway = sys.argv[5]
|
||||||
|
next_server = sys.argv[6]
|
||||||
|
|
||||||
|
if exists(conf_path) == False:
|
||||||
|
conf_path = "/etc/dhcp/dhcpd.conf"
|
||||||
|
if exists(conf_path) == False:
|
||||||
|
print "Cannot find dhcpd.conf"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
ret = insert_host_entry(mac, ip, hostname, dns, gateway, next_server)
|
||||||
|
sys.exit(ret)
|
||||||
|
|
||||||
@ -27,6 +27,8 @@ touch /var/log/dnsmasq.log
|
|||||||
[ $? -ne 0 ] && exit_with_error "touch /var/log/dnsmasq.log failed"
|
[ $? -ne 0 ] && exit_with_error "touch /var/log/dnsmasq.log failed"
|
||||||
touch /etc/dnsmasq-resolv.conf
|
touch /etc/dnsmasq-resolv.conf
|
||||||
[ $? -ne 0 ] && exit_with_error "touch /etc/dnsmasq-resolv.conf failed"
|
[ $? -ne 0 ] && exit_with_error "touch /etc/dnsmasq-resolv.conf failed"
|
||||||
|
echo "nameserver $dns">/etc/dnsmasq-resolv.conf
|
||||||
|
[ $? -ne 0 ] && exit_with_error "echo \"nameserver $dns\">/etc/dnsmasq-resolv.conf failed"
|
||||||
touch /var/lib/dnsmasq.trace
|
touch /var/lib/dnsmasq.trace
|
||||||
[ $? -ne 0 ] && exit_with_error "touch /var/lib/dnsmasq.trace failed"
|
[ $? -ne 0 ] && exit_with_error "touch /var/lib/dnsmasq.trace failed"
|
||||||
|
|
||||||
@ -159,13 +161,19 @@ config_dnsmasq "
|
|||||||
config_dnsmasq dhcp-script=/usr/bin/echoer.sh
|
config_dnsmasq dhcp-script=/usr/bin/echoer.sh
|
||||||
config_dnsmasq dhcp-scriptuser=root
|
config_dnsmasq dhcp-scriptuser=root
|
||||||
config_dnsmasq dhcp-authoritative
|
config_dnsmasq dhcp-authoritative
|
||||||
|
config_dnsmasq "
|
||||||
|
# Ignore any bootp and pxe boot request
|
||||||
|
"
|
||||||
|
config_dnsmasq dhcp-ignore=bootp
|
||||||
|
config_dnsmasq dhcp-vendorclass=pxestuff,PXEClient
|
||||||
|
config_dnsmasq dhcp-ignore=pxestuff
|
||||||
|
|
||||||
[ -f /usr/sbin/setenforce ] && /usr/sbin/setenforce 0
|
[ -f /usr/sbin/setenforce ] && /usr/sbin/setenforce 0
|
||||||
[ $? -ne 0 ] && exit_with_error "Can not set seLinux to passive mode"
|
[ $? -ne 0 ] && exit_with_error "Can not set seLinux to passive mode"
|
||||||
|
|
||||||
# Open DHCP ports in iptable
|
# Open DHCP ports in iptable
|
||||||
chkconfig --list iptables | grep "on"
|
chkconfig --list iptables | grep "on"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
iptables-save | grep 'A INPUT -p udp -m udp --dport 67 -j ACCEPT' >/dev/null
|
iptables-save | grep 'A INPUT -p udp -m udp --dport 67 -j ACCEPT' >/dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
iptables -I INPUT 1 -p udp --dport 67 -j ACCEPT
|
iptables -I INPUT 1 -p udp --dport 67 -j ACCEPT
|
||||||
|
|||||||
BIN
scripts/network/ping/ping.tar.bz2
Normal file
BIN
scripts/network/ping/ping.tar.bz2
Normal file
Binary file not shown.
64
scripts/network/ping/prepare_ping.sh
Normal file
64
scripts/network/ping/prepare_ping.sh
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# usage prepare_ping.sh subnet tftp_dir
|
||||||
|
|
||||||
|
dhcpd_conf=
|
||||||
|
subnet=$1
|
||||||
|
tftp_dir=$2
|
||||||
|
|
||||||
|
exit_with_error() {
|
||||||
|
echo $1
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_if_fail() {
|
||||||
|
[ $? -ne 0 ] && exit_with_error "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
config_dhcpd() {
|
||||||
|
echo "$*" >> $dhcpd_conf
|
||||||
|
[ $? -ne 0 ] && exit_with_error "echo $* failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
[ $# -ne 2 ] && exit_with_error "Usage:prepare_ping.sh subnet tftp_dir"
|
||||||
|
|
||||||
|
if [ -f "/etc/dhcp/dhcpd.conf" ]; then
|
||||||
|
dhcpd_conf="/etc/dhcp/dhcpd.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dhcpd_conf" == "x" ] && [ -f "/etc/dhcpd.conf" ]; then
|
||||||
|
dhcpd_conf="/etc/dhcpd.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dhcpd_conf" == "x" ]; then
|
||||||
|
exit_with_error "Cannot find dhcpd.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
signature=`head -n 1 $dhcpd_conf`
|
||||||
|
if [ x"$signature" != x"# CloudStack" ]; then
|
||||||
|
# prepare dhcpd
|
||||||
|
cp $dhcpd_conf /etc/dhcpd.conf.bak -f
|
||||||
|
exit_if_fail "Cannot back dhcpd.conf"
|
||||||
|
echo "# CloudStack" > $dhcpd_conf
|
||||||
|
echo "# This is produced by CloudStack" >> $dhcpd_conf
|
||||||
|
config_dhcpd ddns-update-style interim\;
|
||||||
|
config_dhcpd subnet $subnet netmask 255.255.255.0 {}
|
||||||
|
config_dhcpd allow booting\;
|
||||||
|
config_dhcpd allow bootp\;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# prepare tftp
|
||||||
|
pushd $tftp_dir $>/dev/null
|
||||||
|
[ -f ping.tar.bz2 ] || exit_with_error "Cannot find ping.tar.bz2 at $tftp_dir"
|
||||||
|
tar xjf ping.tar.bz2
|
||||||
|
exit_if_fail "tar xjf ping.tar.bz2 failed"
|
||||||
|
#rm ping.tar.bz2 -f
|
||||||
|
#exit_if_fail "rm ping.tar.bz2 failed"
|
||||||
|
if [ ! -d pxelinux.cfg ]; then
|
||||||
|
mkdir pxelinux.cfg
|
||||||
|
exit_if_fail "Cannot create pxelinux.cfg"
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
|
service dhcpd restart
|
||||||
|
exit_if_fail "service dhcpd restart failed"
|
||||||
|
exit 0
|
||||||
58
scripts/network/ping/prepare_tftp_bootfile.py
Normal file
58
scripts/network/ping/prepare_tftp_bootfile.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restore cifs_username cifs_password
|
||||||
|
import os, sys
|
||||||
|
from sys import exit
|
||||||
|
from os import makedirs
|
||||||
|
from os.path import exists, join
|
||||||
|
|
||||||
|
template = '''DEFAULT default
|
||||||
|
PROMPT 1
|
||||||
|
TIMEOUT 26
|
||||||
|
DISPLAY boot.msg
|
||||||
|
LABEL default
|
||||||
|
KERNEL kernel
|
||||||
|
APPEND vga=normal devfs=nomount pxe ramdisk_size=66000 load_ramdisk=1 init=/linuxrc prompt_ramdisk=0 initrd=initrd.gz root=/dev/ram0 rw noapic nolapic lba combined_mode=libata ide0=noprobe nomce pci=nomsi irqpoll quiet Server="%s" Share="%s" Directory="%s" Image_To_Restore="%s" After_Completion="Reboot" CIFS_Preferred="Y" Zsplit_Preferred="Y" AUTO="Y" User="%s" Passwd="%s" Extend_Parts_Whenever_Possible="N" Replace_BIOS="N"
|
||||||
|
'''
|
||||||
|
|
||||||
|
tftp_dir = ''
|
||||||
|
mac = ''
|
||||||
|
cifs_server = ''
|
||||||
|
share = ''
|
||||||
|
directory = ''
|
||||||
|
image_to_restore = ''
|
||||||
|
cifs_username = ''
|
||||||
|
cifs_password = ''
|
||||||
|
|
||||||
|
def prepare_boot_file():
|
||||||
|
try:
|
||||||
|
pxelinux = join(tftp_dir, "pxelinux.cfg")
|
||||||
|
if exists(pxelinux) == False:
|
||||||
|
makedirs(pxelinux)
|
||||||
|
|
||||||
|
cfg_name = "01-" + mac.replace(':','-')
|
||||||
|
cfg_path = join(pxelinux, cfg_name)
|
||||||
|
f = open(cfg_path, "w")
|
||||||
|
stuff = template % (cifs_server, share, directory, image_to_restore, cifs_username, cifs_password)
|
||||||
|
f.write(stuff)
|
||||||
|
f.close()
|
||||||
|
return 0
|
||||||
|
except IOError, e:
|
||||||
|
print e
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 9:
|
||||||
|
print "Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restor cifs_username cifs_password"
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
tftp_dir = sys.argv[1]
|
||||||
|
mac = sys.argv[2]
|
||||||
|
cifs_server = sys.argv[3]
|
||||||
|
share = sys.argv[4]
|
||||||
|
directory = sys.argv[5]
|
||||||
|
image_to_restore = sys.argv[6]
|
||||||
|
cifs_username = sys.argv[7]
|
||||||
|
cifs_password = sys.argv[8]
|
||||||
|
|
||||||
|
ret = prepare_boot_file()
|
||||||
|
exit(ret)
|
||||||
15
scripts/util/prepare_linmin.sh
Normal file
15
scripts/util/prepare_linmin.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
DHCP_CONF="/etc/dhcpd.conf"
|
||||||
|
|
||||||
|
err_exit() {
|
||||||
|
echo "$*"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ ! -f $DHCP_CONF ] && err_exit "Cannot find $DHCP_CONF"
|
||||||
|
|
||||||
|
cat $DHCP_CONF | tr '\n' '~' > /tmp/dhcpd.tmp && sed -i 's/}/}\n/g' /tmp/dhcpd.tmp && sed -i 's/\(subnet.*netmask.*{\).*\(}\)/\1\2/g' /tmp/dhcpd.tmp && cat /tmp/dhcpd.tmp | tr '~' '\n' > $DHCP_CONF && rm /tmp/dhcpd.tmp -f
|
||||||
|
[ $? -ne 0 ] && err_exit "Configure dhcpd.conf failed"
|
||||||
|
service dhcpd restart
|
||||||
|
[ $? -ne 0 ] && err_exit "restart dhcpd failed"
|
||||||
|
exit 0
|
||||||
@ -789,10 +789,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||||||
String username = cmd.getUsername();
|
String username = cmd.getUsername();
|
||||||
String password = cmd.getPassword();
|
String password = cmd.getPassword();
|
||||||
Long memCapacity = cmd.getMemCapacity();
|
Long memCapacity = cmd.getMemCapacity();
|
||||||
Long cpuCapacity = cmd.getCpuCapacity();
|
Long cpuSpeed = cmd.getCpuSpeed();
|
||||||
Long cpuNum = cmd.getCpuNum();
|
Long cpuNum = cmd.getCpuNum();
|
||||||
String mac = cmd.getMac();
|
String mac = cmd.getMac();
|
||||||
String hostTag = cmd.getHostTag();
|
List<String> hostTags = cmd.getHostTags();
|
||||||
Map<String, String>bareMetalParams = new HashMap<String, String>();
|
Map<String, String>bareMetalParams = new HashMap<String, String>();
|
||||||
|
|
||||||
dcId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), dcId);
|
dcId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), dcId);
|
||||||
@ -806,8 +806,8 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||||||
if (memCapacity == null) {
|
if (memCapacity == null) {
|
||||||
memCapacity = Long.valueOf(0);
|
memCapacity = Long.valueOf(0);
|
||||||
}
|
}
|
||||||
if (cpuCapacity == null) {
|
if (cpuSpeed == null) {
|
||||||
cpuCapacity = Long.valueOf(0);
|
cpuSpeed = Long.valueOf(0);
|
||||||
}
|
}
|
||||||
if (cpuNum == null) {
|
if (cpuNum == null) {
|
||||||
cpuNum = Long.valueOf(0);
|
cpuNum = Long.valueOf(0);
|
||||||
@ -817,15 +817,14 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
|
|||||||
}
|
}
|
||||||
|
|
||||||
bareMetalParams.put("cpuNum", cpuNum.toString());
|
bareMetalParams.put("cpuNum", cpuNum.toString());
|
||||||
bareMetalParams.put("cpuCapacity", cpuCapacity.toString());
|
bareMetalParams.put("cpuCapacity", cpuSpeed.toString());
|
||||||
bareMetalParams.put("memCapacity", memCapacity.toString());
|
bareMetalParams.put("memCapacity", memCapacity.toString());
|
||||||
bareMetalParams.put("mac", mac);
|
bareMetalParams.put("mac", mac);
|
||||||
if (hostTag != null) {
|
if (hostTags != null) {
|
||||||
bareMetalParams.put("hostTag", hostTag);
|
bareMetalParams.put("hostTag", hostTags.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> hostTags = cmd.getHostTags();
|
|
||||||
String allocationState = cmd.getAllocationState();
|
String allocationState = cmd.getAllocationState();
|
||||||
if (allocationState == null) {
|
if (allocationState == null) {
|
||||||
allocationState = Host.HostAllocationState.Enabled.toString();
|
allocationState = Host.HostAllocationState.Enabled.toString();
|
||||||
|
|||||||
@ -402,6 +402,10 @@ public class ApiDBUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static VMTemplateHostVO findTemplateHostRef(long templateId, long zoneId) {
|
public static VMTemplateHostVO findTemplateHostRef(long templateId, long zoneId) {
|
||||||
|
VMTemplateVO vmTemplate = findTemplateById(templateId);
|
||||||
|
if (vmTemplate.getHypervisorType() == HypervisorType.BareMetal) {
|
||||||
|
return _templateHostDao.findByHostTemplate(zoneId, templateId);
|
||||||
|
} else {
|
||||||
HostVO secondaryStorageHost = _storageMgr.getSecondaryStorageHost(zoneId);
|
HostVO secondaryStorageHost = _storageMgr.getSecondaryStorageHost(zoneId);
|
||||||
if (secondaryStorageHost == null) {
|
if (secondaryStorageHost == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -409,6 +413,7 @@ public class ApiDBUtils {
|
|||||||
return _templateHostDao.findByHostTemplate(secondaryStorageHost.getId(), templateId);
|
return _templateHostDao.findByHostTemplate(secondaryStorageHost.getId(), templateId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static UploadVO findUploadById(Long id){
|
public static UploadVO findUploadById(Long id){
|
||||||
return _uploadDao.findById(id);
|
return _uploadDao.findById(id);
|
||||||
@ -453,12 +458,17 @@ public class ApiDBUtils {
|
|||||||
|
|
||||||
public static List<VMTemplateHostVO> listTemplateHostBy(long templateId, Long zoneId) {
|
public static List<VMTemplateHostVO> listTemplateHostBy(long templateId, Long zoneId) {
|
||||||
if (zoneId != null) {
|
if (zoneId != null) {
|
||||||
|
VMTemplateVO vmTemplate = findTemplateById(templateId);
|
||||||
|
if (vmTemplate.getHypervisorType() == HypervisorType.BareMetal) {
|
||||||
|
return _templateHostDao.listByHostTemplate(zoneId, templateId);
|
||||||
|
} else {
|
||||||
HostVO secondaryStorageHost = _storageMgr.getSecondaryStorageHost(zoneId);
|
HostVO secondaryStorageHost = _storageMgr.getSecondaryStorageHost(zoneId);
|
||||||
if (secondaryStorageHost == null) {
|
if (secondaryStorageHost == null) {
|
||||||
return new ArrayList<VMTemplateHostVO>();
|
return new ArrayList<VMTemplateHostVO>();
|
||||||
} else {
|
} else {
|
||||||
return _templateHostDao.listByHostTemplate(secondaryStorageHost.getId(), templateId);
|
return _templateHostDao.listByHostTemplate(secondaryStorageHost.getId(), templateId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return _templateHostDao.listByOnlyTemplateId(templateId);
|
return _templateHostDao.listByOnlyTemplateId(templateId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,7 +143,7 @@ public enum Config {
|
|||||||
SystemVMAutoReserveCapacity("Advanced", ManagementServer.class, Boolean.class, "system.vm.auto.reserve.capacity", "true", "Indicates whether or not to automatically reserver system VM standby capacity.", null),
|
SystemVMAutoReserveCapacity("Advanced", ManagementServer.class, Boolean.class, "system.vm.auto.reserve.capacity", "true", "Indicates whether or not to automatically reserver system VM standby capacity.", null),
|
||||||
CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null),
|
CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null),
|
||||||
LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null),
|
LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null),
|
||||||
HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware, "The list of hypervisors that this deployment will use.", "hypervisorList"),
|
HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware + "," + HypervisorType.BareMetal, "The list of hypervisors that this deployment will use.", "hypervisorList"),
|
||||||
ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null),
|
ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null),
|
||||||
ManagementNetwork("Advanced", ManagementServer.class, String.class, "management.network.cidr", null, "The cidr of management server network", null),
|
ManagementNetwork("Advanced", ManagementServer.class, String.class, "management.network.cidr", null, "The cidr of management server network", null),
|
||||||
EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "15", "Events older than specified number days will be purged. Set this value to 0 to never delete events", null),
|
EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "15", "Events older than specified number days will be purged. Set this value to 0 to never delete events", null),
|
||||||
|
|||||||
@ -1307,7 +1307,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
} else if (offering.getTrafficType() == TrafficType.Control) {
|
} else if (offering.getTrafficType() == TrafficType.Control) {
|
||||||
broadcastDomainType = BroadcastDomainType.LinkLocal;
|
broadcastDomainType = BroadcastDomainType.LinkLocal;
|
||||||
} else if (offering.getTrafficType() == TrafficType.Public) {
|
} else if (offering.getTrafficType() == TrafficType.Public) {
|
||||||
if (zone.getNetworkType() == NetworkType.Advanced && !zone.isSecurityGroupEnabled()) {
|
if ((zone.getNetworkType() == NetworkType.Advanced && !zone.isSecurityGroupEnabled()) || zone.getNetworkType() == NetworkType.Basic) {
|
||||||
broadcastDomainType = BroadcastDomainType.Vlan;
|
broadcastDomainType = BroadcastDomainType.Vlan;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
@ -1898,12 +1898,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||||||
// Allow adding untagged direct vlan only for Basic zone
|
// Allow adding untagged direct vlan only for Basic zone
|
||||||
if (zone.getNetworkType() == NetworkType.Advanced && vlanId.equals(Vlan.UNTAGGED) && (!forVirtualNetwork || zone.isSecurityGroupEnabled())) {
|
if (zone.getNetworkType() == NetworkType.Advanced && vlanId.equals(Vlan.UNTAGGED) && (!forVirtualNetwork || zone.isSecurityGroupEnabled())) {
|
||||||
throw new InvalidParameterValueException("Direct untagged network is not supported for the zone " + zone.getId() + " of type " + zone.getNetworkType());
|
throw new InvalidParameterValueException("Direct untagged network is not supported for the zone " + zone.getId() + " of type " + zone.getNetworkType());
|
||||||
} else if (zone.getNetworkType() == NetworkType.Basic && !(vlanId.equals(Vlan.UNTAGGED) && !forVirtualNetwork)) {
|
} else if (zone.getNetworkType() == NetworkType.Basic && !((vlanId.equals(Vlan.UNTAGGED) && !forVirtualNetwork) || (forVirtualNetwork))) {
|
||||||
throw new InvalidParameterValueException("Only direct untagged network is supported in the zone " + zone.getId() + " of type " + zone.getNetworkType());
|
throw new InvalidParameterValueException("Only Direct Untagged and Virtual networks are supported in the zone " + zone.getId() + " of type " + zone.getNetworkType());
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't allow to create a virtual vlan when zone's vnet is NULL
|
//don't allow to create a virtual vlan when zone's vnet is NULL in Advanced zone
|
||||||
if (zone.getVnet() == null && forVirtualNetwork) {
|
if ((zone.getNetworkType() == NetworkType.Advanced && zone.getVnet() == null) && forVirtualNetwork) {
|
||||||
throw new InvalidParameterValueException("Can't add virtual network to the zone id=" + zone.getId() + " as zone doesn't have guest vlan configured");
|
throw new InvalidParameterValueException("Can't add virtual network to the zone id=" + zone.getId() + " as zone doesn't have guest vlan configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -60,6 +60,9 @@ public class HostPodVO implements Pod {
|
|||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
AllocationState allocationState;
|
AllocationState allocationState;
|
||||||
|
|
||||||
|
@Column(name = "external_dhcp")
|
||||||
|
private Boolean externalDhcp;
|
||||||
|
|
||||||
public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
|
public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.dataCenterId = dcId;
|
this.dataCenterId = dcId;
|
||||||
@ -68,6 +71,7 @@ public class HostPodVO implements Pod {
|
|||||||
this.cidrSize = cidrSize;
|
this.cidrSize = cidrSize;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.allocationState = Grouping.AllocationState.Enabled;
|
this.allocationState = Grouping.AllocationState.Enabled;
|
||||||
|
this.externalDhcp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,6 +154,14 @@ public class HostPodVO implements Pod {
|
|||||||
return NumbersUtil.hash(id);
|
return NumbersUtil.hash(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getExternalDhcp() {
|
||||||
|
return externalDhcp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExternalDhcp(boolean use) {
|
||||||
|
externalDhcp = use;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof HostPodVO) {
|
if (obj instanceof HostPodVO) {
|
||||||
|
|||||||
@ -1,25 +1,43 @@
|
|||||||
package com.cloud.deploy;
|
package com.cloud.deploy;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.capacity.CapacityManager;
|
||||||
|
import com.cloud.dc.ClusterVO;
|
||||||
|
import com.cloud.dc.DataCenter;
|
||||||
|
import com.cloud.dc.Pod;
|
||||||
|
import com.cloud.dc.dao.ClusterDao;
|
||||||
|
import com.cloud.dc.dao.DataCenterDao;
|
||||||
|
import com.cloud.dc.dao.HostPodDao;
|
||||||
import com.cloud.exception.InsufficientServerCapacityException;
|
import com.cloud.exception.InsufficientServerCapacityException;
|
||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.host.Status;
|
||||||
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.offering.ServiceOffering;
|
import com.cloud.offering.ServiceOffering;
|
||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.org.Cluster;
|
||||||
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
import com.cloud.vm.VirtualMachineProfileImpl;
|
import com.cloud.vm.VirtualMachineProfileImpl;
|
||||||
|
|
||||||
@Local(value=DeploymentPlanner.class)
|
@Local(value=DeploymentPlanner.class)
|
||||||
public class BareMetalPlanner extends FirstFitPlanner implements DeploymentPlanner {
|
public class BareMetalPlanner implements DeploymentPlanner {
|
||||||
private static final Logger s_logger = Logger.getLogger(BareMetalPlanner.class);
|
private static final Logger s_logger = Logger.getLogger(BareMetalPlanner.class);
|
||||||
|
@Inject protected DataCenterDao _dcDao;
|
||||||
|
@Inject protected HostPodDao _podDao;
|
||||||
|
@Inject protected ClusterDao _clusterDao;
|
||||||
|
@Inject protected HostDao _hostDao;
|
||||||
|
@Inject protected CapacityManager _capacityMgr;
|
||||||
|
String _name;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
|
public DeployDestination plan(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
|
||||||
@ -27,6 +45,15 @@ public class BareMetalPlanner extends FirstFitPlanner implements DeploymentPlann
|
|||||||
ServiceOffering offering = vmProfile.getServiceOffering();
|
ServiceOffering offering = vmProfile.getServiceOffering();
|
||||||
String hostTag = null;
|
String hostTag = null;
|
||||||
|
|
||||||
|
if (vm.getLastHostId() != null) {
|
||||||
|
HostVO h = _hostDao.findById(vm.getLastHostId());
|
||||||
|
DataCenter dc = _dcDao.findById(h.getDataCenterId());
|
||||||
|
Pod pod = _podDao.findById(h.getPodId());
|
||||||
|
Cluster c = _clusterDao.findById(h.getClusterId());
|
||||||
|
s_logger.debug("Start baremetal vm " + vm.getId() + " on last stayed host " + h.getId());
|
||||||
|
return new DeployDestination(dc, pod, c, h);
|
||||||
|
}
|
||||||
|
|
||||||
if (offering.getTags() != null) {
|
if (offering.getTags() != null) {
|
||||||
String[] tags = offering.getTags().split(",");
|
String[] tags = offering.getTags().split(",");
|
||||||
if (tags.length > 0) {
|
if (tags.length > 0) {
|
||||||
@ -34,9 +61,17 @@ public class BareMetalPlanner extends FirstFitPlanner implements DeploymentPlann
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostTag != null) {
|
List<ClusterVO> clusters = _clusterDao.listByDcHyType(vm.getDataCenterId(), HypervisorType.BareMetal.toString());
|
||||||
List<HostVO> hosts = _hostDao.listBy(Host.Type.Routing, vm.getDataCenterId());
|
if (clusters.size() != 1) {
|
||||||
|
throw new CloudRuntimeException("Invaild baremetal cluster number " + clusters.size());
|
||||||
|
}
|
||||||
|
Cluster cluster = clusters.get(0);
|
||||||
|
|
||||||
|
int cpu_requested;
|
||||||
|
long ram_requested;
|
||||||
HostVO target = null;
|
HostVO target = null;
|
||||||
|
List<HostVO> hosts = _hostDao.listByCluster(cluster.getId());
|
||||||
|
if (hostTag != null) {
|
||||||
for (HostVO h : hosts) {
|
for (HostVO h : hosts) {
|
||||||
_hostDao.loadDetails(h);
|
_hostDao.loadDetails(h);
|
||||||
if (h.getDetail("hostTag") != null && h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
|
if (h.getDetail("hostTag") != null && h.getDetail("hostTag").equalsIgnoreCase(hostTag)) {
|
||||||
@ -44,37 +79,61 @@ public class BareMetalPlanner extends FirstFitPlanner implements DeploymentPlann
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
s_logger.warn("Cannot find host with tag " + hostTag);
|
s_logger.warn("Cannot find host with tag " + hostTag + " use capacity from service offering");
|
||||||
|
cpu_requested = offering.getCpu() * offering.getSpeed();
|
||||||
|
ram_requested = offering.getRamSize() * 1024 * 1024;
|
||||||
|
} else {
|
||||||
|
cpu_requested = target.getCpus() * target.getSpeed().intValue();
|
||||||
|
ram_requested = target.getTotalMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (HostVO h : hosts) {
|
||||||
|
if (h.getStatus() == Status.Up) {
|
||||||
|
if(_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false)){
|
||||||
|
s_logger.debug("Find host " + h.getId() + " has enough capacity");
|
||||||
|
DataCenter dc = _dcDao.findById(h.getDataCenterId());
|
||||||
|
Pod pod = _podDao.findById(h.getPodId());
|
||||||
|
return new DeployDestination(dc, pod, cluster, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s_logger.warn(String.format("Cannot find enough capacity(requested cpu=%1$s memory=%2$s)", cpu_requested, ram_requested));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cpu = target.getCpus();
|
|
||||||
int speed = target.getSpeed().intValue();
|
|
||||||
Long ramSize = target.getTotalMemory() / (1024L*1024L);
|
|
||||||
ServiceOfferingVO newOffering = new ServiceOfferingVO(offering.getName(), cpu, ramSize.intValue(), speed, offering.getRateMbps(),
|
|
||||||
offering.getMulticastRateMbps(), false, offering.getDisplayText(), offering.getUseLocalStorage(), false, offering.getTags(), false);
|
|
||||||
((VirtualMachineProfileImpl)vmProfile).setServiceOffering(newOffering);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployDestination dest = super.plan(vmProfile, plan, avoid);
|
|
||||||
|
|
||||||
if (hostTag == null && dest != null) {
|
|
||||||
Host h = dest.getHost();
|
|
||||||
if (h.getCpus() != offering.getCpu() || h.getTotalMemory() != offering.getRamSize() || h.getSpeed() != offering.getSpeed()) {
|
|
||||||
throw new CloudRuntimeException(String.format("Bare Metal only allows one VM one host, " +
|
|
||||||
"the offering capcacity doesn't equal to host capacity(offering: cpu number:%$1s, cpu speed:%$2s," +
|
|
||||||
"ram size:%3$s; host: cpu number:%$4s, cpu speed:%$5s, ram size:%$6s)", offering.getCpu(), offering.getSpeed(),
|
|
||||||
offering.getRamSize(), h.getCpus(), h.getSpeed(), h.getTotalMemory()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
|
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
|
||||||
return vm.getHypervisorType() == HypervisorType.BareMetal;
|
return vm.getHypervisorType() == HypervisorType.BareMetal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||||
|
_name = name;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean start() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean stop() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, DeployDestination dest, ExcludeList exclude) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,6 +140,8 @@ public interface HostDao extends GenericDao<HostVO, Long> {
|
|||||||
|
|
||||||
void loadDetails(HostVO host);
|
void loadDetails(HostVO host);
|
||||||
|
|
||||||
|
void saveDetails(HostVO host);
|
||||||
|
|
||||||
HostVO findConsoleProxyHost(String name, Type type);
|
HostVO findConsoleProxyHost(String name, Type type);
|
||||||
|
|
||||||
List<HypervisorType> getAvailHypervisorInZone(long hostId, long zoneId);
|
List<HypervisorType> getAvailHypervisorInZone(long hostId, long zoneId);
|
||||||
|
|||||||
@ -599,7 +599,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
|||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveDetails(HostVO host) {
|
@Override
|
||||||
|
public void saveDetails(HostVO host) {
|
||||||
Map<String, String> details = host.getDetails();
|
Map<String, String> details = host.getDetails();
|
||||||
if (details == null) {
|
if (details == null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -127,8 +127,6 @@ public interface NetworkManager extends NetworkService {
|
|||||||
|
|
||||||
boolean applyRules(List<? extends FirewallRule> rules, boolean continueOnError) throws ResourceUnavailableException;
|
boolean applyRules(List<? extends FirewallRule> rules, boolean continueOnError) throws ResourceUnavailableException;
|
||||||
|
|
||||||
NetworkVO getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
|
|
||||||
|
|
||||||
List<? extends RemoteAccessVpnElement> getRemoteAccessVpnElements();
|
List<? extends RemoteAccessVpnElement> getRemoteAccessVpnElements();
|
||||||
|
|
||||||
PublicIpAddress getPublicIpAddress(long ipAddressId);
|
PublicIpAddress getPublicIpAddress(long ipAddressId);
|
||||||
@ -173,7 +171,7 @@ public interface NetworkManager extends NetworkService {
|
|||||||
|
|
||||||
boolean zoneIsConfiguredForExternalNetworking(long zoneId);
|
boolean zoneIsConfiguredForExternalNetworking(long zoneId);
|
||||||
|
|
||||||
Map<Capability, String> getServiceCapability(long zoneId, Service service);
|
Map<Capability, String> getServiceCapabilities(long zoneId, Service service);
|
||||||
|
|
||||||
boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException;
|
boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException;
|
||||||
|
|
||||||
|
|||||||
@ -79,6 +79,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.exception.ResourceUnavailableException;
|
import com.cloud.exception.ResourceUnavailableException;
|
||||||
|
import com.cloud.exception.UnsupportedServiceException;
|
||||||
import com.cloud.network.IpAddress.State;
|
import com.cloud.network.IpAddress.State;
|
||||||
import com.cloud.network.Network.Capability;
|
import com.cloud.network.Network.Capability;
|
||||||
import com.cloud.network.Network.GuestIpType;
|
import com.cloud.network.Network.GuestIpType;
|
||||||
@ -437,6 +438,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
boolean success = true;
|
boolean success = true;
|
||||||
for (NetworkElement element : _networkElements) {
|
for (NetworkElement element : _networkElements) {
|
||||||
try {
|
try {
|
||||||
|
s_logger.trace("Asking " + element + " to apply ip associations");
|
||||||
element.applyIps(network, publicIps);
|
element.applyIps(network, publicIps);
|
||||||
} catch (ResourceUnavailableException e) {
|
} catch (ResourceUnavailableException e) {
|
||||||
success = false;
|
success = false;
|
||||||
@ -703,8 +705,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
Availability.Required,
|
Availability.Required,
|
||||||
//services - all true except for firewall/lb/vpn and gateway services
|
//services - all true except for lb/vpn and gateway services
|
||||||
true, true, true, false, false,false, false, GuestIpType.Direct);
|
true, true, true, false, true,false, false, GuestIpType.Direct);
|
||||||
guestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(guestNetworkOffering);
|
guestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(guestNetworkOffering);
|
||||||
_systemNetworks.put(NetworkOfferingVO.SystemGuestNetwork, guestNetworkOffering);
|
_systemNetworks.put(NetworkOfferingVO.SystemGuestNetwork, guestNetworkOffering);
|
||||||
|
|
||||||
@ -1788,18 +1790,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
|
|
||||||
SearchCriteria<NetworkVO> sc = sb.create();
|
SearchCriteria<NetworkVO> sc = sb.create();
|
||||||
|
|
||||||
if (!isSystem) {
|
if (isSystem != null) {
|
||||||
if (zoneId != null) {
|
sc.setJoinParameters("networkOfferingSearch", "systemOnly", isSystem);
|
||||||
DataCenterVO dc = _dcDao.findById(zoneId);
|
|
||||||
if (dc != null && !dc.isSecurityGroupEnabled()) {
|
|
||||||
sc.setJoinParameters("networkOfferingSearch", "systemOnly", false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sc.setJoinParameters("networkOfferingSearch", "systemOnly", false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sc.setJoinParameters("networkOfferingSearch", "systemOnly", true);
|
|
||||||
sc.setJoinParameters("zoneSearch", "networkType", NetworkType.Advanced.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyword != null) {
|
if (keyword != null) {
|
||||||
@ -2386,8 +2378,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Capability, String> getServiceCapability(long zoneId, Service service) {
|
public Map<Capability, String> getServiceCapabilities(long zoneId, Service service) {
|
||||||
Map<Service, Map<Capability, String>> networkCapabilities = getZoneCapabilities(zoneId);
|
Map<Service, Map<Capability, String>> networkCapabilities = getZoneCapabilities(zoneId);
|
||||||
|
if (networkCapabilities.get(service) == null) {
|
||||||
|
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported in zone id=" + zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
return networkCapabilities.get(service);
|
return networkCapabilities.get(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2607,8 +2603,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||||||
public boolean zoneIsConfiguredForExternalNetworking(long zoneId) {
|
public boolean zoneIsConfiguredForExternalNetworking(long zoneId) {
|
||||||
DataCenterVO zone = _dcDao.findById(zoneId);
|
DataCenterVO zone = _dcDao.findById(zoneId);
|
||||||
|
|
||||||
return (zone.getGatewayProvider() != null && zone.getGatewayProvider().equals(Network.Provider.JuniperSRX.getName()) && zone.getFirewallProvider().equals(Network.Provider.JuniperSRX.getName()) && zone.getLoadBalancerProvider().equals(
|
if (zone.getNetworkType() == NetworkType.Advanced) {
|
||||||
|
return (zone.getGatewayProvider() != null && zone.getGatewayProvider().equals(Network.Provider.JuniperSRX.getName())
|
||||||
|
&& zone.getFirewallProvider() != null && zone.getFirewallProvider().equals(Network.Provider.JuniperSRX.getName())
|
||||||
|
&& zone.getLoadBalancerProvider() != null && zone.getLoadBalancerProvider().equals(
|
||||||
Network.Provider.F5BigIp.getName()));
|
Network.Provider.F5BigIp.getName()));
|
||||||
|
} else {
|
||||||
|
return (zone.getFirewallProvider() != null && zone.getFirewallProvider().equals(Network.Provider.JuniperSRX.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
|
|||||||
import com.cloud.configuration.ConfigurationManager;
|
import com.cloud.configuration.ConfigurationManager;
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
import com.cloud.dc.DataCenter.NetworkType;
|
import com.cloud.dc.DataCenter.NetworkType;
|
||||||
|
import com.cloud.dc.dao.HostPodDao;
|
||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
@ -73,6 +74,7 @@ public class DhcpElement extends AdapterBase implements NetworkElement, Password
|
|||||||
@Inject UserVmDao _userVmDao;
|
@Inject UserVmDao _userVmDao;
|
||||||
@Inject DomainRouterDao _routerDao;
|
@Inject DomainRouterDao _routerDao;
|
||||||
@Inject ConfigurationManager _configMgr;
|
@Inject ConfigurationManager _configMgr;
|
||||||
|
@Inject HostPodDao _podDao;
|
||||||
|
|
||||||
private boolean canHandle(GuestIpType ipType, DeployDestination dest, TrafficType trafficType) {
|
private boolean canHandle(GuestIpType ipType, DeployDestination dest, TrafficType trafficType) {
|
||||||
DataCenter dc = dest.getDataCenter();
|
DataCenter dc = dest.getDataCenter();
|
||||||
@ -80,7 +82,8 @@ public class DhcpElement extends AdapterBase implements NetworkElement, Password
|
|||||||
|
|
||||||
if (provider != null && provider.equalsIgnoreCase(Provider.JuniperSRX.getName()) && ipType == GuestIpType.Virtual) {
|
if (provider != null && provider.equalsIgnoreCase(Provider.JuniperSRX.getName()) && ipType == GuestIpType.Virtual) {
|
||||||
return true;
|
return true;
|
||||||
} else if (dc.getDhcpProvider().equalsIgnoreCase(Provider.ExternalDhcpServer.getName())){
|
} else if (dest.getPod() != null && dest.getPod().getExternalDhcp()){
|
||||||
|
//This pod is using external DHCP server
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (dc.getNetworkType() == NetworkType.Basic) {
|
if (dc.getNetworkType() == NetworkType.Basic) {
|
||||||
|
|||||||
@ -53,7 +53,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||||||
|
|
||||||
|
|
||||||
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
||||||
if (dc.getNetworkType() == NetworkType.Advanced && offering.getTrafficType() == TrafficType.Public && offering.isSystemOnly() && !dc.isSecurityGroupEnabled()) {
|
if (((dc.getNetworkType() == NetworkType.Advanced && !dc.isSecurityGroupEnabled()) || dc.getNetworkType() == NetworkType.Basic) && offering.getTrafficType() == TrafficType.Public && offering.isSystemOnly()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
s_logger.trace("We only take care of System only Public Virtual Network");
|
s_logger.trace("We only take care of System only Public Virtual Network");
|
||||||
|
|||||||
@ -220,8 +220,8 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Verify that the network guru supports the protocol specified
|
//Verify that the network guru supports the protocol specified
|
||||||
Map<Network.Capability, String> firewallCapability = _networkMgr.getServiceCapability(network.getDataCenterId(), Service.Firewall);
|
Map<Network.Capability, String> firewallCapabilities = _networkMgr.getServiceCapabilities(network.getDataCenterId(), Service.Firewall);
|
||||||
String supportedProtocols = firewallCapability.get(Capability.SupportedProtocols).toLowerCase();
|
String supportedProtocols = firewallCapabilities.get(Capability.SupportedProtocols).toLowerCase();
|
||||||
if (!supportedProtocols.contains(rule.getProtocol().toLowerCase())) {
|
if (!supportedProtocols.contains(rule.getProtocol().toLowerCase())) {
|
||||||
throw new InvalidParameterValueException("Protocol " + rule.getProtocol() + " is not supported in zone " + network.getDataCenterId());
|
throw new InvalidParameterValueException("Protocol " + rule.getProtocol() + " is not supported in zone " + network.getDataCenterId());
|
||||||
}
|
}
|
||||||
@ -318,7 +318,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Verify that the network guru supports the protocol specified
|
//Verify that the network guru supports the protocol specified
|
||||||
Map<Network.Capability, String> firewallCapability = _networkMgr.getServiceCapability(network.getDataCenterId(), Service.Firewall);
|
Map<Network.Capability, String> firewallCapability = _networkMgr.getServiceCapabilities(network.getDataCenterId(), Service.Firewall);
|
||||||
String supportedProtocols = firewallCapability.get(Capability.SupportedProtocols).toLowerCase();
|
String supportedProtocols = firewallCapability.get(Capability.SupportedProtocols).toLowerCase();
|
||||||
if (!supportedProtocols.contains(rule.getProtocol().toLowerCase())) {
|
if (!supportedProtocols.contains(rule.getProtocol().toLowerCase())) {
|
||||||
throw new InvalidParameterValueException("Protocol " + rule.getProtocol() + " is not supported in zone " + network.getDataCenterId());
|
throw new InvalidParameterValueException("Protocol " + rule.getProtocol() + " is not supported in zone " + network.getDataCenterId());
|
||||||
|
|||||||
@ -667,8 +667,8 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||||||
TrafficType.Guest,
|
TrafficType.Guest,
|
||||||
true, false, null, null, null, true,
|
true, false, null, null, null, true,
|
||||||
Availability.Required,
|
Availability.Required,
|
||||||
true, true, true, //services - all true except for firewall/lb/vpn and gateway
|
true, true, true, //services - all true except for lb/vpn and gateway
|
||||||
false, false, false, false, GuestIpType.Direct);
|
false, true, false, false, GuestIpType.Direct);
|
||||||
|
|
||||||
guestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(guestNetworkOffering);
|
guestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(guestNetworkOffering);
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
|||||||
} else if (trafficType == TrafficType.Control) {
|
} else if (trafficType == TrafficType.Control) {
|
||||||
broadcastDomainType = BroadcastDomainType.LinkLocal;
|
broadcastDomainType = BroadcastDomainType.LinkLocal;
|
||||||
} else if (offering.getTrafficType() == TrafficType.Public) {
|
} else if (offering.getTrafficType() == TrafficType.Public) {
|
||||||
if (zone.getNetworkType() == NetworkType.Advanced) {
|
if ((zone.getNetworkType() == NetworkType.Advanced && !zone.isSecurityGroupEnabled()) || zone.getNetworkType() == NetworkType.Basic) {
|
||||||
broadcastDomainType = BroadcastDomainType.Vlan;
|
broadcastDomainType = BroadcastDomainType.Vlan;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@ -522,6 +522,8 @@ public class DownloadMonitorImpl implements DownloadMonitor {
|
|||||||
}
|
}
|
||||||
/*Only download templates whose hypervirsor type is in the zone*/
|
/*Only download templates whose hypervirsor type is in the zone*/
|
||||||
List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(sserver.getDataCenterId());
|
List<HypervisorType> availHypers = _clusterDao.getAvailableHypervisorInZone(sserver.getDataCenterId());
|
||||||
|
/* Baremetal need not to download any template */
|
||||||
|
availHypers.remove(HypervisorType.BareMetal);
|
||||||
for (VMTemplateVO tmplt: toBeDownloaded) {
|
for (VMTemplateVO tmplt: toBeDownloaded) {
|
||||||
|
|
||||||
if (tmplt.getUrl() == null){ // If url is null we cant initiate the download so mark it as an error.
|
if (tmplt.getUrl() == null){ // If url is null we cant initiate the download so mark it as an error.
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import java.net.URI;
|
|||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -62,6 +63,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||||||
import com.cloud.exception.PermissionDeniedException;
|
import com.cloud.exception.PermissionDeniedException;
|
||||||
import com.cloud.exception.ResourceAllocationException;
|
import com.cloud.exception.ResourceAllocationException;
|
||||||
import com.cloud.exception.StorageUnavailableException;
|
import com.cloud.exception.StorageUnavailableException;
|
||||||
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
@ -159,6 +161,7 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
|
|||||||
@Inject ConfigurationDao _configDao;
|
@Inject ConfigurationDao _configDao;
|
||||||
@Inject UsageEventDao _usageEventDao;
|
@Inject UsageEventDao _usageEventDao;
|
||||||
@Inject HypervisorGuruManager _hvGuruMgr;
|
@Inject HypervisorGuruManager _hvGuruMgr;
|
||||||
|
@Inject VMTemplateHostDao _vmTemplateHostDao;
|
||||||
protected SearchBuilder<VMTemplateHostVO> HostTemplateStatesSearch;
|
protected SearchBuilder<VMTemplateHostVO> HostTemplateStatesSearch;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -383,8 +386,8 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
|
|||||||
}
|
}
|
||||||
|
|
||||||
String uriStr;
|
String uriStr;
|
||||||
if (url.startsWith("baremetal://")) {
|
if (hypervisorType == hypervisorType.BareMetal) {
|
||||||
uriStr = url.substring("baremetal://".length());
|
uriStr = url;
|
||||||
} else {
|
} else {
|
||||||
URI uri = new URI(url);
|
URI uri = new URI(url);
|
||||||
if ((uri.getScheme() == null)
|
if ((uri.getScheme() == null)
|
||||||
@ -469,7 +472,27 @@ public class TemplateManagerImpl implements TemplateManager, Manager, TemplateSe
|
|||||||
_tmpltDao.addTemplateToZone(template, zoneId);
|
_tmpltDao.addTemplateToZone(template, zoneId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hyperType == HypervisorType.BareMetal) {
|
||||||
|
// There is no secondary storage vm for baremetal, we use zone id as identifier
|
||||||
|
VMTemplateHostVO vmTemplateHost = null;
|
||||||
|
if (zoneId == null) {
|
||||||
|
List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved();
|
||||||
|
for (DataCenterVO dc: dcs) {
|
||||||
|
vmTemplateHost = _vmTemplateHostDao.findByHostTemplate(dc.getId(), template.getId());
|
||||||
|
if (vmTemplateHost == null) {
|
||||||
|
vmTemplateHost = new VMTemplateHostVO(dc.getId(), template.getId(), new Date(), 100, VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
|
||||||
|
null, null, null, null, template.getUrl());
|
||||||
|
_vmTemplateHostDao.persist(vmTemplateHost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vmTemplateHost = new VMTemplateHostVO(zoneId, template.getId(), new Date(), 100, VMTemplateStorageResourceAssoc.Status.DOWNLOADED,
|
||||||
|
null, null, null, null, template.getUrl());
|
||||||
|
_vmTemplateHostDao.persist(vmTemplateHost);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_downloadMonitor.downloadTemplateToStorage(id, zoneId);
|
_downloadMonitor.downloadTemplateToStorage(id, zoneId);
|
||||||
|
}
|
||||||
|
|
||||||
_accountMgr.incrementResourceCount(accountId, ResourceType.template);
|
_accountMgr.incrementResourceCount(accountId, ResourceType.template);
|
||||||
|
|
||||||
|
|||||||
@ -1922,12 +1922,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||||||
_accountMgr.checkAccess(caller, owner);
|
_accountMgr.checkAccess(caller, owner);
|
||||||
|
|
||||||
//Get default guest network in Basic zone
|
//Get default guest network in Basic zone
|
||||||
NetworkVO defaultNetwork = _networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(), TrafficType.Guest);
|
Network defaultNetwork = _networkMgr.getSystemNetworkByZoneAndTrafficType(zone.getId(), TrafficType.Guest);
|
||||||
|
|
||||||
if (defaultNetwork == null) {
|
if (defaultNetwork == null) {
|
||||||
throw new InvalidParameterValueException("Unable to find a default network to start a vm");
|
throw new InvalidParameterValueException("Unable to find a default network to start a vm");
|
||||||
} else {
|
} else {
|
||||||
networkList.add(defaultNetwork);
|
networkList.add(_networkDao.findById(defaultNetwork.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId,
|
return createVirtualMachine(zone, serviceOffering, template, hostName, displayName, owner, diskOfferingId,
|
||||||
|
|||||||
@ -256,6 +256,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||||||
if (template.getFormat() == ImageFormat.ISO) {
|
if (template.getFormat() == ImageFormat.ISO) {
|
||||||
_storageMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vm, owner);
|
_storageMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vm, owner);
|
||||||
} else if (template.getFormat() == ImageFormat.BAREMETAL) {
|
} else if (template.getFormat() == ImageFormat.BAREMETAL) {
|
||||||
|
// Do nothing
|
||||||
}else {
|
}else {
|
||||||
_storageMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), template, vm, owner);
|
_storageMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), template, vm, owner);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -534,6 +534,7 @@ CREATE TABLE `cloud`.`host_pod_ref` (
|
|||||||
`cidr_size` bigint unsigned NOT NULL COMMENT 'CIDR size for the pod',
|
`cidr_size` bigint unsigned NOT NULL COMMENT 'CIDR size for the pod',
|
||||||
`description` varchar(255) COMMENT 'store private ip range in startIP-endIP format',
|
`description` varchar(255) COMMENT 'store private ip range in startIP-endIP format',
|
||||||
`allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled' COMMENT 'Is this Pod enabled for allocation for new resources',
|
`allocation_state` varchar(32) NOT NULL DEFAULT 'Enabled' COMMENT 'Is this Pod enabled for allocation for new resources',
|
||||||
|
`external_dhcp` tinyint NOT NULL DEFAULT 0 COMMENT 'Is this Pod using external DHCP',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY (`name`, `data_center_id`),
|
UNIQUE KEY (`name`, `data_center_id`),
|
||||||
INDEX `i_host_pod_ref__data_center_id`(`data_center_id`),
|
INDEX `i_host_pod_ref__data_center_id`(`data_center_id`),
|
||||||
|
|||||||
@ -217,6 +217,41 @@ dictionary = {
|
|||||||
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
||||||
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpucores">
|
||||||
|
# of CPU Cores:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpucores" id="host_baremetal_cpucores" />
|
||||||
|
<div id="host_baremetal_cpucores_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpu">
|
||||||
|
CPU (in MHz):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpu" id="host_baremetal_cpu" />
|
||||||
|
<div id="host_baremetal_cpu_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_memory">
|
||||||
|
Memory (in MB):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_memory" id="host_baremetal_memory" />
|
||||||
|
<div id="host_baremetal_memory_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_mac">
|
||||||
|
Host MAC:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_mac" id="host_baremetal_mac" />
|
||||||
|
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label input_group="general">
|
||||||
|
Tags:</label>
|
||||||
|
<input class="text" type="text" name="host_tags" id="host_tags" />
|
||||||
|
<div id="host_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -778,6 +778,41 @@ dictionary = {
|
|||||||
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
||||||
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpucores">
|
||||||
|
# of CPU Cores:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpucores" id="host_baremetal_cpucores" />
|
||||||
|
<div id="host_baremetal_cpucores_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpu">
|
||||||
|
CPU (in MHz):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpu" id="host_baremetal_cpu" />
|
||||||
|
<div id="host_baremetal_cpu_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_memory">
|
||||||
|
Memory (in MB):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_memory" id="host_baremetal_memory" />
|
||||||
|
<div id="host_baremetal_memory_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_mac">
|
||||||
|
Host MAC:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_mac" id="host_baremetal_mac" />
|
||||||
|
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label input_group="general">
|
||||||
|
Tags:</label>
|
||||||
|
<input class="text" type="text" name="host_tags" id="host_tags" />
|
||||||
|
<div id="host_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -342,6 +342,41 @@ dictionary = {
|
|||||||
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
||||||
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpucores">
|
||||||
|
# of CPU Cores:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpucores" id="host_baremetal_cpucores" />
|
||||||
|
<div id="host_baremetal_cpucores_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpu">
|
||||||
|
CPU (in MHz):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpu" id="host_baremetal_cpu" />
|
||||||
|
<div id="host_baremetal_cpu_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_memory">
|
||||||
|
Memory (in MB):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_memory" id="host_baremetal_memory" />
|
||||||
|
<div id="host_baremetal_memory_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_mac">
|
||||||
|
Host MAC:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_mac" id="host_baremetal_mac" />
|
||||||
|
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label input_group="general">
|
||||||
|
Tags:</label>
|
||||||
|
<input class="text" type="text" name="host_tags" id="host_tags" />
|
||||||
|
<div id="host_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -866,7 +866,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<fmt:message key="label.adding"/>:</label>
|
<fmt:message key="label.zone"/>:</label>
|
||||||
<select class="select" id="zone_dropdown">
|
<select class="select" id="zone_dropdown">
|
||||||
</select>
|
</select>
|
||||||
<div id="zone_dropdown_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="zone_dropdown_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
@ -943,6 +943,41 @@
|
|||||||
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
||||||
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpucores">
|
||||||
|
# of CPU Cores:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpucores" id="host_baremetal_cpucores" />
|
||||||
|
<div id="host_baremetal_cpucores_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpu">
|
||||||
|
CPU (in MHz):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpu" id="host_baremetal_cpu" />
|
||||||
|
<div id="host_baremetal_cpu_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_memory">
|
||||||
|
Memory (in MB):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_memory" id="host_baremetal_memory" />
|
||||||
|
<div id="host_baremetal_memory_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_mac">
|
||||||
|
Host MAC:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_mac" id="host_baremetal_mac" />
|
||||||
|
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label input_group="general">
|
||||||
|
Tags:</label>
|
||||||
|
<input class="text" type="text" name="host_tags" id="host_tags" />
|
||||||
|
<div id="host_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -423,6 +423,41 @@ dictionary = {
|
|||||||
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
<input class="text" type="text" name="host_vcenter_host" id="host_vcenter_host" />
|
||||||
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
<div id="host_vcenter_host_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
</div>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpucores">
|
||||||
|
# of CPU Cores:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpucores" id="host_baremetal_cpucores" />
|
||||||
|
<div id="host_baremetal_cpucores_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_cpu">
|
||||||
|
CPU (in MHz):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_cpu" id="host_baremetal_cpu" />
|
||||||
|
<div id="host_baremetal_cpu_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_memory">
|
||||||
|
Memory (in MB):</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_memory" id="host_baremetal_memory" />
|
||||||
|
<div id="host_baremetal_memory_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li input_group="baremetal" style="display: none;">
|
||||||
|
<label for="host_baremetal_mac">
|
||||||
|
Host MAC:</label>
|
||||||
|
<input class="text" type="text" name="host_baremetal_mac" id="host_baremetal_mac" />
|
||||||
|
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label input_group="general">
|
||||||
|
Tags:</label>
|
||||||
|
<input class="text" type="text" name="host_tags" id="host_tags" />
|
||||||
|
<div id="host_tags_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -461,9 +461,15 @@ function bindAddHostButton($leftmenuItem1) {
|
|||||||
if(clusterObj.hypervisortype == "VMware") {
|
if(clusterObj.hypervisortype == "VMware") {
|
||||||
$('li[input_group="vmware"]', dialogAddHost).show();
|
$('li[input_group="vmware"]', dialogAddHost).show();
|
||||||
$('li[input_group="general"]', dialogAddHost).hide();
|
$('li[input_group="general"]', dialogAddHost).hide();
|
||||||
|
$('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 {
|
} else {
|
||||||
$('li[input_group="vmware"]', dialogAddHost).hide();
|
$('li[input_group="vmware"]', dialogAddHost).hide();
|
||||||
$('li[input_group="general"]', dialogAddHost).show();
|
$('li[input_group="general"]', dialogAddHost).show();
|
||||||
|
$('li[input_group="baremetal"]', dialogAddHost).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -521,6 +527,12 @@ function bindAddHostButton($leftmenuItem1) {
|
|||||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_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"));
|
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
|
||||||
} else {
|
} 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("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("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||||
@ -538,6 +550,7 @@ function bindAddHostButton($leftmenuItem1) {
|
|||||||
array1.push("&hypervisor=" + hypervisor);
|
array1.push("&hypervisor=" + hypervisor);
|
||||||
var clustertype = clusterObj.clustertype;
|
var clustertype = clusterObj.clustertype;
|
||||||
array1.push("&clustertype=" + clustertype);
|
array1.push("&clustertype=" + clustertype);
|
||||||
|
array1.push("&hosttags=" + todb(trim($thisDialog.find("#host_tags").val())));
|
||||||
|
|
||||||
if(hypervisor == "VMware") {
|
if(hypervisor == "VMware") {
|
||||||
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
||||||
@ -557,6 +570,19 @@ function bindAddHostButton($leftmenuItem1) {
|
|||||||
url = hostname;
|
url = hostname;
|
||||||
array1.push("&url="+todb(url));
|
array1.push("&url="+todb(url));
|
||||||
} else {
|
} 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("&cpuspeed="+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());
|
var username = trim($thisDialog.find("#host_username").val());
|
||||||
array1.push("&username="+todb(username));
|
array1.push("&username="+todb(username));
|
||||||
|
|
||||||
|
|||||||
@ -838,9 +838,15 @@ function initAddHostShortcut() {
|
|||||||
if(clusterObj.hypervisortype == "VMware") {
|
if(clusterObj.hypervisortype == "VMware") {
|
||||||
$('li[input_group="vmware"]', $dialogAddHost).show();
|
$('li[input_group="vmware"]', $dialogAddHost).show();
|
||||||
$('li[input_group="general"]', $dialogAddHost).hide();
|
$('li[input_group="general"]', $dialogAddHost).hide();
|
||||||
|
$('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 {
|
} else {
|
||||||
$('li[input_group="vmware"]', $dialogAddHost).hide();
|
$('li[input_group="vmware"]', $dialogAddHost).hide();
|
||||||
$('li[input_group="general"]', $dialogAddHost).show();
|
$('li[input_group="general"]', $dialogAddHost).show();
|
||||||
|
$('li[input_group="baremetal"]', $dialogAddHost).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -872,6 +878,12 @@ function initAddHostShortcut() {
|
|||||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_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"));
|
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
|
||||||
} else {
|
} 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("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("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||||
@ -901,6 +913,7 @@ function initAddHostShortcut() {
|
|||||||
array1.push("&hypervisor="+hypervisor);
|
array1.push("&hypervisor="+hypervisor);
|
||||||
var clustertype = clusterObj.clustertype;
|
var clustertype = clusterObj.clustertype;
|
||||||
array1.push("&clustertype=" + clustertype);
|
array1.push("&clustertype=" + clustertype);
|
||||||
|
array1.push("&hosttags=" + todb(trim($thisDialog.find("#host_tags").val())));
|
||||||
|
|
||||||
if(hypervisor == "VMware") {
|
if(hypervisor == "VMware") {
|
||||||
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
||||||
@ -921,6 +934,19 @@ function initAddHostShortcut() {
|
|||||||
array1.push("&url="+todb(url));
|
array1.push("&url="+todb(url));
|
||||||
|
|
||||||
} else {
|
} 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("&cpuspeed="+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());
|
var username = trim($thisDialog.find("#host_username").val());
|
||||||
array1.push("&username="+todb(username));
|
array1.push("&username="+todb(username));
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,8 @@ function afterLoadTemplateJSP() {
|
|||||||
formatSelect.append("<option value='OVA'>OVA</option>");
|
formatSelect.append("<option value='OVA'>OVA</option>");
|
||||||
else if(selectedHypervisorType == "KVM")
|
else if(selectedHypervisorType == "KVM")
|
||||||
formatSelect.append("<option value='QCOW2'>QCOW2</option>");
|
formatSelect.append("<option value='QCOW2'>QCOW2</option>");
|
||||||
|
else if(selectedHypervisorType == "BareMetal")
|
||||||
|
formatSelect.append("<option value='BareMetal'>BareMetal</option>");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -696,9 +696,15 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||||||
if(clusterObj.hypervisortype == "VMware") {
|
if(clusterObj.hypervisortype == "VMware") {
|
||||||
$('li[input_group="vmware"]', $dialogAddHost).show();
|
$('li[input_group="vmware"]', $dialogAddHost).show();
|
||||||
$('li[input_group="general"]', $dialogAddHost).hide();
|
$('li[input_group="general"]', $dialogAddHost).hide();
|
||||||
|
$('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 {
|
} else {
|
||||||
$('li[input_group="vmware"]', $dialogAddHost).hide();
|
$('li[input_group="vmware"]', $dialogAddHost).hide();
|
||||||
$('li[input_group="general"]', $dialogAddHost).show();
|
$('li[input_group="general"]', $dialogAddHost).show();
|
||||||
|
$('li[input_group="baremetal"]', $dialogAddHost).hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -731,6 +737,12 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||||||
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_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"));
|
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
|
||||||
} else {
|
} 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("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("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
|
||||||
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
|
||||||
@ -759,6 +771,7 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||||||
array1.push("&hypervisor="+hypervisor);
|
array1.push("&hypervisor="+hypervisor);
|
||||||
var clustertype = clusterObj.clustertype;
|
var clustertype = clusterObj.clustertype;
|
||||||
array1.push("&clustertype=" + clustertype);
|
array1.push("&clustertype=" + clustertype);
|
||||||
|
array1.push("&hosttags=" + todb(trim($thisDialog.find("#host_tags").val())));
|
||||||
|
|
||||||
if(hypervisor == "VMware") {
|
if(hypervisor == "VMware") {
|
||||||
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
var username = trim($thisDialog.find("#host_vcenter_username").val());
|
||||||
@ -779,6 +792,20 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
|
|||||||
array1.push("&url="+todb(url));
|
array1.push("&url="+todb(url));
|
||||||
|
|
||||||
} else {
|
} 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("&cpuspeed="+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());
|
var username = trim($thisDialog.find("#host_username").val());
|
||||||
array1.push("&username="+todb(username));
|
array1.push("&username="+todb(username));
|
||||||
|
|
||||||
|
|||||||
@ -60,5 +60,6 @@ public interface SerialVersionUID {
|
|||||||
public static final long ConnectionException = Base | 0x20;
|
public static final long ConnectionException = Base | 0x20;
|
||||||
public static final long PermissionDeniedException = Base | 0x21;
|
public static final long PermissionDeniedException = Base | 0x21;
|
||||||
public static final long sshException = Base | 0x22;
|
public static final long sshException = Base | 0x22;
|
||||||
|
public static final long HttpCallException = Base | 0x23;
|
||||||
public static final long VirtualMachineMigrationException = Base | 0x24;
|
public static final long VirtualMachineMigrationException = Base | 0x24;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user