Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public void execute() {
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());
}
}

Expand Down Expand Up @@ -556,7 +556,7 @@ public void create() throws ResourceAllocationException {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil

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());
Expand Down Expand Up @@ -1036,15 +1036,16 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil
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();
}
if (vmGuru.finalizeStart(vmProfile, destHostId, cmds, ctx)) {
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
Expand Down Expand Up @@ -1080,18 +1081,18 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil
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()));
if (startAnswer != null && startAnswer.getContextParam("stopRetry") != null) {
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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a error instead of debug?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi wido,
most of these kind of logs in cloudstack are at debug level, as in it lets us debug why a vm deployment has failed. In this case the error will be vm deployment failed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but we have to many loglines which are debug and which should be error. Right now you have to run CloudStack on DEBUG to get any interesting information out of the logs. The VM deployment failed and that's an error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvbharatk Can you please change it to 'error' so we can conclude the review and merge?

if (e.isActive()) {
_haMgr.scheduleStop(vm, destHostId, WorkType.CheckStop);
}
Expand Down
15 changes: 6 additions & 9 deletions server/src/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ public UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, Service
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()));
Expand Down Expand Up @@ -3082,18 +3082,14 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
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");
}
}

Expand Down Expand Up @@ -3488,7 +3484,8 @@ protected UserVm startVirtualMachine(DeployVMCmd cmd, Map<VirtualMachineProfile.
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);
Expand Down Expand Up @@ -3699,7 +3696,7 @@ public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOpe

// 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);
Expand Down