Change exception when orchestrating VM start (#9062)

* Remove info about the environment from exception when starting VM

* Change to log4j2 syntax

---------

Co-authored-by: Lucas Martins <lucas.martins@scclouds.com.br>
This commit is contained in:
Lucas Martins 2024-07-24 09:18:25 -03:00 committed by GitHub
parent d41dc17b2c
commit dc1556ca38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -95,6 +95,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
import org.apache.cloudstack.vm.UnmanagedVMsManager;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@ -5451,9 +5452,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
try {
orchestrateStart(vm.getUuid(), work.getParams(), work.getPlan(), _dpMgr.getDeploymentPlannerByName(work.getDeploymentPlanner()));
} catch (CloudRuntimeException e){
String message = String.format("Unable to orchestrate start %s due to [%s].", vm.toString(), e.getMessage());
logger.warn(message, e);
CloudRuntimeException ex = new CloudRuntimeException(message);
logger.error("Unable to orchestrate start {} due to [{}].", vm, e.getMessage());
CloudRuntimeException ex = new CloudRuntimeException(String.format("Unable to orchestrate the start of VM instance %s.",
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(vm, "instanceName", "uuid")));
return new Pair<>(JobInfo.Status.FAILED, JobSerializerHelper.toObjectSerializedString(ex));
}
return new Pair<>(JobInfo.Status.SUCCEEDED, null);