@@ -78,7 +78,7 @@ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
7878 String key = "" +IpId ;
7979
8080 // store the info in the IP map
81- IPMap .put (key , new IpInfo (usageIp .getZoneId (), IpId , usageIp .getAddress (), usageIp .isSourceNat ()));
81+ IPMap .put (key , new IpInfo (usageIp .getZoneId (), IpId , usageIp .getAddress (), usageIp .isSourceNat (), usageIp . isElastic () ));
8282
8383 Date IpAssignDate = usageIp .getAssigned ();
8484 Date IpReleaseDeleteDate = usageIp .getReleased ();
@@ -104,7 +104,7 @@ public static boolean parse(AccountVO account, Date startDate, Date endDate) {
104104 // Only create a usage record if we have a runningTime of bigger than zero.
105105 if (useTime > 0L ) {
106106 IpInfo info = IPMap .get (ipIdKey );
107- createUsageRecord (info .getZoneId (), useTime , startDate , endDate , account , info .getIpId (), info .getIPAddress (), info .isSourceNat ());
107+ createUsageRecord (info .getZoneId (), useTime , startDate , endDate , account , info .getIpId (), info .getIPAddress (), info .isSourceNat (), info . isElastic );
108108 }
109109 }
110110
@@ -123,7 +123,7 @@ private static void updateIpUsageData(Map<String, Pair<Long, Long>> usageDataMap
123123 usageDataMap .put (key , ipUsageInfo );
124124 }
125125
126- private static void createUsageRecord (long zoneId , long runningTime , Date startDate , Date endDate , AccountVO account , long IpId , String IPAddress , boolean isSourceNat ) {
126+ private static void createUsageRecord (long zoneId , long runningTime , Date startDate , Date endDate , AccountVO account , long IpId , String IPAddress , boolean isSourceNat , boolean isElastic ) {
127127 if (s_logger .isDebugEnabled ()) {
128128 s_logger .debug ("Total usage time " + runningTime + "ms" );
129129 }
@@ -141,8 +141,8 @@ private static void createUsageRecord(long zoneId, long runningTime, Date startD
141141
142142 // Create the usage record
143143
144- UsageVO usageRecord = new UsageVO (zoneId , account .getAccountId (), account .getDomainId (), usageDesc , usageDisplay + " Hrs" ,
145- UsageTypes . IP_ADDRESS , new Double ( usage ), null , null , null , null , IpId , startDate , endDate , (isSourceNat ?"SourceNat" :"" ));
144+ UsageVO usageRecord = new UsageVO (zoneId , account .getAccountId (), account .getDomainId (), usageDesc , usageDisplay + " Hrs" , UsageTypes . IP_ADDRESS , new Double ( usage ), IpId ,
145+ ( isElastic ? 1 : 0 ), (isSourceNat ?"SourceNat" :"" ), startDate , endDate );
146146 m_usageDao .persist (usageRecord );
147147 }
148148
@@ -151,12 +151,14 @@ private static class IpInfo {
151151 private long IpId ;
152152 private String IPAddress ;
153153 private boolean isSourceNat ;
154+ private boolean isElastic ;
154155
155- public IpInfo (long zoneId ,long IpId , String IPAddress , boolean isSourceNat ) {
156+ public IpInfo (long zoneId ,long IpId , String IPAddress , boolean isSourceNat , boolean isElastic ) {
156157 this .zoneId = zoneId ;
157158 this .IpId = IpId ;
158159 this .IPAddress = IPAddress ;
159160 this .isSourceNat = isSourceNat ;
161+ this .isElastic = isElastic ;
160162 }
161163
162164 public long getZoneId () {
@@ -174,6 +176,10 @@ public String getIPAddress() {
174176 public boolean isSourceNat () {
175177 return isSourceNat ;
176178 }
179+
180+ public boolean isElastic () {
181+ return isElastic ;
182+ }
177183 }
178184
179185}
0 commit comments