diff --git a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java index 180063e6e5d..23c9425803b 100644 --- a/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/UpdateNetworkOfferingCmd.java @@ -41,6 +41,9 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id of the network offering") private Long id; + + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the network offering") + private String networkOfferingName; @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the network offering") private String displayText; @@ -52,7 +55,10 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - + public String getNetworkOfferingName() { + return networkOfferingName; + } + public String getDisplayText() { return displayText; } diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index ccb6389a4b7..af8985c08a4 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -97,4 +97,6 @@ public interface NetworkOffering { boolean isDhcpService(); GuestIpType getGuestType(); + + String getUniqueName(); } diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 82a1521418a..2a519d01083 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2771,6 +2771,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura public NetworkOffering updateNetworkOffering(UpdateNetworkOfferingCmd cmd) { String displayText = cmd.getDisplayText(); Long id = cmd.getId(); + String name = cmd.getNetworkOfferingName(); String availabilityStr = cmd.getAvailability(); Availability availability = null; @@ -2792,6 +2793,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura NetworkOfferingVO offering = _networkOfferingDao.createForUpdate(id); + if (name != null) { + offering.setName(name); + } + if (displayText != null) { offering.setDisplayText(displayText); } diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java index 8c84ce9592d..645cc1bd460 100644 --- a/server/src/com/cloud/offerings/NetworkOfferingVO.java +++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java @@ -45,6 +45,9 @@ public class NetworkOfferingVO implements NetworkOffering { @Column(name="name") String name; + @Column(name="unique_name") + private String uniqueName; + @Column(name="display_text") String displayText; @@ -304,6 +307,15 @@ public class NetworkOfferingVO implements NetworkOffering { public void setGuestType(GuestIpType guestType) { this.guestType = guestType; } + + @Override + public String getUniqueName() { + return uniqueName; + } + + public void setUniqueName(String uniqueName) { + this.uniqueName = uniqueName; + } public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, boolean isDefault, Availability availability, boolean dhcpService, boolean dnsService, boolean userDataService, boolean gatewayService, boolean firewallService, boolean lbService, boolean vpnService, GuestIpType guestIpType) { this.name = name; @@ -324,6 +336,7 @@ public class NetworkOfferingVO implements NetworkOffering { this.lbService = lbService; this.vpnService = vpnService; this.guestType = guestIpType; + this.uniqueName = name; } /** diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java index 2c42412db5b..c3f1a6eaeaf 100644 --- a/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java +++ b/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java @@ -19,10 +19,10 @@ import com.cloud.utils.db.GenericDao; public interface NetworkOfferingDao extends GenericDao { /** * Returns the network offering that matches the name. - * @param name name + * @param uniqueName name * @return NetworkOfferingVO */ - NetworkOfferingVO findByName(String name); + NetworkOfferingVO findByUniqueName(String uniqueName); /** * Persists the system network offering by checking the name. If it diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java index cabdd662247..12699a0b941 100644 --- a/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java +++ b/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java @@ -35,6 +35,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase sc = NameSearch.create(); - sc.setParameters("name", name); + sc.setParameters("uniqueName", uniqueName); return findOneBy(sc); @@ -65,8 +66,8 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase