Github user anshul1886 commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/669#discussion_r36611905
--- Diff: server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java ---
@@ -1425,19 +1423,39 @@ public boolean finalizeCommandsOnStart(Commands
cmds, VirtualMachineProfile prof
CheckSshCommand check = new
CheckSshCommand(profile.getInstanceName(), controlNic.getIp4Address(), 3922);
cmds.addCommand("checkSsh", check);
+ try {
+ File uiFiles = new File("systemvm/js");
+ if (!uiFiles.exists()) {
+ uiFiles = new
File("/usr/share/cloudstack-common/systemvm/js");
+ }
+ if (uiFiles.exists() && uiFiles.isDirectory()) {
+ CopyFileInVmCommand copyFile = new
CopyFileInVmCommand(uiFiles.getCanonicalPath(), "/usr/local/cloud/systemvm/js",
controlNic.getIp4Address());
+ cmds.addCommand("copyFile", copyFile);
+ } else {
+ s_logger.error("Couldn't locate localization files for
console proxy");
+ return false;
+ }
+ } catch (IOException e) {
+ s_logger.error("Failed to copy localization files for console
proxy: " + e.getMessage());
+ }
+
return true;
}
@Override
public boolean finalizeStart(VirtualMachineProfile profile, long
hostId, Commands cmds, ReservationContext context) {
- CheckSshAnswer answer = (CheckSshAnswer)cmds.getAnswer("checkSsh");
- if (answer == null || !answer.getResult()) {
- if (answer != null) {
- s_logger.warn("Unable to ssh to the VM: " +
answer.getDetails());
- } else {
- s_logger.warn("Unable to ssh to the VM: null answer");
+ for(Answer answer : cmds.getAnswers()) {
+ if(answer == null || !answer.getResult()) {
+ if (answer != null) {
+ s_logger.warn("Unable to ssh to the VM: " +
answer.getDetails());
+ } else {
+ s_logger.warn("Unable to ssh to the VM: null answer");
+ }
+ if(cmds.getAnswer("copyFile") == answer) {
+ continue;
+ }
+ return false;
--- End diff --
Its returning false if the command is failed or has not returned answer and
that is failure case. In case of copyFile we are ignoring the answer and
continuing. So if block is making sense for that.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---