Skip to content

Commit 6cec7c7

Browse files
allocator: in case of null guest OS don't fail prioritisation completely (apache#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 <[email protected]>
1 parent 7f91964 commit 6cec7c7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import org.apache.log4j.Logger;
3030
import org.springframework.stereotype.Component;
3131

32-
import com.google.common.base.Strings;
33-
3432
import com.cloud.agent.manager.allocator.HostAllocator;
3533
import com.cloud.capacity.CapacityManager;
3634
import com.cloud.capacity.CapacityVO;
@@ -419,10 +417,6 @@ protected List<? extends Host> prioritizeHosts(VMTemplateVO template, ServiceOff
419417
// Determine the guest OS category of the template
420418
String templateGuestOSCategory = getTemplateGuestOSCategory(template);
421419

422-
if (Strings.isNullOrEmpty(templateGuestOSCategory)) {
423-
return hosts;
424-
}
425-
426420
List<Host> prioritizedHosts = new ArrayList<Host>();
427421
List<Host> noHvmHosts = new ArrayList<Host>();
428422

@@ -453,7 +447,7 @@ protected List<? extends Host> prioritizeHosts(VMTemplateVO template, ServiceOff
453447
String hostGuestOSCategory = getHostGuestOSCategory(host);
454448
if (hostGuestOSCategory == null) {
455449
continue;
456-
} else if (templateGuestOSCategory.equals(hostGuestOSCategory)) {
450+
} else if (templateGuestOSCategory != null && templateGuestOSCategory.equals(hostGuestOSCategory)) {
457451
highPriorityHosts.add(host);
458452
} else {
459453
lowPriorityHosts.add(host);

0 commit comments

Comments
 (0)