Skip to content

Commit a7b77f3

Browse files
author
frank
committed
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
1 parent 6ec623d commit a7b77f3

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
124124
private String _storageIp;
125125
private String _storageNetmask;
126126
private String _storageGateway;
127+
private List<String> nfsIps = new ArrayList<String>();
127128
final private String _parent = "/mnt/SecStorage";
128129
final private String _tmpltDir = "/var/cloudstack/template";
129130
final private String _tmpltpp = "template.properties";
@@ -611,6 +612,7 @@ private Answer execute(SecStorageSetupCommand cmd) {
611612

612613
configCerts(cmd.getCerts());
613614

615+
nfsIps.add(nfsHostIp);
614616
return new SecStorageSetupAnswer(dir);
615617
} catch (Exception e) {
616618
String msg = "GetRootDir for " + secUrl + " failed due to " + e.toString();
@@ -730,6 +732,13 @@ private Answer execute(SecStorageVMSetupCommand cmd) {
730732
boolean success = true;
731733
StringBuilder result = new StringBuilder();
732734
for (String cidr: cmd.getAllowedInternalSites()) {
735+
if (nfsIps.contains(cidr)) {
736+
/*
737+
* if the internal download ip is the same with secondary storage ip, adding internal sites will flush
738+
* ip route to nfs through storage ip.
739+
*/
740+
continue;
741+
}
733742
String tmpresult = allowOutgoingOnPrivate(cidr);
734743
if (tmpresult != null) {
735744
result.append(", ").append(tmpresult);
@@ -814,10 +823,7 @@ public String allowOutgoingOnPrivate(String destCidr) {
814823
return "Error in allowing outgoing to " + destCidr + ", err=" + result;
815824
}
816825

817-
if (_storageIp == null) {
818-
/* only set route when no storage network present */
819-
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr);
820-
}
826+
addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr);
821827

822828
return null;
823829
}

0 commit comments

Comments
 (0)