mirror of https://github.com/apache/cloudstack.git
bug 7782: check if hypervisor type is specified before creating cluster
status 7782: resolved fixed
This commit is contained in:
parent
dc7de43aff
commit
951d86f41f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue