diff --git a/api/src/com/cloud/api/commands/CreateNetworkCmd.java b/api/src/com/cloud/api/commands/CreateNetworkCmd.java index 67842c99533..e83bc31878b 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkCmd.java @@ -136,7 +136,7 @@ public class CreateNetworkCmd extends BaseCmd { } public Boolean getIsShared() { - return isShared; + return false; } ///////////////////////////////////////////////////// diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 2a3681db9b4..b2c02dc0667 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -447,25 +447,39 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS public Host findHost(final Host.Type type, final DataCenterVO dc, final HostPodVO pod, final StoragePoolVO sp, final ServiceOfferingVO offering, final VMTemplateVO template, VMInstanceVO vm, Host currentHost, final Set avoid) { - VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, offering, null, null); - DeployDestination dest = null; - DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), sp.getClusterId(), null); - ExcludeList avoids = new ExcludeList(); - for (Host h : avoid) { - avoids.addHost(h.getId()); - } - - for (DeploymentPlanner planner : _planners) { - try { - dest = planner.plan(vmProfile, plan, avoids); - if (dest != null) { - return dest.getHost(); - } - } catch (InsufficientServerCapacityException e) { + if (!_useNewNetworking) { + VirtualMachineProfile vmc = new VirtualMachineProfileImpl(vm.getType()); + Enumeration en = _hostAllocators.enumeration(); + while (en.hasMoreElements()) { + final HostAllocator allocator = en.nextElement(); + final Host host = allocator.allocateTo(vmc, offering, type, dc, pod, sp.getClusterId(), template, avoid); + if (host == null) { + continue; + } else { + return host; + } + } + } else { + VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, offering, null, null); + DeployDestination dest = null; + DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), sp.getClusterId(), null); + ExcludeList avoids = new ExcludeList(); + for (Host h : avoid) { + avoids.addHost(h.getId()); + } - } + for (DeploymentPlanner planner : _planners) { + try { + dest = planner.plan(vmProfile, plan, avoids); + if (dest != null) { + return dest.getHost(); + } + } catch (InsufficientServerCapacityException e) { - } + } + + } + } s_logger.warn("findHost() could not find a non-null host."); return null;