bug 7751: if discover is not found for a hypervisor type, print meaningful message here

status 7751: resolved fixed
This commit is contained in:
anthony 2010-12-29 18:36:24 -08:00
parent 510e42791e
commit 466dff8757
2 changed files with 12 additions and 3 deletions

View File

@ -758,6 +758,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
List<HostVO> hosts = new ArrayList<HostVO>();
s_logger.info("Trying to add a new host at " + url + " in data center " + dcId);
Enumeration<Discoverer> en = _discoverers.enumeration();
boolean isHypervisorTypeSupported = false;
while (en.hasMoreElements()) {
Discoverer discoverer = en.nextElement();
if(hypervisorType != null) {
@ -765,7 +766,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
continue;
}
}
isHypervisorTypeSupported = true;
Map<? extends ServerResource, Map<String, String>> resources = null;
try {
@ -800,7 +801,11 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
return hosts;
}
}
if ( !isHypervisorTypeSupported ) {
String msg = "Do not support HypervisorType " + hypervisorType + " for " + url;
s_logger.warn(msg);
throw new DiscoveryException(msg);
}
s_logger.warn("Unable to find the server resources at " + url);
throw new DiscoveryException("Unable to add the host");
}

View File

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