mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
CLOUDSTACK-8860: improve error messages in VM deployment code path.
Conflicts: engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
This commit is contained in:
parent
d543e2aa2c
commit
1718bb38aa
@ -474,7 +474,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm uuid:"+getEntityUuid());
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,7 +556,7 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
|
||||
VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);
|
||||
// Make sure a valid template ID was specified
|
||||
if (template == null) {
|
||||
throw new InvalidParameterValueException("Unable to use template " + templateId);
|
||||
throw new InvalidParameterValueException("Unable to find the template " + templateId);
|
||||
}
|
||||
|
||||
DiskOffering diskOffering = null;
|
||||
|
||||
@ -985,7 +985,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
|
||||
try {
|
||||
if (!changeState(vm, Event.OperationRetry, destHostId, work, Step.Prepare)) {
|
||||
throw new ConcurrentOperationException("Unable to update the state of the Virtual Machine");
|
||||
throw new ConcurrentOperationException("Unable to update the state of the Virtual Machine "+vm.getUuid()+" oldstate: "+vm.getState()+ "Event :"+Event.OperationRetry);
|
||||
}
|
||||
} catch (final NoTransitionException e1) {
|
||||
throw new ConcurrentOperationException(e1.getMessage());
|
||||
@ -1036,7 +1036,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
if (host_guid != null) {
|
||||
final HostVO finalHost = _resourceMgr.findHostByGuid(host_guid);
|
||||
if (finalHost == null) {
|
||||
throw new CloudRuntimeException("Host Guid " + host_guid + " doesn't exist in DB, something wrong here");
|
||||
throw new CloudRuntimeException("Host Guid " + host_guid + " doesn't exist in DB, something went wrong while processing start answer: "+startAnswer);
|
||||
}
|
||||
destHostId = finalHost.getId();
|
||||
}
|
||||
@ -1044,7 +1044,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
syncDiskChainChange(startAnswer);
|
||||
|
||||
if (!changeState(vm, Event.OperationSucceeded, destHostId, work, Step.Done)) {
|
||||
throw new ConcurrentOperationException("Unable to transition to a new state.");
|
||||
s_logger.error("Unable to transition to a new state. VM uuid: "+vm.getUuid()+ "VM oldstate:"+vm.getState()+"Event:"+Event.OperationSucceeded);
|
||||
throw new ConcurrentOperationException("Failed to deploy VM"+ vm.getUuid());
|
||||
}
|
||||
|
||||
// Update GPU device capacity
|
||||
@ -1080,9 +1081,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.warn("Unable to stop " + vm + " due to " + (answer != null ? answer.getDetails() : "no answers"));
|
||||
_haMgr.scheduleStop(vm, destHostId, WorkType.ForceStop);
|
||||
throw new ExecutionException("Unable to stop " + vm + " so we are unable to retry the start operation");
|
||||
throw new ExecutionException("Unable to stop this VM, "+vm.getUuid()+" so we are unable to retry the start operation");
|
||||
}
|
||||
throw new ExecutionException("Unable to start " + vm + " due to error in finalizeStart, not retrying");
|
||||
throw new ExecutionException("Unable to start VM:"+vm.getUuid()+" due to error in finalizeStart, not retrying");
|
||||
}
|
||||
}
|
||||
s_logger.info("Unable to start VM on " + dest.getHost() + " due to " + (startAnswer == null ? " no start answer" : startAnswer.getDetails()));
|
||||
@ -1090,8 +1091,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (final OperationTimedoutException e) {
|
||||
s_logger.debug("Unable to send the start command to host " + dest.getHost());
|
||||
} catch (OperationTimedoutException e) {
|
||||
s_logger.debug("Unable to send the start command to host " + dest.getHost()+" failed to start VM: "+vm.getUuid());
|
||||
if (e.isActive()) {
|
||||
_haMgr.scheduleStop(vm, destHostId, WorkType.CheckStop);
|
||||
}
|
||||
|
||||
@ -2692,7 +2692,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
if (networkIdList == null || networkIdList.isEmpty()) {
|
||||
Network networkWithSecurityGroup = _networkModel.getNetworkWithSGWithFreeIPs(zone.getId());
|
||||
if (networkWithSecurityGroup == null) {
|
||||
throw new InvalidParameterValueException("No network with security enabled is found in zone id=" + zone.getId());
|
||||
throw new InvalidParameterValueException("No network with security enabled is found in zone id=" + zone.getUuid());
|
||||
}
|
||||
|
||||
networkList.add(_networkDao.findById(networkWithSecurityGroup.getId()));
|
||||
@ -3082,18 +3082,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
Long physicalNetworkId = _networkModel.findPhysicalNetworkId(zone.getId(), ntwkOffering.getTags(),
|
||||
ntwkOffering.getTrafficType());
|
||||
if (physicalNetworkId == null) {
|
||||
s_logger.warn("Network id " + network.getId() + " could not be streched to the zone " + zone.getId()
|
||||
+ " as valid phyical network could not be found");
|
||||
throw new InvalidParameterValueException("Network in which is VM getting deployed could not be" +
|
||||
" streched to the zone.");
|
||||
" streched to the zone, as we could not find a valid physical network");
|
||||
}
|
||||
|
||||
String provider = _ntwkSrvcDao.getProviderForServiceInNetwork(network.getId(), Service.Connectivity);
|
||||
if (!_networkModel.isProviderEnabledInPhysicalNetwork(physicalNetworkId, provider)) {
|
||||
s_logger.warn("Network id " + network.getId() + " could not be streched to the zone " +zone.getId()
|
||||
+ " as Connectivity service provider is not enabled in the zone " + zone.getId());
|
||||
throw new InvalidParameterValueException("Network in which is VM getting deployed could not be" +
|
||||
" streched to the zone.");
|
||||
" streched to the zone, as we could not find a valid physical network");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3488,7 +3484,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
UserVmVO tmpVm = _vmDao.findById(vm.getId());
|
||||
if (!tmpVm.getState().equals(State.Running)) {
|
||||
// Some other thread changed state of VM, possibly vmsync
|
||||
throw new ConcurrentOperationException("VM " + tmpVm + " unexpectedly went to " + tmpVm.getState() + " state");
|
||||
s_logger.error("VM " + tmpVm + " unexpectedly went to " + tmpVm.getState() + " state");
|
||||
throw new ConcurrentOperationException("Failed to deploy VM "+vm);
|
||||
}
|
||||
} finally {
|
||||
updateVmStateForFailedVmCreation(vm.getId(), hostId);
|
||||
@ -3699,7 +3696,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
||||
|
||||
// if account is removed, return error
|
||||
if (caller != null && caller.getRemoved() != null) {
|
||||
throw new PermissionDeniedException("The account " + caller.getId() + " is removed");
|
||||
throw new PermissionDeniedException("The account " + caller.getUuid() + " is removed");
|
||||
}
|
||||
|
||||
UserVmVO vm = _vmDao.findById(vmId);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user