mirror of https://github.com/apache/cloudstack.git
Fixed CLOUDSTACK-6756: usage id is not being returned for an ip in deleted ip range
(cherry picked from commit a6ed48fc9c5f68b46f0d2e05adefc7263c4cd0d0) Conflicts: setup/db/db/schema-430to440.sql
This commit is contained in:
parent
d0f806b3a4
commit
ce6a53e37b
|
|
@ -20,6 +20,8 @@ import org.apache.cloudstack.acl.InfrastructureEntity;
|
|||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
|
||||
public enum VlanType {
|
||||
DirectAttached, VirtualNetwork
|
||||
|
|
@ -41,6 +43,10 @@ public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
|
|||
|
||||
public Long getNetworkId();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
public Date getCreated();
|
||||
|
||||
public Long getPhysicalNetworkId();
|
||||
|
||||
public String getIp6Gateway();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,10 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
|
|||
|
||||
Long getNetworkId();
|
||||
|
||||
@Override
|
||||
boolean isDisplay();
|
||||
|
||||
public Date getRemoved();
|
||||
|
||||
public Date getCreated();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,16 @@ public class PublicIp implements PublicIpAddress {
|
|||
return _addr.isDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getRemoved() {
|
||||
return _addr.getRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreated() {
|
||||
return _addr.getCreated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getEntityType() {
|
||||
return IpAddress.class;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.dc;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
|
@ -73,6 +76,13 @@ public class VlanVO implements Vlan {
|
|||
@Column(name = "uuid")
|
||||
String uuid;
|
||||
|
||||
@Column(name= GenericDao.REMOVED_COLUMN)
|
||||
private Date removed;
|
||||
|
||||
@Column(name = GenericDao.CREATED_COLUMN)
|
||||
private Date created;
|
||||
|
||||
|
||||
public VlanVO(VlanType vlanType, String vlanTag, String vlanGateway, String vlanNetmask, long dataCenterId, String ipRange, Long networkId, Long physicalNetworkId,
|
||||
String ip6Gateway, String ip6Cidr, String ip6Range) {
|
||||
this.vlanType = vlanType;
|
||||
|
|
@ -150,6 +160,16 @@ public class VlanVO implements Vlan {
|
|||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getPhysicalNetworkId() {
|
||||
return physicalNetworkId;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import javax.persistence.TemporalType;
|
|||
import javax.persistence.Transient;
|
||||
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.net.Ip;
|
||||
|
||||
/**
|
||||
|
|
@ -117,6 +118,12 @@ public class IPAddressVO implements IpAddress {
|
|||
@Column(name = "display", updatable = true, nullable = false)
|
||||
protected boolean display = true;
|
||||
|
||||
@Column(name= GenericDao.REMOVED_COLUMN)
|
||||
private Date removed;
|
||||
|
||||
@Column(name = GenericDao.CREATED_COLUMN)
|
||||
private Date created;
|
||||
|
||||
protected IPAddressVO() {
|
||||
uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
|
@ -351,4 +358,14 @@ public class IPAddressVO implements IpAddress {
|
|||
public Class<?> getEntityType() {
|
||||
return IpAddress.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3183,7 +3183,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Override
|
||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||
_publicIpAddressDao.deletePublicIPRange(vlanDbId);
|
||||
_vlanDao.expunge(vlanDbId);
|
||||
_vlanDao.remove(vlanDbId);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1676,3 +1676,12 @@ CREATE TABLE `cloud`.`network_acl_item_cidrs` (
|
|||
ALTER TABLE `cloud`.`load_balancer_healthcheck_policies` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the policy can be displayed to the end user';
|
||||
ALTER TABLE `cloud`.`load_balancer_stickiness_policies` ADD COLUMN `display` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if the policy can be displayed to the end user';
|
||||
|
||||
|
||||
alter table user_ip_address add column removed datetime DEFAULT NULL COMMENT 'date removed';
|
||||
alter table user_ip_address add column created datetime NULL COMMENT 'date created';
|
||||
|
||||
alter table vlan add column removed datetime DEFAULT NULL COMMENT 'date removed';
|
||||
alter table vlan add column created datetime NULL COMMENT 'date created';
|
||||
|
||||
alter table user_ip_address drop key public_ip_address;
|
||||
alter table user_ip_address add UNIQUE KEY public_ip_address (public_ip_address,source_network_id, removed);
|
||||
Loading…
Reference in New Issue