mirror of https://github.com/apache/cloudstack.git
cks: handle errors while scaling cluster (#8107)
This PR fixes the issue #7920
This commit is contained in:
parent
ce586e3eca
commit
3ce7c39bef
|
|
@ -767,12 +767,12 @@ public class KubernetesClusterResourceModifierActionWorker extends KubernetesClu
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KubernetesClusterVO updateKubernetesClusterEntry(final Long cores, final Long memory,
|
protected KubernetesClusterVO updateKubernetesClusterEntry(final Long cores, final Long memory, final Long size,
|
||||||
final Long size, final Long serviceOfferingId, final Boolean autoscaleEnabled, final Long minSize, final Long maxSize) {
|
final Long serviceOfferingId, final Boolean autoscaleEnabled, final Long minSize, final Long maxSize) {
|
||||||
return Transaction.execute(new TransactionCallback<KubernetesClusterVO>() {
|
return Transaction.execute(new TransactionCallback<KubernetesClusterVO>() {
|
||||||
@Override
|
@Override
|
||||||
public KubernetesClusterVO doInTransaction(TransactionStatus status) {
|
public KubernetesClusterVO doInTransaction(TransactionStatus status) {
|
||||||
KubernetesClusterVO updatedCluster = kubernetesClusterDao.createForUpdate(kubernetesCluster.getId());
|
KubernetesClusterVO updatedCluster = kubernetesClusterDao.findById(kubernetesCluster.getId());
|
||||||
if (cores != null) {
|
if (cores != null) {
|
||||||
updatedCluster.setCores(cores);
|
updatedCluster.setCores(cores);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Level;
|
import org.apache.log4j.Level;
|
||||||
|
|
||||||
import com.cloud.dc.DataCenter;
|
import com.cloud.dc.DataCenter;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
import com.cloud.exception.ManagementServerException;
|
import com.cloud.exception.ManagementServerException;
|
||||||
import com.cloud.exception.NetworkRuleConflictException;
|
import com.cloud.exception.NetworkRuleConflictException;
|
||||||
|
|
@ -299,8 +298,8 @@ public class KubernetesClusterScaleWorker extends KubernetesClusterResourceModif
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
try {
|
try {
|
||||||
result = userVmManager.upgradeVirtualMachine(userVM.getId(), serviceOffering.getId(), new HashMap<String, String>());
|
result = userVmManager.upgradeVirtualMachine(userVM.getId(), serviceOffering.getId(), new HashMap<String, String>());
|
||||||
} catch (ResourceUnavailableException | ManagementServerException | ConcurrentOperationException | VirtualMachineMigrationException e) {
|
} catch (RuntimeException | ResourceUnavailableException | ManagementServerException | VirtualMachineMigrationException e) {
|
||||||
logTransitStateAndThrow(Level.ERROR, String.format("Scaling Kubernetes cluster : %s failed, unable to scale cluster VM : %s", kubernetesCluster.getName(), userVM.getDisplayName()), kubernetesCluster.getId(), KubernetesCluster.Event.OperationFailed, e);
|
logTransitStateAndThrow(Level.ERROR, String.format("Scaling Kubernetes cluster : %s failed, unable to scale cluster VM : %s due to %s", kubernetesCluster.getName(), userVM.getDisplayName(), e.getMessage()), kubernetesCluster.getId(), KubernetesCluster.Event.OperationFailed, e);
|
||||||
}
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logTransitStateAndThrow(Level.WARN, String.format("Scaling Kubernetes cluster : %s failed, unable to scale cluster VM : %s", kubernetesCluster.getName(), userVM.getDisplayName()),kubernetesCluster.getId(), KubernetesCluster.Event.OperationFailed);
|
logTransitStateAndThrow(Level.WARN, String.format("Scaling Kubernetes cluster : %s failed, unable to scale cluster VM : %s", kubernetesCluster.getName(), userVM.getDisplayName()),kubernetesCluster.getId(), KubernetesCluster.Event.OperationFailed);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue