weizhouapache commented on code in PR #6919:
URL: https://github.com/apache/cloudstack/pull/6919#discussion_r1044416772
##########
server/src/main/java/org/apache/cloudstack/consoleproxy/ConsoleAccessManagerImpl.java:
##########
@@ -207,15 +205,22 @@ private ConsoleEndpoint generateAccessEndpoint(Long vmId,
String sessionUuid, St
throw new CloudRuntimeException(msg);
}
+ String vmUuid = vm.getUuid();
+ if (unsupportedConsoleVMState.contains(vm.getState())) {
+ msg = "VM " + vmUuid + " must be running to connect console,
sending blank response for console access request";
+ s_logger.warn(msg);
+ throw new CloudRuntimeException(msg);
+ }
+
if (vm.getHostId() == null) {
- msg = "VM " + vmId + " lost host info, sending blank response for
console access request";
+ msg = "VM " + vmUuid + " lost host info, sending blank response
for console access request";
s_logger.warn(msg);
throw new CloudRuntimeException(msg);
}
HostVO host = managementServer.getHostBy(vm.getHostId());
if (host == null) {
- msg = "VM " + vmId + "'s host does not exist, sending blank
response for console access request";
+ msg = "VM " + vmUuid + "'s host does not exist, sending blank
response for console access request";
Review Comment:
if the vm state is Migrating, use vm.getLastHostId instead of vm.getHostId
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]