mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Merge from 4.3: CLOUDSTACK-5662: XenServer can't discover iSCSI targets with different credentials
This commit is contained in:
parent
7ef78aac40
commit
929838c8eb
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user