This is an automated email from the ASF dual-hosted git repository. nvazquez pushed a commit to branch pr/11981 in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit dff00b1e605e4d4e800cb63f5fe9d3331285409a Author: nvazquez <[email protected]> AuthorDate: Mon Nov 24 10:50:18 2025 -0300 Fix and refactor --- .../src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java index c6bfb7c3fe6..522e7d9526c 100755 --- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java @@ -935,11 +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)){ - if (callingUser.isRootAdmin()) { - throw new CloudRuntimeException("The Guest Network is unavailable: " + e.getMessage()).add(VirtualMachine.class, vmUuid); - } else { - throw new CloudRuntimeException("The Guest Network is unavailable. Please contact administrator. ").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); }
