mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 8603: Included netwrok_id in network usage records
status 8603: resolved fixed
This commit is contained in:
parent
57f6b16cdb
commit
f138552f36
@ -46,7 +46,11 @@ public class UserStatisticsVO {
|
||||
private Long deviceId;
|
||||
|
||||
@Column(name="device_type")
|
||||
private String deviceType;
|
||||
private String deviceType;
|
||||
|
||||
@Column(name="network_id")
|
||||
private Long networkId;
|
||||
|
||||
|
||||
@Column(name="net_bytes_received")
|
||||
private long netBytesReceived;
|
||||
@ -63,12 +67,13 @@ public class UserStatisticsVO {
|
||||
protected UserStatisticsVO() {
|
||||
}
|
||||
|
||||
public UserStatisticsVO(long accountId, long dcId, String publicIpAddress, Long deviceId, String deviceType) {
|
||||
public UserStatisticsVO(long accountId, long dcId, String publicIpAddress, Long deviceId, String deviceType, Long networkId) {
|
||||
this.accountId = accountId;
|
||||
this.dataCenterId = dcId;
|
||||
this.publicIpAddress = publicIpAddress;
|
||||
this.deviceId = deviceId;
|
||||
this.deviceType = deviceType;
|
||||
this.deviceType = deviceType;
|
||||
this.networkId = networkId;
|
||||
this.netBytesReceived = 0;
|
||||
this.netBytesSent = 0;
|
||||
this.currentBytesReceived = 0;
|
||||
@ -94,7 +99,15 @@ public class UserStatisticsVO {
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
public long getCurrentBytesReceived() {
|
||||
return currentBytesReceived;
|
||||
}
|
||||
@ -126,8 +139,5 @@ public class UserStatisticsVO {
|
||||
public void setNetBytesSent(long netBytesSent) {
|
||||
this.netBytesSent = netBytesSent;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Creating user statistics for the account: " + owner.getId() + " Router Id: "+router.getId());
|
||||
}
|
||||
stats = new UserStatisticsVO(owner.getId(), dcId, null, router.getId(), router.getType().toString());
|
||||
stats = new UserStatisticsVO(owner.getId(), dcId, null, router.getId(), router.getType().toString(), guestNetwork.getId());
|
||||
_userStatsDao.persist(stats);
|
||||
}
|
||||
return router;
|
||||
@ -829,7 +829,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Creating user statistics for the account: " + owner.getId() + " Router Id: "+router.getId());
|
||||
}
|
||||
stats = new UserStatisticsVO(owner.getId(), dcId, null, router.getId(), router.getType().toString());
|
||||
stats = new UserStatisticsVO(owner.getId(), dcId, null, router.getId(), router.getType().toString(), guestNetwork.getId());
|
||||
_userStatsDao.persist(stats);
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ import com.cloud.utils.db.Transaction;
|
||||
@Local(value={UserStatisticsDao.class})
|
||||
public class UserStatisticsDaoImpl extends GenericDaoBase<UserStatisticsVO, Long> implements UserStatisticsDao {
|
||||
private static final Logger s_logger = Logger.getLogger(UserStatisticsDaoImpl.class);
|
||||
private static final String ACTIVE_AND_RECENTLY_DELETED_SEARCH = "SELECT us.id, us.data_center_id, us.account_id, us.public_ip_address, us.device_id, us.device_type, us.net_bytes_received, us.net_bytes_sent, us.current_bytes_received, us.current_bytes_sent " +
|
||||
private static final String ACTIVE_AND_RECENTLY_DELETED_SEARCH = "SELECT us.id, us.data_center_id, us.account_id, us.public_ip_address, us.device_id, us.device_type, us.network_id, us.net_bytes_received, us.net_bytes_sent, us.current_bytes_received, us.current_bytes_sent " +
|
||||
"FROM user_statistics us, account a " +
|
||||
"WHERE us.account_id = a.id AND (a.removed IS NULL OR a.removed >= ?) " +
|
||||
"ORDER BY us.id";
|
||||
|
||||
@ -738,6 +738,7 @@ CREATE TABLE `cloud`.`user_statistics` (
|
||||
`public_ip_address` varchar(15),
|
||||
`device_id` bigint unsigned NOT NULL,
|
||||
`device_type` varchar(32) NOT NULL,
|
||||
`network_id` bigint unsigned,
|
||||
`net_bytes_received` bigint unsigned NOT NULL default '0',
|
||||
`net_bytes_sent` bigint unsigned NOT NULL default '0',
|
||||
`current_bytes_received` bigint unsigned NOT NULL default '0',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user