You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2014/01/10 06:43:02 UTC

git commit: updated refs/heads/master to 929838c

Updated Branches:
  refs/heads/master 7ef78aac4 -> 929838c8e


Merge from 4.3: CLOUDSTACK-5662: XenServer can't discover iSCSI targets with different credentials


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

Branch: refs/heads/master
Commit: 929838c8eb10bd96f14edcfd1d9f4579631d8d7c
Parents: 7ef78aa
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Fri Jan 3 22:25:40 2014 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Jan 9 22:42:14 2014 -0700

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  | 27 ++++++++++++++++++++
 1 file changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/929838c8/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 6b13ccb..71c8e97 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -4034,6 +4034,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
         cmd.setCluster(_clusterId);
         cmd.setGatewayIpAddress(_localGateway);
         cmd.setHostVmStateReport(getHostVmStateReport());
+        cmd.setIqn(getIqn());
 
         StartupStorageCommand sscmd = null;
         try {
@@ -4059,6 +4060,32 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
         }
     }
 
+    private String getIqn() {
+        try {
+            final String textToFind = "InitiatorName=";
+
+            Script iScsiAdmCmd = new Script(true, "grep", 0, s_logger);
+
+            iScsiAdmCmd.add(textToFind);
+            iScsiAdmCmd.add("/etc/iscsi/initiatorname.iscsi");
+
+            OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
+
+            String result = iScsiAdmCmd.execute(parser);
+
+            if (result != null) {
+                return null;
+            }
+
+            String textFound = parser.getLine().trim();
+
+            return textFound.substring(textToFind.length());
+        }
+        catch (Exception ex) {
+            return null;
+        }
+    }
+
     protected HashMap<String, State> sync() {
         HashMap<String, State> newStates;
         HashMap<String, State> oldStates = null;