allocator: in case of null guest OS don't fail prioritisation completely (#3607)

In case of null guest OS found for a template, don't fail prioritisation
completely (could still work based on HVM etc).

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2019-09-26 11:06:18 +05:30 committed by GitHub
parent 7f91964aa9
commit 6cec7c7fe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -29,8 +29,6 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.google.common.base.Strings;
import com.cloud.agent.manager.allocator.HostAllocator;
import com.cloud.capacity.CapacityManager;
import com.cloud.capacity.CapacityVO;
@ -419,10 +417,6 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
// Determine the guest OS category of the template
String templateGuestOSCategory = getTemplateGuestOSCategory(template);
if (Strings.isNullOrEmpty(templateGuestOSCategory)) {
return hosts;
}
List<Host> prioritizedHosts = new ArrayList<Host>();
List<Host> noHvmHosts = new ArrayList<Host>();
@ -453,7 +447,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
String hostGuestOSCategory = getHostGuestOSCategory(host);
if (hostGuestOSCategory == null) {
continue;
} else if (templateGuestOSCategory.equals(hostGuestOSCategory)) {
} else if (templateGuestOSCategory != null && templateGuestOSCategory.equals(hostGuestOSCategory)) {
highPriorityHosts.add(host);
} else {
lowPriorityHosts.add(host);