From 44a4158c4854d85e4c234655e375fe0c631507d5 Mon Sep 17 00:00:00 2001 From: Frank Zhang Date: Thu, 25 Sep 2014 10:35:33 -0700 Subject: [PATCH] CLOUDSTACK-6278 Baremetal Advanced Networking support --- .../BaremetalKickStartServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java index 3b88ca63f0c..16fc4600925 100755 --- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java @@ -160,15 +160,20 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple return Arrays.asList(ks, kernel, initrd); } - private File getSystemVMKeyFile() { + public File getSystemVMKeyFile() { URL url = this.getClass().getClassLoader().getResource("scripts/vm/systemvm/id_rsa.cloud"); File keyFile = null; if (url != null) { keyFile = new File(url.getPath()); } - if (keyFile == null || !keyFile.canRead()) { - s_logger.error("Unable to locate id_rsa.cloud"); - return null; + if (keyFile == null || !keyFile.exists()) { + keyFile = new File("/usr/share/cloudstack-common/scripts/vm/systemvm/id_rsa.cloud"); + } + if (!keyFile.exists()) { + throw new CloudRuntimeException(String.format("cannot find id_rsa.cloud")); + } + if (!keyFile.exists()) { + s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString()); } return keyFile; }