mirror of https://github.com/apache/cloudstack.git
Improve message "Network is unavailable. Please contact administrator" (#11981)
* Improve message "Network is unavailable. Please contact administrator" This trivial change provide more details for root administrators during troubleshooting. See discussion https://github.com/apache/cloudstack/discussions/11980 * Improve error message for unavailable guest network * Update engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com> * Fix and refactor --------- Co-authored-by: dahn <daan.hoogland@gmail.com> Co-authored-by: nvazquez <nicovazquez90@gmail.com>
This commit is contained in:
parent
69c69dc537
commit
ded975ceb8
|
|
@ -935,7 +935,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid);
|
||||
} catch (final ResourceUnavailableException e) {
|
||||
if (e.getScope() != null && e.getScope().equals(VirtualRouter.class)){
|
||||
throw new CloudRuntimeException("Network is unavailable. Please contact administrator", e).add(VirtualMachine.class, vmUuid);
|
||||
Account callingAccount = CallContext.current().getCallingAccount();
|
||||
String errorSuffix = (callingAccount != null && callingAccount.getType() == Account.Type.ADMIN) ?
|
||||
String.format("Failure: %s", e.getMessage()) :
|
||||
"Please contact administrator.";
|
||||
throw new CloudRuntimeException(String.format("The Network for VM %s is unavailable. %s", vmUuid, errorSuffix), e).add(VirtualMachine.class, vmUuid);
|
||||
}
|
||||
throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue