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

VAGs
This commit is contained in:
Mike Tutkowski 2014-01-03 22:25:40 -07:00
parent 29aa7c272c
commit 811b0856d5
1 changed files with 27 additions and 0 deletions

View File

@ -4073,6 +4073,7 @@ ServerResource {
cmd.setCluster(_clusterId);
cmd.setGatewayIpAddress(_localGateway);
cmd.setHostVmStateReport(getHostVmStateReport());
cmd.setIqn(getIqn());
StartupStorageCommand sscmd = null;
try {
@ -4102,6 +4103,32 @@ ServerResource {
}
}
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;