cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/4.2-forward to cb9fc8b
Date Wed, 28 Aug 2013 21:00:37 GMT
Updated Branches:
  refs/heads/4.2-forward 02641f851 -> cb9fc8bec


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/cb9fc8be
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb9fc8be
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb9fc8be

Branch: refs/heads/4.2-forward
Commit: cb9fc8bece7e34c397a15a32ec1525bddd95b257
Parents: 02641f8
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Wed Aug 28 15:00:03 2013 -0600
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Wed Aug 28 15:00:03 2013 -0600

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb9fc8be/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 fd88c7e..7ff4918 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
@@ -4480,13 +4480,27 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         return false;
     }
 
+    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();
+    }
+
     public ManagedObjectReference handleDatastoreAndVmdkAttach(Command cmd, String iqn, String
storageHost, int storagePort,
                                                                String initiatorUsername,
String initiatorPassword, String targetUsername, String targetPassword) throws Exception {
         VmwareContext context = getServiceContext();
         VmwareHypervisorHost hyperHost = getHyperHost(context);
 
         ManagedObjectReference morDs = createVmfsDatastore(hyperHost, getDatastoreName(iqn),
-                                                           storageHost, storagePort, iqn,
+                                                           storageHost, storagePort, trimIqn(iqn),
                                                            initiatorUsername, initiatorPassword,
                                                            targetUsername, targetPassword);
 
@@ -4516,7 +4530,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