cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From du...@apache.org
Subject [10/50] [abbrv] git commit: updated refs/heads/ldapplugin to bdba0dd
Date Fri, 30 Aug 2013 23:28:03 GMT
Trim IQN so that the format /iqn/lun becomes iqn.

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

Branch: refs/heads/ldapplugin
Commit: de531c0c0a6ced719b64146a1d805a47cbe0ccb9
Parents: 81193ff
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Wed Aug 28 15:08:45 2013 -0600
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Wed Aug 28 15:08:45 2013 -0600

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java         | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de531c0c/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 64dfd20..1723ef3 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -4160,6 +4160,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         return str.replace('/', '-');
     }
 
+    private String trimIqn(String iqn) {
+        String[] tmp = iqn.split("/");
+
+        if (tmp.length != 3) {
+            String msg = "Wrong format for iScsi path: " + iqn + ". It should be formatted
as '/targetIQN/LUN'.";
+
+            s_logger.warn(msg);
+
+            throw new CloudRuntimeException(msg);
+        }
+
+        return tmp[1].trim();
+    }
+
     @Override
     public ManagedObjectReference handleDatastoreAndVmdkAttach(Command cmd, String iqn, String
storageHost, int storagePort,
             String initiatorUsername, String initiatorPassword, String targetUsername, String
targetPassword) throws Exception {
@@ -4167,9 +4181,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         VmwareHypervisorHost hyperHost = getHyperHost(context);
 
         ManagedObjectReference morDs = createVmfsDatastore(hyperHost, getDatastoreName(iqn),
-                storageHost, storagePort, iqn,
-                initiatorUsername, initiatorPassword,
-                targetUsername, targetPassword);
+                                                           storageHost, storagePort, trimIqn(iqn),
+                                                           initiatorUsername, initiatorPassword,
+                                                           targetUsername, targetPassword);
 
         DatastoreMO dsMo = new DatastoreMO(context, morDs);
 
@@ -4198,7 +4212,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         VmwareContext context = getServiceContext();
         VmwareHypervisorHost hyperHost = getHyperHost(context);
 
-        deleteVmfsDatastore(hyperHost, getDatastoreName(iqn), storageHost, storagePort, iqn);
+        deleteVmfsDatastore(hyperHost, getDatastoreName(iqn), storageHost, storagePort, trimIqn(iqn));
     }
 
     protected Answer execute(AttachVolumeCommand cmd) {


Mime
View raw message