diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java
index ed88d9c7cd4..32d53d29359 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -117,17 +117,17 @@ public class Networks {
}
public static TrafficType getTrafficType(String type) {
- if (type.equals("Public")) {
+ if ("Public".equals(type)) {
return Public;
- } else if (type.endsWith("Guest")) {
+ } else if ("Guest".equals(type)) {
return Guest;
- } else if (type.endsWith("Storage")) {
+ } else if ("Storage".equals(type)) {
return Storage;
- } else if (type.endsWith("Management")) {
+ } else if ("Management".equals(type)) {
return Management;
- } else if (type.endsWith("Control")) {
+ } else if ("Control".equals(type)) {
return Control;
- } else if (type.endsWith("Vpn")) {
+ } else if ("Vpn".equals(type)) {
return Vpn;
} else {
return None;
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index 03cc7d45934..9ef7f6769d5 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -52,14 +52,33 @@
+
+
+
-
-
+
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 1df36afd815..97419d55e0b 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -235,8 +235,8 @@ public enum Config {
// XenServer
XenPublicNetwork("Network", ManagementServer.class, String.class, "xen.public.network.device", null, "[ONLY IF THE PUBLIC NETWORK IS ON A DEDICATED NIC]:The network name label of the physical device dedicated to the public network on a XenServer host", null),
- XenStorageNetwork1("Network", ManagementServer.class, String.class, "xen.storage.network.device1", "cloud-stor1", "Specify when there are storage networks", null),
- XenStorageNetwork2("Network", ManagementServer.class, String.class, "xen.storage.network.device2", "cloud-stor2", "Specify when there are storage networks", null),
+ XenStorageNetwork1("Network", ManagementServer.class, String.class, "xen.storage.network.device1", null, "Specify when there are storage networks", null),
+ XenStorageNetwork2("Network", ManagementServer.class, String.class, "xen.storage.network.device2", null, "Specify when there are storage networks", null),
XenPrivateNetwork("Network", ManagementServer.class, String.class, "xen.private.network.device", null, "Specify when the private network name is different", null),
NetworkGuestCidrLimit("Network", NetworkManager.class, Integer.class, "network.guest.cidr.limit", "22", "size limit for guest cidr; can't be less than this value", null),
XenSetupMultipath("Advanced", ManagementServer.class, String.class, "xen.setup.multipath", "false", "Setup the host to do multipath", null),
diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java
old mode 100644
new mode 100755
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 909857f8e60..9887452b798 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -5661,7 +5661,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
} else {
for (NetworkGuru guru : _networkGurus) {
- results.add(new Pair(TrafficType.getTrafficType(type), guru.getName()));
+ TrafficType[] allTypes = guru.getSupportedTrafficType();
+ for (TrafficType t : allTypes) {
+ results.add(new Pair(t, guru.getName()));
+ }
}
}
diff --git a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
index 490605466a1..6821c4b3416 100755
--- a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java
@@ -36,11 +36,11 @@ import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
import com.cloud.network.Network;
import com.cloud.network.NetworkProfile;
import com.cloud.network.NetworkVO;
+import com.cloud.network.StorageNetworkManager;
import com.cloud.network.Networks.AddressFormat;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
-import com.cloud.network.StorageNetworkManager;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
@@ -88,10 +88,10 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
}
if (type == TrafficType.Storage && _sNwMgr.isStorageIpRangeAvailable()) {
- s_logger.debug("There is some storage ip available, let StorageNetworkGuru to handle storage traffic type, not me");
+ s_logger.debug("There is an storage network ip range, let StorageNetworkGuru to handle TrafficType.Storage");
return null;
}
-
+
NetworkVO config = new NetworkVO(type, Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId());
return config;
}
diff --git a/server/src/com/cloud/network/guru/StorageNetworkGuru.java b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
index f6710ca6d90..9731ca0bb66 100755
--- a/server/src/com/cloud/network/guru/StorageNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/StorageNetworkGuru.java
@@ -32,7 +32,7 @@ import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.Nic.ReservationStrategy;
@Local(value = NetworkGuru.class)
-public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
+public class StorageNetworkGuru extends PodBasedNetworkGuru implements NetworkGuru {
private static final Logger s_logger = Logger.getLogger(StorageNetworkGuru.class);
@Inject StorageNetworkManager _sNwMgr;
@@ -59,12 +59,7 @@ public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
protected boolean canHandle(NetworkOffering offering) {
if (isMyTrafficType(offering.getTrafficType()) && offering.isSystemOnly()) {
- if (_sNwMgr.isStorageIpRangeAvailable()) {
- return true;
- } else {
- s_logger.debug("No storage network ip range availabe, let PodBasedNetworkGuru to handle storage traffic type, not me");
- return false;
- }
+ return true;
} else {
s_logger.trace("It's not storage network offering, skip it.");
return false;
@@ -77,6 +72,10 @@ public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
return null;
}
+ if (!_sNwMgr.isStorageIpRangeAvailable()) {
+ return super.design(offering, plan, userSpecified, owner);
+ }
+
NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup,
plan.getDataCenterId(), plan.getPhysicalNetworkId());
return config;
@@ -86,13 +85,20 @@ public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException {
assert network.getTrafficType() == TrafficType.Storage : "Why are you sending this configuration to me " + network;
+ if (!_sNwMgr.isStorageIpRangeAvailable()) {
+ return super.implement(network, offering, destination, context);
+ }
return network;
}
@Override
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm)
- throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
+ throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
assert network.getTrafficType() == TrafficType.Storage : "Well, I can't take care of this config now can I? " + network;
+ if (!_sNwMgr.isStorageIpRangeAvailable()) {
+ return super.allocate(network, nic, vm);
+ }
+
return new NicProfile(ReservationStrategy.Start, null, null, null, null);
}
@@ -110,7 +116,12 @@ public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public void reserve(NicProfile nic, Network network, VirtualMachineProfile extends VirtualMachine> vm, DeployDestination dest, ReservationContext context)
- throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
+ throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException {
+ if (!_sNwMgr.isStorageIpRangeAvailable()) {
+ super.reserve(nic, network, vm, dest, context);
+ return;
+ }
+
Pod pod = dest.getPod();
Integer vlan = null;
@@ -136,6 +147,10 @@ public class StorageNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public boolean release(NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm, String reservationId) {
+ if (!_sNwMgr.isStorageIpRangeAvailable()) {
+ return super.release(nic, vm, reservationId);
+ }
+
_sNwMgr.releaseIpAddress(nic.getIp4Address());
s_logger.debug("Release an storage ip " + nic.getIp4Address());
nic.deallocate();