Fixed CLOUDSTACK-6756: usage id is not being returned for an ip in deleted ip range

This commit is contained in:
Rajani Karuturi 2014-05-23 15:50:06 +05:30 committed by Kishan Kavala
parent 30bd9b8fe0
commit 2ab7bcade2
7 changed files with 67 additions and 2 deletions

View File

@ -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();

View File

@ -86,7 +86,10 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity,
Long getNetworkId();
@Override
boolean isDisplay();
public Date getRemoved();
public Date getCreated();
}

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
}

View File

@ -3171,7 +3171,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
@Override
public void doInTransactionWithoutResult(TransactionStatus status) {
_publicIpAddressDao.deletePublicIPRange(vlanDbId);
_vlanDao.expunge(vlanDbId);
_vlanDao.remove(vlanDbId);
}
});

View File

@ -1695,3 +1695,12 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'FreeBSD 10', 226, now(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Other PV', 139, now(), 0);
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'Other PV', 140, now(), 0);
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);