bug 7782: check if hypervisor type is specified before creating cluster

status 7782: resolved fixed
This commit is contained in:
anthony 2010-12-30 15:44:13 -08:00
parent dc7de43aff
commit 951d86f41f
2 changed files with 8 additions and 6 deletions

View File

@ -684,7 +684,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
public List<? extends Host> discoverHosts(AddSecondaryStorageCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException {
Long dcId = cmd.getZoneId();
String url = cmd.getUrl();
return discoverHosts(dcId, null, null, null, url, null, null, "");
return discoverHosts(dcId, null, null, null, url, null, null, "SecondaryStorage");
}
@Override
@ -719,6 +719,10 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
throw new InvalidParameterValueException("Can't specify cluster by both id and name");
}
if (hypervisorType == null || hypervisorType.isEmpty() ) {
throw new InvalidParameterValueException("Need to specify Hypervisor Type");
}
if ((clusterName != null || clusterId != null) && podId == null) {
throw new InvalidParameterValueException("Can't specify cluster without specifying the pod");
}
@ -762,10 +766,8 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
boolean isHypervisorTypeSupported = false;
while (en.hasMoreElements()) {
Discoverer discoverer = en.nextElement();
if(hypervisorType != null) {
if(!discoverer.matchHypervisor(hypervisorType)) {
continue;
}
if(!discoverer.matchHypervisor(hypervisorType)) {
continue;
}
isHypervisorTypeSupported = true;
Map<? extends ServerResource, Map<String, String>> resources = null;

View File

@ -241,7 +241,7 @@ public class SecondaryStorageDiscoverer extends DiscovererBase implements Discov
@Override
public boolean matchHypervisor(String hypervisor) {
if( hypervisor == null || hypervisor.isEmpty()) {
if( hypervisor.equals("SecondaryStorage")) {
return true;
} else {
return false;