Merge branch 'cvm' into 2.2.y

Conflicts:
	api/src/com/cloud/api/BaseCmd.java
	cloud.spec
	core/src/com/cloud/storage/template/DownloadManagerImpl.java
	server/src/com/cloud/agent/manager/AgentManagerImpl.java
	server/src/com/cloud/configuration/DefaultComponentLibrary.java
	server/src/com/cloud/deploy/FirstFitPlanner.java
	server/src/com/cloud/host/dao/HostDao.java
	server/src/com/cloud/network/security/SecurityGroupListener.java
	server/src/com/cloud/storage/StorageManagerImpl.java
	server/src/com/cloud/storage/listener/StoragePoolMonitor.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	server/src/com/cloud/vm/VirtualMachineManagerImpl.java
	utils/src/com/cloud/utils/SerialVersionUID.java
This commit is contained in:
frank 2011-08-19 16:08:35 -07:00
commit 18f87c2108
48 changed files with 606 additions and 129 deletions

View File

@ -0,0 +1,28 @@
package com.cloud.agent.api;
import java.util.List;
import com.cloud.utils.Ternary;
public class PrepareOCFS2NodesCommand extends Command {
List<Ternary<Integer, String, String>> nodes;
String clusterName;
@Override
public boolean executeInSequence() {
return true;
}
public PrepareOCFS2NodesCommand(String clusterName, List<Ternary<Integer, String, String>> nodes) {
this.nodes = nodes;
this.clusterName = clusterName;
}
public List<Ternary<Integer, String, String>> getNodes() {
return nodes;
}
public String getClusterName() {
return clusterName;
}
}

View File

@ -93,7 +93,8 @@ public abstract class BaseCmd {
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
private Object _responseObject = null;
private Map<String, String> fullUrlParams;
@Parameter(name="response", type=CommandType.STRING)
private String responseType;
@ -117,7 +118,7 @@ public abstract class BaseCmd {
public static RemoteAccessVpnService _ravService;
public static BareMetalVmService _bareMetalVmService;
public static FirewallService _firewallService;
static void setComponents(ResponseGenerator generator) {
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
@ -553,7 +554,16 @@ public abstract class BaseCmd {
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) ||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
}
public static boolean isRootAdmin(short accountType) {
return ((accountType == Account.ACCOUNT_TYPE_ADMIN));
}
public void setFullUrlParams(Map<String, String> map) {
this.fullUrlParams = map;
}
public Map<String, String> getFullUrlParams() {
return this.fullUrlParams;
}
}

View File

@ -30,6 +30,7 @@ public class Hypervisor {
Parralels,
BareMetal,
Simulator,
Ovm,
Any; /*If you don't care about the hypervisor type*/
@ -56,6 +57,8 @@ public class Hypervisor {
return HypervisorType.BareMetal;
} else if (hypervisor.equalsIgnoreCase("Simulator")) {
return HypervisorType.Simulator;
} else if (hypervisor.equalsIgnoreCase("Ovm")) {
return HypervisorType.Ovm;
} else if (hypervisor.equalsIgnoreCase("Any")) {
return HypervisorType.Any;
} else {

3
api/src/com/cloud/storage/Storage.java Normal file → Executable file
View File

@ -96,7 +96,8 @@ public class Storage {
LVM(false), // XenServer local LVM SR
SharedMountPoint(true),
VMFS(true), // VMware VMFS storage
PreSetup(true); // for XenServer, Storage Pool is set up by customers.
PreSetup(true), // for XenServer, Storage Pool is set up by customers.
OCFS2(true);
boolean shared;

View File

@ -637,6 +637,7 @@ fi
%{_javadir}/%{name}-core-extras.jar
%{_javadir}/%{name}-server-extras.jar
%{_javadir}/%{name}-vmware-base.jar
%{_javadir}/%{name}-ovm.jar
# maintain the following list in sync with files agent-scripts
%{_libdir}/%{name}/agent/premium-scripts/*
%{_sysconfdir}/%{name}/management/commands-ext.properties

View File

@ -90,7 +90,7 @@ public interface Listener {
* @param state the current state of the agent.
*/
boolean processDisconnect(long agentId, Status state);
/**
* If this Listener is passed to the send() method, this method
* is called by AgentManager after processing an answer

View File

@ -793,7 +793,11 @@ public class DownloadManagerImpl implements DownloadManager {
processor = new VmdkProcessor();
processor.configure("VMDK Processor", params);
processors.add(new ComponentInfo<Adapter>("VMDK Processor", VmdkProcessor.class, processor));
processor = new RawImageProcessor();
processor.configure("Raw Image Processor", params);
processors.add(new ComponentInfo<Adapter>("Raw Image Processor", RawImageProcessor.class, processor));
_processors = new Adapters<Processor>("processors", processors);
_templateDir = (String) params.get("public.templates.root.dir");

View File

@ -0,0 +1,70 @@
package com.cloud.storage.template;
import java.io.File;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.exception.InternalErrorException;
import com.cloud.storage.StorageLayer;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.template.Processor.FormatInfo;
@Local(value=Processor.class)
public class RawImageProcessor implements Processor {
private static final Logger s_logger = Logger.getLogger(RawImageProcessor.class);
String _name;
StorageLayer _storage;
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
_name = name;
_storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey);
if (_storage == null) {
throw new ConfigurationException("Unable to get storage implementation");
}
return true;
}
@Override
public String getName() {
return _name;
}
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public FormatInfo process(String templatePath, ImageFormat format,
String templateName) throws InternalErrorException {
if (format != null) {
s_logger.debug("We currently don't handle conversion from " + format + " to raw image.");
return null;
}
String imgPath = templatePath + File.separator + templateName + "." + ImageFormat.RAW.getFileExtension();
if (!_storage.exists(imgPath)) {
s_logger.debug("Unable to find raw image:" + imgPath);
}
FormatInfo info = new FormatInfo();
info.format = ImageFormat.RAW;
info.filename = templateName + "." + ImageFormat.RAW.getFileExtension();
info.size = _storage.getSize(imgPath);
info.virtualSize = info.size;
s_logger.debug("Process raw image " + info.filename + " successfully");
return info;
}
}

View File

@ -2087,7 +2087,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, Manager {
// If this command is from a KVM agent, or from an agent that has a
// null hypervisor type, don't do the CIDR check
if (hypervisorType == null || hypervisorType == HypervisorType.KVM || hypervisorType == HypervisorType.VMware || hypervisorType == HypervisorType.BareMetal
|| hypervisorType == HypervisorType.Simulator) {
|| hypervisorType == HypervisorType.Simulator || hypervisorType == HypervisorType.Ovm) {
doCidrCheck = false;
}

View File

@ -346,7 +346,7 @@ public class ApiServer implements HttpRequestHandler {
if (cmdClassName != null) {
Class<?> cmdClass = Class.forName(cmdClassName);
BaseCmd cmdObj = (BaseCmd) cmdClass.newInstance();
cmdObj.setFullUrlParams(paramMap);
cmdObj.setResponseType(responseType);
// This is where the command is either serialized, or directly dispatched
response = queueCommand(cmdObj, paramMap);

View File

View File

@ -76,6 +76,5 @@ public class ClusterAsyncExectuionListener implements Listener {
public int getTimeout() {
return -1;
}
}

View File

@ -157,7 +157,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),
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),
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"),
HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware + "," + HypervisorType.BareMetal + "," + HypervisorType.Ovm, "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),
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),

View File

@ -108,6 +108,7 @@ import com.cloud.network.vpn.RemoteAccessVpnManagerImpl;
import com.cloud.offerings.dao.NetworkOfferingDaoImpl;
import com.cloud.resource.ResourceManagerImpl;
import com.cloud.service.dao.ServiceOfferingDaoImpl;
import com.cloud.storage.OCFS2ManagerImpl;
import com.cloud.storage.StorageManagerImpl;
import com.cloud.storage.dao.DiskOfferingDaoImpl;
import com.cloud.storage.dao.GuestOSCategoryDaoImpl;
@ -315,6 +316,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
addManager("ClusterFenceManager", ClusterFenceManagerImpl.class);
addManager("ResourceManager", ResourceManagerImpl.class);
addManager("FirewallManager", FirewallManagerImpl.class);
addManager("OCFS2Manager", OCFS2ManagerImpl.class);
ComponentInfo<? extends Manager> info = addManager("ConsoleProxyManager", ConsoleProxyManagerImpl.class);
info.addParameter("consoleproxy.sslEnabled", "true");
addManager("ClusteredAgentManager", ClusteredAgentManagerImpl.class);

View File

1
server/src/com/cloud/dc/ClusterDetailsDaoImpl.java Normal file → Executable file
View File

@ -53,6 +53,7 @@ public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long
return findOneIncludingRemovedBy(sc);
}
@Override
public Map<String, String> findDetails(long clusterId) {

View File

@ -175,4 +175,6 @@ public interface HostDao extends GenericDao<HostVO, Long> {
List<HostVO> listAllRoutingAgents();
List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
List<HostVO> listByInAllStatus(Type type, Long clusterId, Long podId, long dcId);
}

View File

@ -451,6 +451,23 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
return listBy(sc);
}
@Override
public List<HostVO> listByInAllStatus(Host.Type type, Long clusterId, Long podId, long dcId) {
SearchCriteria<HostVO> sc = TypePodDcStatusSearch.create();
if ( type != null ) {
sc.setParameters("type", type.toString());
}
if (clusterId != null) {
sc.setParameters("cluster", clusterId);
}
if (podId != null ) {
sc.setParameters("pod", podId);
}
sc.setParameters("dc", dcId);
return listBy(sc);
}
@Override
public List<HostVO> listBy(Long clusterId, Long podId, long dcId) {
SearchCriteria<HostVO> sc = TypePodDcStatusSearch.create();

View File

@ -46,7 +46,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
@Override
public <T extends VirtualMachine> VirtualMachineTO implement(VirtualMachineProfile<T> vm) {
BootloaderType bt = BootloaderType.PyGrub;
if (vm.getBootLoaderType() != null) {
if (vm.getBootLoaderType() == BootloaderType.CD) {
bt = vm.getBootLoaderType();
}
VirtualMachineTO to = toVirtualMachineTO(vm);

View File

@ -595,6 +595,5 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
@Override
public boolean processTimeout(long agentId, long seq) {
return false;
}
}
}

0
server/src/com/cloud/network/SshKeysDistriMonitor.java Normal file → Executable file
View File

0
server/src/com/cloud/network/ovs/OvsListener.java Normal file → Executable file
View File

View File

@ -130,5 +130,4 @@ public class OvsTunnelListener implements Listener {
// TODO Auto-generated method stub
return true;
}
}

View File

@ -150,7 +150,6 @@ public class SecurityGroupListener implements Listener {
return true;
}
@Override
public boolean processTimeout(long agentId, long seq) {
return true;

View File

@ -361,7 +361,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
allocationState = Host.HostAllocationState.Enabled.toString();
}
return discoverHostsFull(dcId, podId, clusterId, clusterName, url, username, password, cmd.getHypervisor(), hostTags, bareMetalParams, allocationState);
return discoverHostsFull(dcId, podId, clusterId, clusterName, url, username, password, cmd.getHypervisor(), hostTags, cmd.getFullUrlParams(), allocationState);
}
@Override

View File

View File

@ -0,0 +1,15 @@
package com.cloud.storage;
import java.util.List;
import java.util.Map;
import com.cloud.host.HostVO;
import com.cloud.utils.component.Manager;
public interface OCFS2Manager extends Manager {
static final String CLUSTER_NAME = "clusterName";
boolean prepareNodes(List<HostVO> hosts, StoragePool pool, Map<String, String> params);
boolean prepareNodes(Long clusterId);
}

View File

@ -0,0 +1,140 @@
package com.cloud.storage;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.PrepareOCFS2NodesCommand;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.HostPodVO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.dao.StoragePoolDetailsDao;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
import com.cloud.utils.component.Inject;
import com.cloud.utils.exception.CloudRuntimeException;
@Local(value ={OCFS2Manager.class})
public class OCFS2ManagerImpl implements OCFS2Manager {
String _name;
private static final Logger s_logger = Logger.getLogger(OCFS2ManagerImpl.class);
@Inject ClusterDetailsDao _clusterDetailsDao;
@Inject AgentManager _agentMgr;
@Inject HostDao _hostDao;
@Inject ClusterDao _clusterDao;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
_name = name;
return true;
}
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
return true;
}
@Override
public String getName() {
return _name;
}
private List<Ternary<Integer, String, String>> marshalNodes(List<HostVO> hosts) {
Integer i = 0;
List<Ternary<Integer, String, String>> lst = new ArrayList<Ternary<Integer, String, String>>();
for (HostVO h : hosts) {
String nodeName = "node_" + h.getPrivateIpAddress().replace(".", "_");
Ternary<Integer, String, String> node = new Ternary<Integer, String, String>(i, h.getPrivateIpAddress(), nodeName);
lst.add(node);
i ++;
}
return lst;
}
private boolean prepareNodes(String clusterName, List<HostVO> hosts) {
PrepareOCFS2NodesCommand cmd = new PrepareOCFS2NodesCommand(clusterName, marshalNodes(hosts));
for (HostVO h : hosts) {
Answer ans = _agentMgr.easySend(h.getId(), cmd);
if (ans == null) {
s_logger.debug("Host " + h.getId() + " is not in UP state, skip preparing OCFS2 node on it");
continue;
}
if (!ans.getResult()) {
s_logger.warn("PrepareOCFS2NodesCommand failed on host " + h.getId() + " " + ans.getDetails());
return false;
}
}
return true;
}
@Override
public boolean prepareNodes(List<HostVO> hosts, StoragePool pool, Map<String, String> params) {
if (pool.getPoolType() != StoragePoolType.OCFS2) {
throw new CloudRuntimeException("None OCFS2 storage pool is getting into OCFS2 manager!");
}
/*
String clusterName = params.get(OCFS2Manager.CLUSTER_NAME);
if (clusterName == null) {
throw new CloudRuntimeException("Cannot get OCFS2 cluster name");
}
*/
String clusterName = "ofcs2";
Map<String, String> details = _clusterDetailsDao.findDetails(pool.getClusterId());
String currentClusterName = details.get(OCFS2Manager.CLUSTER_NAME);
if (currentClusterName == null) {
details.put(OCFS2Manager.CLUSTER_NAME, clusterName);
/* This is actual _clusterDetailsDao.update() */
_clusterDetailsDao.persist(pool.getClusterId(), details);
} else {
if (!currentClusterName.equals(clusterName)) {
throw new CloudRuntimeException("Cluster already has name " + currentClusterName + " while name you giving is " + clusterName);
}
}
return prepareNodes(clusterName, hosts);
}
@Override
public boolean prepareNodes(Long clusterId) {
Map<String, String> details = _clusterDetailsDao.findDetails(clusterId);
String clusterName = details.get(OCFS2Manager.CLUSTER_NAME);
if (clusterName == null) {
throw new CloudRuntimeException("Cannot find OCFS2 cluster name for cluster " + clusterId);
}
ClusterVO cluster = _clusterDao.findById(clusterId);
if (cluster == null) {
throw new CloudRuntimeException("Cannot find cluster for ID " + clusterId);
}
List<HostVO> hosts = _hostDao.listByInAllStatus(Host.Type.Routing, clusterId, cluster.getPodId(), cluster.getDataCenterId());
if (hosts.isEmpty()) {
throw new CloudRuntimeException("No host up to associate a storage pool with in cluster " + clusterId);
}
return prepareNodes(clusterName, hosts);
}
}

View File

@ -280,9 +280,13 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
protected StoragePoolWorkDao _storagePoolWorkDao;
@Inject
protected HypervisorGuruManager _hvGuruMgr;
@Inject
protected VolumeDao _volumeDao;
@Inject
protected OCFS2Manager _ocfs2Mgr;
@Inject(adapter = StoragePoolAllocator.class)
protected Adapters<StoragePoolAllocator> _storagePoolAllocators;
@Inject(adapter = StoragePoolDiscoverer.class)
@ -1188,6 +1192,9 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
pool = new StoragePoolVO(StoragePoolType.ISO, storageHost, port, hostPath);
} else if (scheme.equalsIgnoreCase("vmfs")) {
pool = new StoragePoolVO(StoragePoolType.VMFS, "VMFS datastore: " + hostPath, 0, hostPath);
} else if (scheme.equalsIgnoreCase("ocfs2")) {
port = 7777;
pool = new StoragePoolVO(StoragePoolType.OCFS2, "clustered", port, hostPath);
} else {
s_logger.warn("Unable to figure out the scheme for URI: " + uri);
throw new IllegalArgumentException("Unable to figure out the scheme for URI: " + uri);
@ -1235,6 +1242,12 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
pool.setStatus(StoragePoolStatus.Up);
pool = _storagePoolDao.persist(pool, details);
if (pool.getPoolType() == StoragePoolType.OCFS2 && !_ocfs2Mgr.prepareNodes(allHosts, pool, cmd.getFullUrlParams())) {
s_logger.warn("Can not create storage pool " + pool + " on cluster " + clusterId);
_storagePoolDao.expunge(pool.getId());
return null;
}
boolean success = false;
for (HostVO h : allHosts) {
success = createStoragePool(h.getId(), pool);
@ -1422,7 +1435,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
s_logger.debug("creating pool " + pool.getName() + " on host " + hostId);
if (pool.getPoolType() != StoragePoolType.NetworkFilesystem && pool.getPoolType() != StoragePoolType.Filesystem && pool.getPoolType() != StoragePoolType.IscsiLUN
&& pool.getPoolType() != StoragePoolType.Iscsi && pool.getPoolType() != StoragePoolType.VMFS && pool.getPoolType() != StoragePoolType.SharedMountPoint
&& pool.getPoolType() != StoragePoolType.PreSetup) {
&& pool.getPoolType() != StoragePoolType.PreSetup && pool.getPoolType() != StoragePoolType.OCFS2) {
s_logger.warn(" Doesn't support storage pool type " + pool.getPoolType());
return false;
}

View File

View File

@ -32,18 +32,27 @@ import com.cloud.exception.ConnectionException;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.server.ManagementService;
import com.cloud.storage.OCFS2Manager;
import com.cloud.storage.StorageManagerImpl;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.component.Inject;
public class StoragePoolMonitor implements Listener {
private static final Logger s_logger = Logger.getLogger(StoragePoolMonitor.class);
private final StorageManagerImpl _storageManager;
private final StoragePoolDao _poolDao;
OCFS2Manager _ocfs2Mgr;
public StoragePoolMonitor(StorageManagerImpl mgr, StoragePoolDao poolDao) {
this._storageManager = mgr;
this._poolDao = poolDao;
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
this._ocfs2Mgr = locator.getManager(OCFS2Manager.class);
}
@ -67,12 +76,17 @@ public class StoragePoolMonitor implements Listener {
if (cmd instanceof StartupRoutingCommand) {
StartupRoutingCommand scCmd = (StartupRoutingCommand)cmd;
if (scCmd.getHypervisorType() == HypervisorType.XenServer || scCmd.getHypervisorType() == HypervisorType.KVM ||
scCmd.getHypervisorType() == HypervisorType.VMware || scCmd.getHypervisorType() == HypervisorType.Simulator) {
scCmd.getHypervisorType() == HypervisorType.VMware || scCmd.getHypervisorType() == HypervisorType.Simulator || scCmd.getHypervisorType() == HypervisorType.Ovm) {
List<StoragePoolVO> pools = _poolDao.listBy(host.getDataCenterId(), host.getPodId(), host.getClusterId());
for (StoragePoolVO pool : pools) {
if (!pool.getPoolType().isShared()) {
continue;
}
if (pool.getPoolType() == StoragePoolType.OCFS2 && !_ocfs2Mgr.prepareNodes(pool.getClusterId())) {
throw new ConnectionException(true, "Unable to prepare OCFS2 nodes for pool " + pool.getId());
}
Long hostId = host.getId();
s_logger.debug("Host " + hostId + " connected, sending down storage pool information ...");
try {

View File

@ -79,6 +79,5 @@ public class StorageSyncListener implements Listener {
@Override
public int getTimeout() {
return -1;
}
}
}

View File

View File

@ -446,5 +446,4 @@ public class UploadListener implements Listener {
public void setCurrState(Status uploadState) {
this.currState = getState(currState.toString());
}
}

View File

@ -95,7 +95,8 @@ public class HyervisorTemplateAdapter extends TemplateAdapterBase implements Tem
&&(!url.toLowerCase().endsWith("qcow2"))&&(!url.toLowerCase().endsWith("qcow2.zip"))
&&(!url.toLowerCase().endsWith("qcow2.bz2"))&&(!url.toLowerCase().endsWith("qcow2.gz"))
&&(!url.toLowerCase().endsWith("ova"))&&(!url.toLowerCase().endsWith("ova.zip"))
&&(!url.toLowerCase().endsWith("ova.bz2"))&&(!url.toLowerCase().endsWith("ova.gz"))){
&&(!url.toLowerCase().endsWith("ova.bz2"))&&(!url.toLowerCase().endsWith("ova.gz"))
&&(!url.toLowerCase().endsWith("img"))&&(!url.toLowerCase().endsWith("raw"))){
throw new InvalidParameterValueException("Please specify a valid "+ cmd.getFormat().toLowerCase());
}

View File

@ -2672,20 +2672,24 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (owner.getState() == Account.State.disabled) {
throw new PermissionDeniedException("The owner of " + vm + " is disabled: " + vm.getAccountId());
}
VirtualMachineTemplate template = profile.getTemplate();
if (vm.getIsoId() != null) {
template = _templateDao.findById(vm.getIsoId());
}
if (template != null && template.getFormat() == ImageFormat.ISO && vm.getIsoId() != null) {
String isoPath = null;
String isoPath = null;
VirtualMachineTemplate template = _templateDao.findById(vm.getIsoId());
if (template == null || template.getFormat() != ImageFormat.ISO) {
throw new CloudRuntimeException("Can not find ISO in vm_template table for id " + vm.getIsoId());
}
Pair<String, String> isoPathPair = _storageMgr.getAbsoluteIsoPath(template.getId(), vm.getDataCenterIdToDeployIn());
if (isoPathPair == null) {
s_logger.warn("Couldn't get absolute iso path");
return false;
} else {
isoPath = isoPathPair.first();
}
if (template.isBootable()) {
profile.setBootLoaderType(BootloaderType.CD);
}
@ -2699,12 +2703,13 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
iso.setDeviceId(3);
profile.addDisk(iso);
} else {
VirtualMachineTemplate template = profile.getTemplate();
/* create a iso placeholder */
VolumeTO iso = new VolumeTO(profile.getId(), Volume.Type.ISO, StoragePoolType.ISO, null, template.getName(), null, null, 0, null);
iso.setDeviceId(3);
profile.addDisk(iso);
}
return true;
}

View File

@ -280,6 +280,20 @@ dictionary = {
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Username:</label>
<input class="text" type="text" id="agent_username" value="oracle" />
<div id="agent_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Password:</label>
<input class="text" type="password" id="agent_password" />
<div id="agent_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label input_group="general">
<fmt:message key="label.host.tags"/>:</label>

View File

@ -819,6 +819,20 @@ dictionary = {
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Username:</label>
<input class="text" type="text" id="agent_username" value="oracle" />
<div id="agent_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Password:</label>
<input class="text" type="password" id="agent_password" />
<div id="agent_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label input_group="general">
<fmt:message key="label.host.tags"/>:</label>

View File

@ -506,6 +506,20 @@ dictionary = {
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Username:</label>
<input class="text" type="text" id="agent_username" value="oracle" />
<div id="agent_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Password:</label>
<input class="text" type="password" id="agent_password" />
<div id="agent_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label input_group="general">
<fmt:message key="label.host.tags"/>:</label>

View File

@ -984,6 +984,20 @@
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Username:</label>
<input class="text" type="text" id="agent_username" value="oracle" />
<div id="agent_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Password:</label>
<input class="text" type="password" id="agent_password" />
<div id="agent_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label input_group="general">
<fmt:message key="label.host.tags"/>:</label>

View File

@ -472,6 +472,20 @@ dictionary = {
<div id="host_baremetal_mac_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Username:</label>
<input class="text" type="text" id="agent_username" value="oracle" />
<div id="agent_username_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li input_group="Ovm" style="display: none;">
<label>
Agent Password:</label>
<input class="text" type="password" id="agent_password" />
<div id="agent_password_errormsg" class="dialog_formcontent_errormsg" style="display: none;">
</div>
</li>
<li>
<label input_group="general">
<fmt:message key="label.host.tags"/>:</label>

View File

@ -539,61 +539,72 @@ function bindAddClusterButton($leftmenuItem1) {
function bindAddHostButton($leftmenuItem1) {
var $button = $("#add_host_button");
var dialogAddHost = $("#dialog_add_host");
dialogAddHost.find("#cluster_select").change(function() {
var $dialogAddHost = $("#dialog_add_host");
$dialogAddHost.find("#cluster_select").change(function() {
var clusterId = $(this).val();
if(clusterId == null)
return;
var clusterObj = clustersUnderOnePod[clusterId];
if(clusterObj.hypervisortype == "VMware") {
$('li[input_group="vmware"]', dialogAddHost).show();
$('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 {
$('li[input_group="vmware"]', dialogAddHost).hide();
$('li[input_group="general"]', dialogAddHost).show();
$('li[input_group="baremetal"]', dialogAddHost).hide();
$('li[input_group="vmware"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "BareMetal") {
$('li[input_group="baremetal"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "Ovm") {
$('li[input_group="Ovm"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
}
else {
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
});
$button.unbind("click").bind("click", function(event) {
dialogAddHost.find("#info_container").hide();
dialogAddHost.find("#new_cluster_name").val("");
$dialogAddHost.find("#info_container").hide();
$dialogAddHost.find("#new_cluster_name").val("");
var zoneId, podId, clusterId;
if(currentRightPanelJSP == "jsp/pod.jsp") {
var podObj = $leftmenuItem1.data("jsonObj");
zoneId = podObj.zoneid;
podId = podObj.id;
dialogAddHost.find("#zone_name").text(fromdb(podObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(podObj.name));
$dialogAddHost.find("#zone_name").text(fromdb(podObj.zonename));
$dialogAddHost.find("#pod_name").text(fromdb(podObj.name));
}
else if(currentRightPanelJSP == "jsp/cluster.jsp") {
var clusterObj = $leftmenuItem1.data("jsonObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
clusterId = clusterObj.id;
dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname));
$dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename));
$dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname));
}
else if(currentRightPanelJSP == "jsp/host.jsp") {
var clusterObj = $leftmenuItem1.data("clusterObj");
zoneId = clusterObj.zoneid;
podId = clusterObj.podid;
clusterId = clusterObj.id;
dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename));
dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname));
$dialogAddHost.find("#zone_name").text(fromdb(clusterObj.zonename));
$dialogAddHost.find("#pod_name").text(fromdb(clusterObj.podname));
}
refreshClsuterFieldInAddHostDialog(dialogAddHost, podId, clusterId);
refreshClsuterFieldInAddHostDialog($dialogAddHost, podId, clusterId);
dialogAddHost.find("#cluster_select").change();
$dialogAddHost.find("#cluster_select").change();
dialogAddHost
$dialogAddHost
.dialog('option', 'buttons', {
"Add": function() {
var $thisDialog = $(this);
@ -617,17 +628,24 @@ function bindAddHostButton($leftmenuItem1) {
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg"));
*/
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
} else {
}
else {
//general
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
if (hypervisor == "BareMetal") {
isValid &= validateString("CPU Cores", $thisDialog.find("#host_baremetal_cpucores"), $thisDialog.find("#host_baremetal_cpucores_errormsg"));
isValid &= validateString("CPU", $thisDialog.find("#host_baremetal_cpu"), $thisDialog.find("#host_baremetal_cpu_errormsg"));
isValid &= validateString("Memory", $thisDialog.find("#host_baremetal_memory"), $thisDialog.find("#host_baremetal_memory_errormsg"));
isValid &= validateString("MAC", $thisDialog.find("#host_baremetal_mac"), $thisDialog.find("#host_baremetal_mac_errormsg"));
}
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
}
else if(hypervisor == "Ovm") {
isValid &= validateString("Agent Username", $thisDialog.find("#agent_username"), $thisDialog.find("#agent_username_errormsg"), true); //optional
isValid &= validateString("Agent Password", $thisDialog.find("#agent_password"), $thisDialog.find("#agent_password_errormsg"), false); //required
}
}
}
if (!isValid)
return;
@ -665,20 +683,8 @@ function bindAddHostButton($leftmenuItem1) {
else
url = hostname;
array1.push("&url="+todb(url));
} else {
if (hypervisor == "BareMetal") {
var cpuCores = trim($thisDialog.find("#host_baremetal_cpucores").val());
array1.push("&cpunumber="+todb(cpuCores));
var cpuSpeed = trim($thisDialog.find("#host_baremetal_cpu").val());
array1.push("&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));
}
}
else {
var username = trim($thisDialog.find("#host_username").val());
array1.push("&username="+todb(username));
@ -691,7 +697,28 @@ function bindAddHostButton($leftmenuItem1) {
url = "http://" + todb(hostname);
else
url = hostname;
array1.push("&url="+todb(url));
array1.push("&url="+todb(url));
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));
}
else if(hypervisor == "Ovm") {
var agentUsername = $thisDialog.find("#agent_username").val();
array1.push("&agentusername="+todb(agentUsername));
var agentPassword = $thisDialog.find("#agent_password").val();
array1.push("&agentpassword="+todb(agentPassword));
}
}
$.ajax({
@ -717,7 +744,7 @@ function bindAddHostButton($leftmenuItem1) {
},
error: function(XMLHttpResponse) {
handleError(XMLHttpResponse, function() {
//refreshClsuterFieldInAddHostDialog($thisDialog, podId, clusterId, dialogAddHost.find("#host_hypervisor").val());
//refreshClsuterFieldInAddHostDialog($thisDialog, podId, clusterId, $dialogAddHost.find("#host_hypervisor").val());
handleErrorInDialog(XMLHttpResponse, $thisDialog);
});
}

View File

@ -845,19 +845,31 @@ function initAddHostShortcut() {
if(clusterId == null)
return;
var clusterObj = clustersUnderOnePod[clusterId];
if(clusterObj.hypervisortype == "VMware") {
if(clusterObj.hypervisortype == "VMware") {
$('li[input_group="vmware"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
} else if (clusterObj.hypervisortype == "BareMetal") {
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "BareMetal") {
$('li[input_group="baremetal"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "Ovm") {
$('li[input_group="Ovm"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
}
else {
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="baremetal"]', $dialogAddHost).show();
} else {
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
}
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
});
$("#add_host_shortcut").unbind("click").bind("click", function(event) {
@ -889,16 +901,22 @@ function initAddHostShortcut() {
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg"));
*/
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
} else {
}
else {
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
if (hypervisor == "BareMetal") {
isValid &= validateString("CPU Cores", $thisDialog.find("#host_baremetal_cpucores"), $thisDialog.find("#host_baremetal_cpucores_errormsg"));
isValid &= validateString("CPU", $thisDialog.find("#host_baremetal_cpu"), $thisDialog.find("#host_baremetal_cpu_errormsg"));
isValid &= validateString("Memory", $thisDialog.find("#host_baremetal_memory"), $thisDialog.find("#host_baremetal_memory_errormsg"));
isValid &= validateString("MAC", $thisDialog.find("#host_baremetal_mac"), $thisDialog.find("#host_baremetal_mac_errormsg"));
}
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
}
else if(hypervisor == "Ovm") {
isValid &= validateString("Agent Username", $thisDialog.find("#agent_username"), $thisDialog.find("#agent_username_errormsg"), true); //optional
isValid &= validateString("Agent Password", $thisDialog.find("#agent_password"), $thisDialog.find("#agent_password_errormsg"), false); //required
}
}
}
if (!isValid)
@ -950,20 +968,8 @@ function initAddHostShortcut() {
url = hostname;
array1.push("&url="+todb(url));
} else {
if (hypervisor == "BareMetal") {
var cpuCores = trim($thisDialog.find("#host_baremetal_cpucores").val());
array1.push("&cpunumber="+todb(cpuCores));
var cpuSpeed = trim($thisDialog.find("#host_baremetal_cpu").val());
array1.push("&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));
}
}
else {
var username = trim($thisDialog.find("#host_username").val());
array1.push("&username="+todb(username));
@ -977,6 +983,27 @@ function initAddHostShortcut() {
else
url = hostname;
array1.push("&url="+todb(url));
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));
}
else if(hypervisor == "Ovm") {
var agentUsername = $thisDialog.find("#agent_username").val();
array1.push("&agentusername="+todb(agentUsername));
var agentPassword = $thisDialog.find("#agent_password").val();
array1.push("&agentpassword="+todb(agentPassword));
}
}
$.ajax({
@ -1928,6 +1955,10 @@ function bindEventHandlerToDialogAddPool($dialogAddPool) {
$protocolSelector.append('<option value="nfs">' + g_dictionary["label.nfs"] + '</option>');
$protocolSelector.append('<option value="vmfs">' + g_dictionary["label.VMFS.datastore"] + '</option>');
}
else if(clusterObj.hypervisortype == "Ovm") {
$protocolSelector.empty();
$protocolSelector.append('<option value="nfs">' + g_dictionary["label.nfs"] + '</option>');
}
else {
$protocolSelector.empty();
}

View File

@ -84,7 +84,8 @@ function afterLoadTemplateJSP() {
formatSelect.append("<option value='QCOW2'>QCOW2</option>");
else if(selectedHypervisorType == "BareMetal")
formatSelect.append("<option value='BareMetal'>BareMetal</option>");
else if(selectedHypervisorType == "Ovm")
formatSelect.append("<option value='RAW'>RAW</option>");
return false;
});

View File

@ -755,19 +755,31 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
if(clusterId == null)
return;
var clusterObj = clustersUnderOnePod[clusterId];
if(clusterObj.hypervisortype == "VMware") {
if(clusterObj.hypervisortype == "VMware") {
$('li[input_group="vmware"]', $dialogAddHost).show();
$('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 {
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "BareMetal") {
$('li[input_group="baremetal"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
else if (clusterObj.hypervisortype == "Ovm") {
$('li[input_group="Ovm"]', $dialogAddHost).show();
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
}
else {
$('li[input_group="general"]', $dialogAddHost).show();
$('li[input_group="vmware"]', $dialogAddHost).hide();
$('li[input_group="baremetal"]', $dialogAddHost).hide();
$('li[input_group="Ovm"]', $dialogAddHost).hide();
}
});
$button.unbind("click").bind("click", function(event) {
@ -800,17 +812,23 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
isValid &= validateString("vCenter Datacenter", $thisDialog.find("#host_vcenter_dc"), $thisDialog.find("#host_vcenter_dc_errormsg"));
*/
isValid &= validateString("vCenter Host", $thisDialog.find("#host_vcenter_host"), $thisDialog.find("#host_vcenter_host_errormsg"));
} else {
}
else {
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
if (hypervisor == "BareMetal") {
isValid &= validateString("CPU Cores", $thisDialog.find("#host_baremetal_cpucores"), $thisDialog.find("#host_baremetal_cpucores_errormsg"));
isValid &= validateString("CPU", $thisDialog.find("#host_baremetal_cpu"), $thisDialog.find("#host_baremetal_cpu_errormsg"));
isValid &= validateString("Memory", $thisDialog.find("#host_baremetal_memory"), $thisDialog.find("#host_baremetal_memory_errormsg"));
isValid &= validateString("MAC", $thisDialog.find("#host_baremetal_mac"), $thisDialog.find("#host_baremetal_mac_errormsg"));
}
isValid &= validateString("Host name", $thisDialog.find("#host_hostname"), $thisDialog.find("#host_hostname_errormsg"));
isValid &= validateString("User name", $thisDialog.find("#host_username"), $thisDialog.find("#host_username_errormsg"));
isValid &= validateString("Password", $thisDialog.find("#host_password"), $thisDialog.find("#host_password_errormsg"));
}
else if(hypervisor == "Ovm") {
isValid &= validateString("Agent Username", $thisDialog.find("#agent_username"), $thisDialog.find("#agent_username_errormsg"), true); //optional
isValid &= validateString("Agent Password", $thisDialog.find("#agent_password"), $thisDialog.find("#agent_password_errormsg"), false); //required
}
}
}
if (!isValid)
return;
@ -860,21 +878,8 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
url = hostname;
array1.push("&url="+todb(url));
} else {
if (hypervisor == "BareMetal") {
var cpuCores = trim($thisDialog.find("#host_baremetal_cpucores").val());
array1.push("&cpunumber="+todb(cpuCores));
var cpuSpeed = trim($thisDialog.find("#host_baremetal_cpu").val());
array1.push("&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));
}
}
else {
var username = trim($thisDialog.find("#host_username").val());
array1.push("&username="+todb(username));
@ -888,6 +893,27 @@ function bindAddHostButtonOnZonePage($button, zoneId, zoneName) {
else
url = hostname;
array1.push("&url="+todb(url));
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));
}
else if(hypervisor == "Ovm") {
var agentUsername = $thisDialog.find("#agent_username").val();
array1.push("&agentusername="+todb(agentUsername));
var agentPassword = $thisDialog.find("#agent_password").val();
array1.push("&agentpassword="+todb(agentPassword));
}
}
$.ajax({

View File

@ -65,4 +65,5 @@ public interface SerialVersionUID {
public static final long DiscoveredWithErrorException = Base | 0x25;
public static final long NoTransitionException = Base | 0x26;
public static final long CloudExecutionException = Base | 0x27;
public static final long CallFailedException = Base | 0x26;
}

View File

@ -261,7 +261,7 @@ depsclasspath = [ in_javadir(_basename(x)) for x in _glob(_join(conf.srcdir,"dep
conf.env.DEPSCLASSPATH = pathsep.join(depsclasspath)
# the MS classpath points to JARs required to run the management server
msclasspath = [ in_javadir("%s-%s.jar"%(conf.env.PACKAGE,x)) for x in "utils api core server server-extras core-extras vmware-base".split() ]
msclasspath = [ in_javadir("%s-%s.jar"%(conf.env.PACKAGE,x)) for x in "utils api core server server-extras core-extras vmware-base ovm".split() ]
conf.env.MSCLASSPATH = pathsep.join(msclasspath)
# the agent and simulator classpaths point to JARs required to run these two applications