use of org.ovirt.engine.core.common.businessentities.VDSType in project ovirt-engine by oVirt.
the class UpgradeHostInternalCommand method executeCommand.
@Override
protected void executeCommand() {
getCompensationContext().snapshotEntityStatus(getVds().getDynamicData(), getParameters().getInitialStatus());
getCompensationContext().stateChanged();
VDSType vdsType = getVds().getVdsType();
if (vdsType == VDSType.VDS || vdsType == VDSType.oVirtNode) {
try {
setVdsStatus(VDSStatus.Installing);
upgradeManager.update(getVds());
if (vdsType == VDSType.oVirtNode || getParameters().isReboot()) {
VdsActionParameters params = new VdsActionParameters(getVds().getId());
params.setPrevVdsStatus(getParameters().getInitialStatus());
ActionReturnValue returnValue = runInternalAction(ActionType.SshHostReboot, params, ExecutionHandler.createInternalJobContext());
if (!returnValue.getSucceeded()) {
setVdsStatus(VDSStatus.InstallFailed);
log.error("Engine failed to restart via ssh host '{}' ('{}') after upgrade", getVds().getName(), getVds().getId());
return;
}
} else {
// letting the host a chance to recover from restarting the VDSM service after the upgrade
if (!new HostConnectivityChecker().check(getVds())) {
log.warn("Engine failed to communicate with VDSM agent on host '{}' with address '{}' ('{}') " + "after upgrade", getVds().getName(), getVds().getHostName(), getVds().getId());
}
}
} catch (Exception e) {
setVdsStatus(VDSStatus.InstallFailed);
return;
}
} else if (getVds().isOvirtVintageNode()) {
InstallVdsParameters parameters = new InstallVdsParameters(getVdsId());
parameters.setIsReinstallOrUpgrade(true);
parameters.setoVirtIsoFile(getParameters().getoVirtIsoFile());
parameters.setActivateHost(getParameters().getInitialStatus() == VDSStatus.Up);
ActionReturnValue result = runInternalAction(ActionType.UpgradeOvirtNodeInternal, parameters);
if (!result.getSucceeded()) {
setVdsStatus(VDSStatus.InstallFailed);
propagateFailure(result);
return;
}
}
try {
updateHostStatusAfterSuccessfulUpgrade();
setSucceeded(true);
} catch (Exception e) {
log.error("Failed to set new status for host '{}' after upgrade has ended.", getVdsName());
log.error("Exception", e);
setVdsStatus(VDSStatus.InstallFailed);
}
}
Aggregations