Greg Padgett has uploaded a new change for review.

Change subject: lib, agent, client: change host_id key to int
......................................................................

lib, agent, client: change host_id key to int

get_stats_from_storage() previously returned a dict with the host_id as
a string.  With all valid host_id values being integers, it makes the
api cleaner to return an integer.

Change-Id: I56b204080391cf09b2606316d9195bf12905034f
Bug-Url: https://bugzilla.redhat.com/1015724
Signed-off-by: Greg Padgett <gpadg...@redhat.com>
---
M ovirt_hosted_engine_ha/agent/hosted_engine.py
M ovirt_hosted_engine_ha/client/client.py
M ovirt_hosted_engine_ha/lib/brokerlink.py
3 files changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-ha 
refs/changes/27/20127/1

diff --git a/ovirt_hosted_engine_ha/agent/hosted_engine.py 
b/ovirt_hosted_engine_ha/agent/hosted_engine.py
index f148c7e..26c3ae3 100644
--- a/ovirt_hosted_engine_ha/agent/hosted_engine.py
+++ b/ovirt_hosted_engine_ha/agent/hosted_engine.py
@@ -559,9 +559,9 @@
             self._metadata_dir,
             constants.SERVICE_TYPE)
         local_ts = time.time()
-        for host_str, data in all_stats.iteritems():
+        for host_id, data in all_stats.iteritems():
             try:
-                md = metadata.parse_metadata_to_dict(host_str, data)
+                md = metadata.parse_metadata_to_dict(host_id, data)
             except ex.MetadataError as e:
                 self._log.error(
                     str(e),
diff --git a/ovirt_hosted_engine_ha/client/client.py 
b/ovirt_hosted_engine_ha/client/client.py
index e9b703b..86e35eb 100644
--- a/ovirt_hosted_engine_ha/client/client.py
+++ b/ovirt_hosted_engine_ha/client/client.py
@@ -54,14 +54,14 @@
                 constants.SERVICE_TYPE)
 
         output = {}
-        for host_str, data in stats.iteritems():
+        for host_id, data in stats.iteritems():
             try:
-                md = metadata.parse_metadata_to_dict(host_str, data)
+                md = metadata.parse_metadata_to_dict(host_id, data)
             except MetadataError as e:
                 self._log.error(str(e))
                 continue
             else:
-                output[md['host-id']] = md
+                output[host_id] = md
         return output
 
     def get_all_host_stats_direct(self, dom_path, service_type):
@@ -76,12 +76,12 @@
         stats = sb.get_raw_stats_for_service_type(path, service_type)
 
         output = {}
-        for host_str, data in stats.iteritems():
+        for host_id, data in stats.iteritems():
             try:
-                md = metadata.parse_metadata_to_dict(host_str, data)
+                md = metadata.parse_metadata_to_dict(host_id, data)
             except MetadataError as e:
                 self._log.error(str(e))
                 continue
             else:
-                output[md['host-id']] = md
+                output[host_id] = md
         return output
diff --git a/ovirt_hosted_engine_ha/lib/brokerlink.py 
b/ovirt_hosted_engine_ha/lib/brokerlink.py
index f8b9cea..3d23e6c 100644
--- a/ovirt_hosted_engine_ha/lib/brokerlink.py
+++ b/ovirt_hosted_engine_ha/lib/brokerlink.py
@@ -127,7 +127,7 @@
         # broker returns "<host_id 1>=<hex data 1> [<host_id 2>=...]"
         while tokens:
             (host_id, data) = tokens.pop(0).split('=', 1)
-            ret[host_id] = base64.b16decode(data)
+            ret[int(host_id)] = base64.b16decode(data)
         return ret
 
     def _checked_communicate(self, request):


-- 
To view, visit http://gerrit.ovirt.org/20127
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56b204080391cf09b2606316d9195bf12905034f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-ha
Gerrit-Branch: master
Gerrit-Owner: Greg Padgett <gpadg...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to