mirror of https://github.com/apache/cloudstack.git
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
(cherry picked from commit 3787579d29)
Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
This commit is contained in:
parent
9d6ba8e406
commit
26002ae69c
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue