cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [12/50] [abbrv] git commit: refs/heads/ui-multiple-nics - CLOUDSTACK-1262: update default built-in systemvm.iso search patch to be consistent with RPM location
Date Tue, 05 Mar 2013 18:37:40 GMT
CLOUDSTACK-1262: update default built-in systemvm.iso search patch to be consistent with RPM
location


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/cec4d8b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/cec4d8b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/cec4d8b5

Branch: refs/heads/ui-multiple-nics
Commit: cec4d8b59c33858c99a4ead29b66d9aff5f0af6f
Parents: 6317f0b
Author: Kelven Yang <kelveny@gmail.com>
Authored: Fri Mar 1 17:16:31 2013 -0800
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Fri Mar 1 17:47:01 2013 -0800

----------------------------------------------------------------------
 .../vmware/manager/VmwareManagerImpl.java          |   42 +++++++++------
 1 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/cec4d8b5/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 2cf1248..60b5ce4 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -528,29 +528,37 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager,
Vmw
 
     private File getSystemVMPatchIsoFile() {
         // locate systemvm.iso
-        URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
-        File file = new File(url.getFile());
-        File isoFile = new File(file.getParent() + "/vms/systemvm.iso");
-        if (!isoFile.exists()) {
-            isoFile = new File("/usr/lib64/cloud/common/" + "/vms/systemvm.iso");
-            if (!isoFile.exists()) {
-                isoFile = new File("/usr/lib/cloud/common/" + "/vms/systemvm.iso");
-            }
+        URL url = this.getClass().getClassLoader().getResource("vms/systemvm.iso");
+        File isoFile = null;
+        if (url != null) {
+            isoFile = new File(url.getPath());
+        }
+        
+        if(isoFile == null || !isoFile.exists()) {
+            isoFile = new File("/usr/share/cloudstack-common/vms/systemvm.iso");
+        }
+        
+        assert(isoFile != null);
+        if(!isoFile.exists()) {
+        	s_logger.error("Unable to locate systemvm.iso in your setup at " + isoFile.toString());
         }
         return isoFile;
     }
 
     @Override
     public File getSystemVMKeyFile() {
-        URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
-        File file = new File(url.getFile());
-
-        File keyFile = new File(file.getParent(), "/scripts/vm/systemvm/id_rsa.cloud");
-        if (!keyFile.exists()) {
-            keyFile = new File("/usr/lib64/cloud/common" + "/scripts/vm/systemvm/id_rsa.cloud");
-            if (!keyFile.exists()) {
-                keyFile = new File("/usr/lib/cloud/common" + "/scripts/vm/systemvm/id_rsa.cloud");
-            }
+        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.exists()) {
+            keyFile = new File("/usr/share/cloudstack-common/scripts/vm/systemvm/id_rsa.cloud");
+        }
+        assert(keyFile != null);
+        if(!keyFile.exists()) {
+        	s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString());
         }
         return keyFile;
     }


Mime
View raw message