Fixed deployVR - used to fail in case when system.vm.default.hypervisor was set to not NULL value
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/57f75514 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/57f75514 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/57f75514 Branch: refs/heads/junit-tests Commit: 57f75514e6e2b94da02f165760183236549e3091 Parents: 4bcd46e Author: Alena Prokharchyk <[email protected]> Authored: Wed Oct 10 12:36:55 2012 -0700 Committer: Chip Childers <[email protected]> Committed: Mon Oct 15 16:19:13 2012 -0400 ---------------------------------------------------------------------- .../router/VirtualNetworkApplianceManagerImpl.java | 19 +++++++++----- 1 files changed, 12 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/57f75514/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 943c85f..4400a9b 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1436,6 +1436,9 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian } finally { startRetry++; } + } else { + //return stopped router + return router; } } @@ -1446,11 +1449,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian protected List<HypervisorType> getHypervisors(DeployDestination dest, DeploymentPlan plan, List<HypervisorType> supportedHypervisors) throws InsufficientServerCapacityException { List<HypervisorType> hypervisors = new ArrayList<HypervisorType>(); - HypervisorType defaults = _resourceMgr.getDefaultHypervisor(dest.getDataCenter().getId()); - if (defaults != HypervisorType.None) { - hypervisors.add(defaults); - } - + if (dest.getCluster() != null) { if (dest.getCluster().getHypervisorType() == HypervisorType.Ovm) { hypervisors.add(getClusterToStartDomainRouterForOvm(dest.getCluster().getPodId())); @@ -1458,8 +1457,14 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian hypervisors.add(dest.getCluster().getHypervisorType()); } } else { - hypervisors = _resourceMgr.getSupportedHypervisorTypes(dest.getDataCenter().getId(), true, - plan.getPodId()); + HypervisorType defaults = _resourceMgr.getDefaultHypervisor(dest.getDataCenter().getId()); + if (defaults != HypervisorType.None) { + hypervisors.add(defaults); + } else { + //if there is no default hypervisor, get it from the cluster + hypervisors = _resourceMgr.getSupportedHypervisorTypes(dest.getDataCenter().getId(), true, + plan.getPodId()); + } } //keep only elements defined in supported hypervisors
