From 6cec7c7fe932267353301b072ddbc2369ed9f9e2 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 26 Sep 2019 11:06:18 +0530 Subject: [PATCH] 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 --- .../agent/manager/allocator/impl/FirstFitAllocator.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java b/server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java index f4ad478861e..186c654fda3 100644 --- a/server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java +++ b/server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java @@ -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 prioritizedHosts = new ArrayList(); List noHvmHosts = new ArrayList(); @@ -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);