Repository: cloudstack Updated Branches: refs/heads/4.3-forward 6db3cb261 -> 3787579d2
BUG-ID: CS-19152 [upgrade] Baremetal 4.2.0 -> 4.3. After upgrade, destroy baremetal instance fail BUG-ID: CS-19150 [upgrade] Baremetal 4.2.0 -> 4.3. After upgrade, unable to start baremetal instance BUG-ID: CS-19149 [upgrade] Baremetal 4.2.0 -> 4.3. After upgrade, baremetal host remain in Disconnected state. But instance associated with baremetal host is running. BUG-ID: CS-19151 [upgrade] Baremetal 4.2.0 -> 4.3. After upgrade, unable to reboot baremetal instance BUG-ID: CS-19156 [upgrade] Baremetal 4.2.0 -> 4.3. After upgrade, unable to stop baremetal instance reviewed-by: edison Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3787579d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3787579d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3787579d Branch: refs/heads/4.3-forward Commit: 3787579d2910f4882c4b2763d610293fcbc03e61 Parents: 6db3cb2 Author: Frank.Zhang <frank.zh...@citrix.com> Authored: Thu Feb 20 14:23:41 2014 -0800 Committer: Frank.Zhang <frank.zh...@citrix.com> Committed: Thu Feb 20 14:23:41 2014 -0800 ---------------------------------------------------------------------- .../baremetal/manager/BareMetalDiscoverer.java | 4 ++++ .../networkservice/BareMetalResourceBase.java | 10 ++++---- .../networkservice/BaremetalPxeManagerImpl.java | 4 ++-- .../deploy/DeploymentPlanningManagerImpl.java | 24 ++++++++++++++++---- 4 files changed, 30 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3787579d/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java index 23eecd1..1120688 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java @@ -170,6 +170,8 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R params.put(ApiConstants.PRIVATE_IP, ipmiIp); params.put(ApiConstants.USERNAME, username); params.put(ApiConstants.PASSWORD, password); + params.put("vmDao", _vmDao); + params.put("configDao", _configDao); String resourceClassName = _configDao.getValue(Config.ExternalBaremetalResourceClassName.key()); BareMetalResourceBase resource = null; @@ -284,6 +286,8 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R HashMap<String, Object> params = super.buildConfigParams(host); params.put("hostId", host.getId()); params.put("ipaddress", host.getPrivateIpAddress()); + params.put("vmDao", _vmDao); + params.put("configDao", _configDao); return params; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3787579d/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java index 9dcfa13..4fe40a2 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java @@ -34,7 +34,6 @@ import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; import com.cloud.utils.Pair; -import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.OutputInterpreter; @@ -86,9 +85,10 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource protected Script2 _forcePowerOffCommand; protected Script2 _bootOrRebootCommand; protected String _vmName; - protected VMInstanceDao vmDao; protected int ipmiRetryTimes = 5; + protected ConfigurationDao configDao; + protected VMInstanceDao vmDao; private void changeVmState(String vmName, VirtualMachine.State state) { synchronized (_vms) { @@ -126,6 +126,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource _password = (String) params.get(ApiConstants.PASSWORD); _vmName = (String) params.get("vmName"); String echoScAgent = (String) params.get(BaremetalManager.EchoSecurityGroupAgent); + vmDao = (VMInstanceDao) params.get("vmDao"); + configDao = (ConfigurationDao) params.get("configDao"); if (_pod == null) { throw new ConfigurationException("Unable to get the pod"); @@ -156,7 +158,6 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource _isEchoScAgent = Boolean.valueOf(echoScAgent); } - ConfigurationDao configDao = ComponentContext.getComponent(ConfigurationDao.class); String ipmiIface = "default"; try { ipmiIface = configDao.getValue(Config.BaremetalIpmiLanInterface.key()); @@ -330,7 +331,6 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource protected Map<String, State> fullSync() { Map<String, State> states = new HashMap<String, State>(); if (hostId != null) { - vmDao = ComponentContext.getComponent(VMInstanceDao.class); final List<? extends VMInstanceVO> vms = vmDao.listByHostId(hostId); for (VMInstanceVO vm : vms) { states.put(vm.getInstanceName(), vm.getState()); @@ -349,7 +349,6 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource protected Map<String, HostVmStateReportEntry> getHostVmStateReport() { Map<String, HostVmStateReportEntry> states = new HashMap<String, HostVmStateReportEntry>(); if (hostId != null) { - vmDao = ComponentContext.getComponent(VMInstanceDao.class); final List<? extends VMInstanceVO> vms = vmDao.listByHostId(hostId); for (VMInstanceVO vm : vms) { states.put( @@ -412,7 +411,6 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource } if (hostId != null) { - vmDao = ComponentContext.getComponent(VMInstanceDao.class); final List<? extends VMInstanceVO> vms = vmDao.listByHostId(hostId); if (vms.isEmpty()) { return new PingRoutingCommand(getType(), id, deltaSync(), getHostVmStateReport()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3787579d/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java index 9618e6b..e82eece 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java @@ -184,9 +184,9 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe @Override public boolean addUserData(NicProfile nic, VirtualMachineProfile profile) { - UserVmVO vm = (UserVmVO) profile.getVirtualMachine(); + UserVmVO vm = _vmDao.findById(profile.getVirtualMachine().getId()); _vmDao.loadDetails(vm); - + String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); String zoneName = _dcDao.findById(vm.getDataCenterId()).getName(); NicVO nvo = _nicDao.findById(nic.getId()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3787579d/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java index 0a25805..d9e1ecc 100644 --- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java +++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java @@ -299,6 +299,15 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId()); } + Pod pod = _podDao.findById(host.getPodId()); + Cluster cluster = _clusterDao.findById(host.getClusterId()); + + if (vm.getHypervisorType() == HypervisorType.BareMetal) { + DeployDestination dest = new DeployDestination(dc, pod, cluster, host, new HashMap<Volume, StoragePool>()); + s_logger.debug("Returning Deployment Destination: " + dest); + return dest; + } + // search for storage under the zone, pod, cluster of the host. DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), hostIdSpecified, plan.getPoolId(), null, plan.getReservationContext()); @@ -315,8 +324,6 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources( suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids), readyAndReusedVolumes); if (potentialResources != null) { - Pod pod = _podDao.findById(host.getPodId()); - Cluster cluster = _clusterDao.findById(host.getClusterId()); Map<Volume, StoragePool> storageVolMap = potentialResources.second(); // remove the reused vol<->pool from destination, since // we don't have to prepare this volume. @@ -362,6 +369,17 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy + ", pod: " + host.getPodId() + ", cluster: " + host.getClusterId()); // search for storage under the zone, pod, cluster of // the last host. + + + Pod pod = _podDao.findById(host.getPodId()); + Cluster cluster = _clusterDao.findById(host.getClusterId()); + + if (vm.getHypervisorType() == HypervisorType.BareMetal) { + DeployDestination dest = new DeployDestination(dc, pod, cluster, host, new HashMap<Volume, StoragePool>()); + s_logger.debug("Returning Deployment Destination: " + dest); + return dest; + } + DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), host.getId(), plan.getPoolId(), null); Pair<Map<Volume, List<StoragePool>>, List<Volume>> result = findSuitablePoolsForVolumes( @@ -376,8 +394,6 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources( suitableHosts, suitableVolumeStoragePools, avoids, getPlannerUsage(planner,vmProfile, plan ,avoids), readyAndReusedVolumes); if (potentialResources != null) { - Pod pod = _podDao.findById(host.getPodId()); - Cluster cluster = _clusterDao.findById(host.getClusterId()); Map<Volume, StoragePool> storageVolMap = potentialResources.second(); // remove the reused vol<->pool from // destination, since we don't have to prepare