mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge pull request #864 from bvbharatk/CLOUDSTACK-8860
CLOUDSTACK-8860: improve error messages in VM deployment code path.improved the error messages in vm deployment code path. added some more data to the error messages and also fixed some errors using internal ids to use uuids. * pr/864: CLOUDSTACK-8860: improve error messages in VM deployment code path. Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
commit
bca6076f15
@ -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;
|
||||
|
||||
@ -983,7 +983,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());
|
||||
@ -1034,7 +1034,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();
|
||||
}
|
||||
@ -1042,7 +1042,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
|
||||
@ -1078,9 +1079,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()));
|
||||
@ -1088,8 +1089,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);
|
||||
}
|
||||
|
||||
@ -2831,7 +2831,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()));
|
||||
@ -3221,18 +3221,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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3645,7 +3641,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);
|
||||
@ -3856,7 +3853,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