IPv6: Rename public_ipv6_address to user_ipv6_address

This commit is contained in:
Sheng Yang 2013-01-30 16:02:07 -08:00
parent c5b2a65598
commit ed547d91f7
14 changed files with 74 additions and 74 deletions

View File

@ -271,7 +271,7 @@ under the License.
<dao name="Site2SiteCustomerGatewayDao" class="com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnGatewayDao" class="com.cloud.network.dao.Site2SiteVpnGatewayDaoImpl" singleton="false"/>
<dao name="Site2SiteVpnConnectionDao" class="com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl" singleton="false"/>
<dao name="PublicIpv6AddressDao" class="com.cloud.network.dao.PublicIpv6AddressDaoImpl" singleton="false"/>
<dao name="UserIpv6AddressDao" class="com.cloud.network.dao.UserIpv6AddressDaoImpl" singleton="false"/>
</configuration-server>
<awsapi-ec2server class="com.cloud.bridge.service.EC2MainServlet">

View File

@ -123,7 +123,7 @@ import com.cloud.network.dao.PhysicalNetworkDaoImpl;
import com.cloud.network.dao.PhysicalNetworkServiceProviderDaoImpl;
import com.cloud.network.dao.PhysicalNetworkTrafficTypeDaoImpl;
import com.cloud.network.dao.PortProfileDaoImpl;
import com.cloud.network.dao.PublicIpv6AddressDaoImpl;
import com.cloud.network.dao.UserIpv6AddressDaoImpl;
import com.cloud.network.dao.RemoteAccessVpnDaoImpl;
import com.cloud.network.dao.Site2SiteCustomerGatewayDaoImpl;
import com.cloud.network.dao.Site2SiteVpnConnectionDaoImpl;
@ -382,7 +382,7 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
addDao("Site2SiteVpnGatewayDao", Site2SiteVpnGatewayDaoImpl.class);
addDao("Site2SiteCustomerGatewayDao", Site2SiteCustomerGatewayDaoImpl.class);
addDao("Site2SiteVpnConnnectionDao", Site2SiteVpnConnectionDaoImpl.class);
addDao("PublicIpv6AddressDao", PublicIpv6AddressDaoImpl.class);
addDao("UserIpv6AddressDao", UserIpv6AddressDaoImpl.class);
addDao("UserVmJoinDao", UserVmJoinDaoImpl.class);
addDao("DomainRouterJoinDao", DomainRouterJoinDaoImpl.class);

View File

@ -22,7 +22,7 @@ import com.cloud.user.Account;
import com.cloud.utils.component.Manager;
public interface Ipv6AddressManager extends Manager {
public PublicIpv6Address assignDirectIp6Address(long dcId, Account owner, Long networkId, String requestedIp6) throws InsufficientAddressCapacityException;
public UserIpv6Address assignDirectIp6Address(long dcId, Account owner, Long networkId, String requestedIp6) throws InsufficientAddressCapacityException;
public void revokeDirectIpv6Address(long networkId, String ip6Address);
}

View File

@ -29,7 +29,7 @@ import com.cloud.dc.Vlan;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.VlanDao;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.network.dao.PublicIpv6AddressDao;
import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.user.Account;
import com.cloud.utils.component.Inject;
import com.cloud.utils.exception.CloudRuntimeException;
@ -48,7 +48,7 @@ public class Ipv6AddressManagerImpl implements Ipv6AddressManager {
@Inject
NetworkModel _networkModel;
@Inject
PublicIpv6AddressDao _ipv6Dao;
UserIpv6AddressDao _ipv6Dao;
@Override
public boolean configure(String name, Map<String, Object> params)
@ -73,7 +73,7 @@ public class Ipv6AddressManagerImpl implements Ipv6AddressManager {
}
@Override
public PublicIpv6Address assignDirectIp6Address(long dcId, Account owner, Long networkId, String requestedIp6)
public UserIpv6Address assignDirectIp6Address(long dcId, Account owner, Long networkId, String requestedIp6)
throws InsufficientAddressCapacityException {
Vlan vlan = _networkModel.getVlanForNetwork(networkId);
if (vlan == null) {
@ -112,10 +112,10 @@ public class Ipv6AddressManagerImpl implements Ipv6AddressManager {
_dcDao.update(dc.getId(), dc);
String macAddress = NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(mac));
PublicIpv6AddressVO ipVO = new PublicIpv6AddressVO(ip, dcId, macAddress, vlan.getId());
UserIpv6AddressVO ipVO = new UserIpv6AddressVO(ip, dcId, macAddress, vlan.getId());
ipVO.setPhysicalNetworkId(vlan.getPhysicalNetworkId());
ipVO.setSourceNetworkId(vlan.getNetworkId());
ipVO.setState(PublicIpv6Address.State.Allocated);
ipVO.setState(UserIpv6Address.State.Allocated);
ipVO.setDomainId(owner.getDomainId());
ipVO.setAccountId(owner.getAccountId());
_ipv6Dao.persist(ipVO);
@ -124,7 +124,7 @@ public class Ipv6AddressManagerImpl implements Ipv6AddressManager {
@Override
public void revokeDirectIpv6Address(long networkId, String ip6Address) {
PublicIpv6AddressVO ip = _ipv6Dao.findByNetworkIdAndIp(networkId, ip6Address);
UserIpv6AddressVO ip = _ipv6Dao.findByNetworkIdAndIp(networkId, ip6Address);
if (ip != null) {
_ipv6Dao.remove(ip.getId());
}

View File

@ -112,7 +112,7 @@ import com.cloud.network.dao.PhysicalNetworkDao;
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao;
import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO;
import com.cloud.network.dao.PublicIpv6AddressDao;
import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.network.element.DhcpServiceProvider;
import com.cloud.network.element.IpDeployer;
import com.cloud.network.element.LoadBalancingServiceProvider;
@ -275,7 +275,7 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
@Inject
NetworkModel _networkModel;
@Inject
PublicIpv6AddressDao _ipv6Dao;
UserIpv6AddressDao _ipv6Dao;
@Inject
Ipv6AddressManager _ipv6Mgr;
@ -3362,7 +3362,7 @@ public class NetworkManagerImpl implements NetworkManager, Manager, Listener {
if (network.getIp6Gateway() != null) {
if (nic.getIp6Address() == null) {
ipv6 = true;
PublicIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
UserIpv6Address ip = _ipv6Mgr.assignDirectIp6Address(dc.getId(), vm.getOwner(), network.getId(), requestedIpv6);
Vlan vlan = _networkModel.getVlanForNetwork(network.getId());
if (vlan == null) {
s_logger.debug("Cannot find related vlan or too many vlan attached to network " + network.getId());

View File

@ -66,7 +66,7 @@ import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao;
import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO;
import com.cloud.network.dao.PublicIpv6AddressDao;
import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.network.element.NetworkElement;
import com.cloud.network.element.UserDataServiceProvider;
import com.cloud.network.rules.FirewallRule.Purpose;
@ -160,7 +160,7 @@ public class NetworkModelImpl implements NetworkModel, Manager{
@Inject
PrivateIpDao _privateIpDao;
@Inject
PublicIpv6AddressDao _ipv6Dao;
UserIpv6AddressDao _ipv6Dao;
private final HashMap<String, NetworkOfferingVO> _systemNetworks = new HashMap<String, NetworkOfferingVO>(5);

View File

@ -24,7 +24,7 @@ import org.apache.cloudstack.api.InternalIdentity;
* @author Sheng Yang
*
*/
public interface PublicIpv6Address extends ControlledEntity, Identity, InternalIdentity {
public interface UserIpv6Address extends ControlledEntity, Identity, InternalIdentity {
enum State {
Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
Allocated, // The IP address is in used.
@ -46,7 +46,7 @@ public interface PublicIpv6Address extends ControlledEntity, Identity, InternalI
Long getPhysicalNetworkId();
void setState(PublicIpv6Address.State state);
void setState(UserIpv6Address.State state);
String getMacAddress();
}

View File

@ -32,8 +32,8 @@ import javax.persistence.Transient;
import com.cloud.utils.db.GenericDao;
@Entity
@Table(name=("public_ipv6_address"))
public class PublicIpv6AddressVO implements PublicIpv6Address {
@Table(name=("user_ipv6_address"))
public class UserIpv6AddressVO implements UserIpv6Address {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
@ -76,11 +76,11 @@ public class PublicIpv6AddressVO implements PublicIpv6Address {
@Column(name = GenericDao.CREATED_COLUMN)
Date created;
protected PublicIpv6AddressVO() {
protected UserIpv6AddressVO() {
this.uuid = UUID.randomUUID().toString();
}
public PublicIpv6AddressVO(String address, long dataCenterId, String macAddress, long vlanDbId) {
public UserIpv6AddressVO(String address, long dataCenterId, String macAddress, long vlanDbId) {
this.address = address;
this.dataCenterId = dataCenterId;
this.vlanId = vlanDbId;

View File

@ -1,23 +0,0 @@
package com.cloud.network.dao;
import java.util.List;
import com.cloud.network.Network;
import com.cloud.network.PublicIpv6AddressVO;
import com.cloud.utils.db.GenericDao;
public interface PublicIpv6AddressDao extends GenericDao<PublicIpv6AddressVO, Long> {
List<PublicIpv6AddressVO> listByAccount(long accountId);
List<PublicIpv6AddressVO> listByVlanId(long vlanId);
List<PublicIpv6AddressVO> listByDcId(long dcId);
List<PublicIpv6AddressVO> listByNetwork(long networkId);
public PublicIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress);
List<PublicIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId);
long countExistedIpsInNetwork(long networkId);
}

View File

@ -0,0 +1,23 @@
package com.cloud.network.dao;
import java.util.List;
import com.cloud.network.Network;
import com.cloud.network.UserIpv6AddressVO;
import com.cloud.utils.db.GenericDao;
public interface UserIpv6AddressDao extends GenericDao<UserIpv6AddressVO, Long> {
List<UserIpv6AddressVO> listByAccount(long accountId);
List<UserIpv6AddressVO> listByVlanId(long vlanId);
List<UserIpv6AddressVO> listByDcId(long dcId);
List<UserIpv6AddressVO> listByNetwork(long networkId);
public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress);
List<UserIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId);
long countExistedIpsInNetwork(long networkId);
}

View File

@ -9,7 +9,7 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.network.Network;
import com.cloud.network.PublicIpv6AddressVO;
import com.cloud.network.UserIpv6AddressVO;
import com.cloud.utils.Pair;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
@ -20,14 +20,14 @@ import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.SearchCriteria2;
@Local(value=PublicIpv6AddressDao.class)
public class PublicIpv6AddressDaoImpl extends GenericDaoBase<PublicIpv6AddressVO, Long> implements PublicIpv6AddressDao {
@Local(value=UserIpv6AddressDao.class)
public class UserIpv6AddressDaoImpl extends GenericDaoBase<UserIpv6AddressVO, Long> implements UserIpv6AddressDao {
private static final Logger s_logger = Logger.getLogger(IPAddressDaoImpl.class);
protected final SearchBuilder<PublicIpv6AddressVO> AllFieldsSearch;
protected GenericSearchBuilder<PublicIpv6AddressVO, Long> CountFreePublicIps;
protected final SearchBuilder<UserIpv6AddressVO> AllFieldsSearch;
protected GenericSearchBuilder<UserIpv6AddressVO, Long> CountFreePublicIps;
public PublicIpv6AddressDaoImpl() {
public UserIpv6AddressDaoImpl() {
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
AllFieldsSearch.and("dataCenterId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
@ -45,44 +45,44 @@ public class PublicIpv6AddressDaoImpl extends GenericDaoBase<PublicIpv6AddressVO
}
@Override
public List<PublicIpv6AddressVO> listByAccount(long accountId) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public List<UserIpv6AddressVO> listByAccount(long accountId) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("accountId", accountId);
return listBy(sc);
}
@Override
public List<PublicIpv6AddressVO> listByVlanId(long vlanId) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public List<UserIpv6AddressVO> listByVlanId(long vlanId) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("vlan", vlanId);
return listBy(sc);
}
@Override
public List<PublicIpv6AddressVO> listByDcId(long dcId) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public List<UserIpv6AddressVO> listByDcId(long dcId) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("dataCenterId", dcId);
return listBy(sc);
}
@Override
public List<PublicIpv6AddressVO> listByNetwork(long networkId) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public List<UserIpv6AddressVO> listByNetwork(long networkId) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("network", networkId);
return listBy(sc);
}
@Override
public PublicIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("networkId", networkId);
sc.setParameters("ipAddress", ipAddress);
return findOneBy(sc);
}
@Override
public List<PublicIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId) {
SearchCriteria<PublicIpv6AddressVO> sc = AllFieldsSearch.create();
public List<UserIpv6AddressVO> listByPhysicalNetworkId(long physicalNetworkId) {
SearchCriteria<UserIpv6AddressVO> sc = AllFieldsSearch.create();
sc.setParameters("physicalNetworkId", physicalNetworkId);
return listBy(sc);
}

View File

@ -43,9 +43,9 @@ import com.cloud.network.NetworkVO;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.PublicIpv6AddressVO;
import com.cloud.network.UserIpv6AddressVO;
import com.cloud.network.dao.IPAddressDao;
import com.cloud.network.dao.PublicIpv6AddressDao;
import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.offering.NetworkOffering;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.user.Account;
@ -76,7 +76,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
@Inject
NetworkOfferingDao _networkOfferingDao;
@Inject
PublicIpv6AddressDao _ipv6Dao;
UserIpv6AddressDao _ipv6Dao;
@Inject
Ipv6AddressManager _ipv6Mgr;

View File

@ -56,7 +56,7 @@ import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.PublicIpv6Address;
import com.cloud.network.UserIpv6Address;
import com.cloud.network.addr.PublicIp;
import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.element.LoadBalancingServiceProvider;

View File

@ -2550,7 +2550,7 @@ INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (2,
INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (3, UUID(), 'snmp','Linux CPU Idle - percentage', '1.3.6.1.4.1.2021.11.11.0', now());
INSERT INTO `cloud`.`counter` (id, uuid, source, name, value,created) VALUES (100, UUID(), 'netscaler','Response Time - microseconds', 'RESPTIME', now());
CREATE TABLE `cloud`.`public_ipv6_address` (
CREATE TABLE `cloud`.`user_ipv6_address` (
`id` bigint unsigned NOT NULL UNIQUE auto_increment,
`uuid` varchar(40),
`account_id` bigint unsigned NULL,
@ -2566,13 +2566,13 @@ CREATE TABLE `cloud`.`public_ipv6_address` (
`created` datetime NULL COMMENT 'Date this ip was allocated to someone',
PRIMARY KEY (`id`),
UNIQUE (`ip_address`, `source_network_id`),
CONSTRAINT `fk_public_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_public_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_public_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`),
CONSTRAINT `fk_public_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_public_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
CONSTRAINT `uc_public_ipv6_address__uuid` UNIQUE (`uuid`),
CONSTRAINT `fk_public_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
CONSTRAINT `fk_user_ipv6_address__source_network_id` FOREIGN KEY (`source_network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_user_ipv6_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`),
CONSTRAINT `fk_user_ipv6_address__account_id` FOREIGN KEY (`account_id`) REFERENCES `account`(`id`),
CONSTRAINT `fk_user_ipv6_address__vlan_id` FOREIGN KEY (`vlan_id`) REFERENCES `vlan`(`id`) ON DELETE CASCADE,
CONSTRAINT `fk_user_ipv6_address__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
CONSTRAINT `uc_user_ipv6_address__uuid` UNIQUE (`uuid`),
CONSTRAINT `fk_user_ipv6_address__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET foreign_key_checks = 1;