From b2e57549e9f4fd15d2aa831c7f89431524f5cc1c Mon Sep 17 00:00:00 2001
From: adrian-turjak <adriant@catalyst.net.nz>
Date: Tue, 31 Jan 2017 16:11:56 +1300
Subject: [PATCH] Collecting host info for instance

Currently the mapping to collect host info of instance is not correct,
and unfortunately, we can only get a hexdigest of project_id + host_name.
But we can get the correct host name by using the same algorithm when
doing billing.

Closes-Bug: #1665191

Change-Id: I0585c1e9a01250e6b34f3c1d060b76db34fcd6bf
---
 etc/conf.yaml                 | 10 +++++-----
 etc/meter_mappings.yml.sample |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/etc/conf.yaml b/etc/conf.yaml
index f42a6d4..b6b3724 100644
--- a/etc/conf.yaml
+++ b/etc/conf.yaml
@@ -2,9 +2,9 @@
 main:
   region: nz_wlg_2
   # timezone is unused at this time
-  timezone: Pacific/Auckland 
+  timezone: Pacific/Auckland
   database_uri: postgres://admin:password@localhost:5432/billing
-  trust_sources: 
+  trust_sources:
     - openstack
     - .{32}:TrafficAccounting
   log_file: logs/billing.log
@@ -41,7 +41,7 @@ collection:
       # which transformer to use
       transformer: InstanceUptime
       # what unit type is coming in via the meter
-      unit: second 
+      unit: second
       metadata:
         name:
           sources:
@@ -54,7 +54,7 @@ collection:
             - OS-EXT-AZ:availability_zone
         host:
           sources:
-            - instance_host
+            - host
     -
       meter: ip.floating
       service: n1.ipv4
@@ -164,7 +164,7 @@ collection:
 # transformer configs
 transformers:
   uptime:
-    # states marked as "billable" for VMs. 
+    # states marked as "billable" for VMs.
     tracked_states:
       - active
       - paused
diff --git a/etc/meter_mappings.yml.sample b/etc/meter_mappings.yml.sample
index 27dd131..0bd7f38 100644
--- a/etc/meter_mappings.yml.sample
+++ b/etc/meter_mappings.yml.sample
@@ -19,7 +19,7 @@
         - OS-EXT-AZ:availability_zone
     host:
       sources:
-        - instance_host
+        - host
 -
   meter: ip.floating
   service: n1.ipv4