diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java b/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java index 11d478a8a66..12deae0b97e 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java +++ b/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java @@ -305,10 +305,12 @@ public class LibvirtVMDef { return devicesBuilder.toString(); } + @SuppressWarnings("unchecked") public List getDisks() { return (List) devices.get(DiskDef.class.toString()); } + @SuppressWarnings("unchecked") public List getInterfaces() { return (List) devices.get(InterfaceDef.class .toString()); diff --git a/server/src/com/cloud/network/SshKeysDistriMonitor.java b/server/src/com/cloud/network/SshKeysDistriMonitor.java index 62f6631a985..25e0f2a78cb 100755 --- a/server/src/com/cloud/network/SshKeysDistriMonitor.java +++ b/server/src/com/cloud/network/SshKeysDistriMonitor.java @@ -76,9 +76,8 @@ public class SshKeysDistriMonitor implements Listener { ((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.XenServer) { /*TODO: Get the private/public keys here*/ - Map configs = _configDao.getConfiguration("management-server", new HashMap()); - String pubKey = configs.get("ssh.publickey"); - String prvKey = configs.get("ssh.privatekey"); + String pubKey = _configDao.getValue("ssh.publickey"); + String prvKey = _configDao.getValue("ssh.privatekey"); try { ModifySshKeysCommand cmds = new ModifySshKeysCommand(pubKey, prvKey); diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 1b7737f906f..81ca96e931c 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -577,14 +577,24 @@ public class ConfigurationServerImpl implements ConfigurationServer { // Grab the SSH key pair and insert it into the database, if it is not present String userid = System.getProperty("user.name"); - if (!userid.startsWith("cloud")) { + Boolean devel = Boolean.valueOf(_configDao.getValue("developer")); + if (!userid.startsWith("cloud") && !devel) { return; } String already = _configDao.getValue("ssh.privatekey"); - String homeDir = Script.runSimpleBashScript("echo ~cloud"); - if (homeDir == null) { - throw new CloudRuntimeException("Cannot get home directory for account: cloud"); + String homeDir = null; + if (devel) { + homeDir = Script.runSimpleBashScript("echo ~"); + if (homeDir == null) { + throw new CloudRuntimeException("Cannot get home directory for account: cloud"); + } + } else { + homeDir = Script.runSimpleBashScript("echo ~cloud"); + if (homeDir == null) { + throw new CloudRuntimeException("Cannot get home directory for account: cloud"); + } } + if (s_logger.isInfoEnabled()) { s_logger.info("Processing updateKeyPairs"); } @@ -660,7 +670,13 @@ public class ConfigurationServerImpl implements ConfigurationServer { } } s_logger.info("Going to update systemvm iso with generated keypairs if needed"); - injectSshKeysIntoSystemVmIsoPatch(pubkeyfile.getAbsolutePath(), privkeyfile.getAbsolutePath()); + try { + injectSshKeysIntoSystemVmIsoPatch(pubkeyfile.getAbsolutePath(), privkeyfile.getAbsolutePath()); + } catch (CloudRuntimeException e) { + if (!devel) { + throw new CloudRuntimeException(e.getMessage()); + } + } } private void writeKeyToDisk(String key, String keyPath) {