remove wrong storage network ip checking when setting internal ip route in NFS secondary

storage resource.

The bug prevent vmware setting static route to vcenter
This commit is contained in:
frank 2012-09-07 11:03:01 -07:00
parent 6ec623d2d5
commit a7b77f3316

View File

@ -124,6 +124,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
private String _storageIp; private String _storageIp;
private String _storageNetmask; private String _storageNetmask;
private String _storageGateway; private String _storageGateway;
private List<String> nfsIps = new ArrayList<String>();
final private String _parent = "/mnt/SecStorage"; final private String _parent = "/mnt/SecStorage";
final private String _tmpltDir = "/var/cloudstack/template"; final private String _tmpltDir = "/var/cloudstack/template";
final private String _tmpltpp = "template.properties"; final private String _tmpltpp = "template.properties";
@ -611,6 +612,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
configCerts(cmd.getCerts()); configCerts(cmd.getCerts());
nfsIps.add(nfsHostIp);
return new SecStorageSetupAnswer(dir); return new SecStorageSetupAnswer(dir);
} catch (Exception e) { } catch (Exception e) {
String msg = "GetRootDir for " + secUrl + " failed due to " + e.toString(); String msg = "GetRootDir for " + secUrl + " failed due to " + e.toString();
@ -730,6 +732,13 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
boolean success = true; boolean success = true;
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
for (String cidr: cmd.getAllowedInternalSites()) { for (String cidr: cmd.getAllowedInternalSites()) {
if (nfsIps.contains(cidr)) {
/*
* if the internal download ip is the same with secondary storage ip, adding internal sites will flush
* ip route to nfs through storage ip.
*/
continue;
}
String tmpresult = allowOutgoingOnPrivate(cidr); String tmpresult = allowOutgoingOnPrivate(cidr);
if (tmpresult != null) { if (tmpresult != null) {
result.append(", ").append(tmpresult); result.append(", ").append(tmpresult);
@ -814,10 +823,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
return "Error in allowing outgoing to " + destCidr + ", err=" + result; return "Error in allowing outgoing to " + destCidr + ", err=" + result;
} }
if (_storageIp == null) { addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr);
/* only set route when no storage network present */
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr);
}
return null; return null;
} }