Change in vdsm[master]: domain_descriptor: Eliminate magic hash init value

nsoffer at redhat.com nsoffer at redhat.com
Wed Oct 29 22:11:55 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: domain_descriptor: Eliminate magic hash init value
......................................................................

domain_descriptor: Eliminate magic hash init value

We used to initialize devices hash to 0 when there are no devices. There
is no need for using this magic value. Hashing an empty string does not
require additional comments and is more general.

The magic "0" hash value was exposed in the past in the stats xml, and
could be used for detecting a fresh domain without any devices, but this
value is not exposed any more since we introduced the guest agent disk
mapping hash.

Change-Id: I36767eafbef3dbebef5a1d04417f18e0cc4898c2
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/virt/domain_descriptor.py
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/34622/1

diff --git a/vdsm/virt/domain_descriptor.py b/vdsm/virt/domain_descriptor.py
index baca905..3e567ab 100644
--- a/vdsm/virt/domain_descriptor.py
+++ b/vdsm/virt/domain_descriptor.py
@@ -26,9 +26,8 @@
         self._xml = xmlStr
         self._dom = xml.dom.minidom.parseString(xmlStr)
         self._devices = self._firstElementByTagName('devices')
-        # VDSM by default reports '0' as hash when it has no device list yet
-        self._devicesHash = (hash(self._devices.toxml()) if self._devices
-                             else 0)
+        self._devicesHash = hash(self._devices.toxml()
+                                 if self._devices else '')
 
     @classmethod
     def fromId(cls, uuid):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36767eafbef3dbebef5a1d04417f18e0cc4898c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list