From fba1c95512054529f0526cd6377747c780296e11 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Tue, 3 May 2011 16:34:11 -0700 Subject: [PATCH] bug 9615: Part of the HA cleanup --- server/src/com/cloud/agent/manager/Commands.java | 1 - server/src/com/cloud/deploy/FirstFitPlanner.java | 4 ++-- .../router/VirtualNetworkApplianceManagerImpl.java | 5 ++++- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 2 +- .../com/cloud/utils/component/ComponentLocator.java | 11 +++++++---- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/server/src/com/cloud/agent/manager/Commands.java b/server/src/com/cloud/agent/manager/Commands.java index 8c91a5099bb..32ab36edbe9 100644 --- a/server/src/com/cloud/agent/manager/Commands.java +++ b/server/src/com/cloud/agent/manager/Commands.java @@ -101,7 +101,6 @@ public class Commands implements Iterable { } public void setAnswers(Answer[] answers) { - assert answers.length == _cmds.size() : "We didn't get back the same number of answers as commands sent"; _answers = answers; } diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java index e37673d91f3..6ae99cfce4c 100644 --- a/server/src/com/cloud/deploy/FirstFitPlanner.java +++ b/server/src/com/cloud/deploy/FirstFitPlanner.java @@ -151,7 +151,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner { Pair> potentialResources = findPotentialDeploymentResources(suitableHosts, suitableVolumeStoragePools); if(potentialResources != null){ - Pod pod = _podDao.findById(vm.getPodId()); + Pod pod = _podDao.findById(host.getPodId()); Cluster cluster = _clusterDao.findById(host.getClusterId()); Map storageVolMap = potentialResources.second(); // remove the reused vol<->pool from destination, since we don't have to prepare this volume. @@ -192,7 +192,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner { Pair> potentialResources = findPotentialDeploymentResources(suitableHosts, suitableVolumeStoragePools); if(potentialResources != null){ - Pod pod = _podDao.findById(vm.getPodId()); + Pod pod = _podDao.findById(host.getPodId()); Cluster cluster = _clusterDao.findById(host.getClusterId()); Map storageVolMap = potentialResources.second(); // remove the reused vol<->pool from destination, since we don't have to prepare this volume. diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index c8fdfc48439..f66a6360623 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -1439,7 +1439,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian // Check if all networks are implemented for the domR; if not - implement them DataCenter dc = _dcDao.findById(router.getDataCenterId()); - HostPodVO pod = _podDao.findById(router.getPodId()); + HostPodVO pod = null; + if (router.getPodId() != null) { + pod = _podDao.findById(router.getPodId()); + } DeployDestination dest = new DeployDestination(dc, pod, null, null); ReservationContext context = new ReservationContextImpl(null, null, caller, owner); diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index a9a5a3e0ea7..1237415e103 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -648,7 +648,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene cmds.addCommand(new StartCommand(vmTO)); vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx); -// vm.setPodId(dest.getPod().getId()); + vm.setPodId(dest.getPod().getId()); work = _workDao.findById(work.getId()); if (work == null || work.getStep() != Step.Prepare) { diff --git a/utils/src/com/cloud/utils/component/ComponentLocator.java b/utils/src/com/cloud/utils/component/ComponentLocator.java index 0ca1ddc1b91..b34e8e107b9 100755 --- a/utils/src/com/cloud/utils/component/ComponentLocator.java +++ b/utils/src/com/cloud/utils/component/ComponentLocator.java @@ -736,10 +736,13 @@ public class ComponentLocator implements ComponentLocatorMBean { Map env = System.getenv(); String configFile = env.get("cloud-stack-components-specification"); if (configFile == null || PropertiesUtil.findConfigFile(configFile) == null) { - configFile = "components-premium.xml"; - if (PropertiesUtil.findConfigFile(configFile) == null){ - configFile = "components.xml"; - } + configFile = env.get("cloud_stack_components_specification"); + if (configFile == null || PropertiesUtil.findConfigFile(configFile) == null) { + configFile = "components-premium.xml"; + if (PropertiesUtil.findConfigFile(configFile) == null){ + configFile = "components.xml"; + } + } } return getLocatorInternal(server, true, configFile, "log4j-cloud"); }