Skip to content

Commit f4cf4f9

Browse files
committed
another minor refactor
1 parent 0428948 commit f4cf4f9

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.Arrays;
2222
import java.util.Date;
2323
import java.util.HashMap;
24-
import java.util.HashSet;
2524
import java.util.Iterator;
2625
import java.util.LinkedHashMap;
2726
import java.util.List;
@@ -252,7 +251,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
252251

253252
protected Gson jsonParser = new GsonBuilder().setVersion(1.3).create();
254253

255-
protected Set<State> availableVmStateOnAssignProxy = new HashSet<>(Arrays.asList(State.Starting, State.Running, State.Stopping, State.Migrating, State.BackingUp, State.BackupError));
254+
protected Set<State> availableVmStateOnAssignProxy = Set.of(State.Starting, State.Running, State.Stopping, State.Migrating, State.BackingUp, State.BackupError);
256255

257256
@Inject
258257
private KeystoreDao _ksDao;
@@ -353,9 +352,7 @@ public ConsoleProxyVO doAssignProxy(long dataCenterId, VMInstanceVO vm) {
353352
ConsoleProxyVO proxy = null;
354353

355354
if (!availableVmStateOnAssignProxy.contains(vm.getState())) {
356-
if (logger.isInfoEnabled()) {
357-
logger.info(String.format("Detected that %s is not currently in \"Starting\", \"Running\", \"Stopping\" or \"Migrating\" state, it will fail the proxy assignment.", vm.toString()));
358-
}
355+
logger.info("Detected that {} is not currently in any of the following states: {}. Therefore, it is not possible to assign a console to the VM.", vm, availableVmStateOnAssignProxy);
359356
return null;
360357
}
361358

0 commit comments

Comments
 (0)