Change in vdsm[master]: vm: factor out the vm hashes

fromani at redhat.com fromani at redhat.com
Wed Jul 8 09:40:45 UTC 2015


Francesco Romani has uploaded a new change for review.

Change subject: vm: factor out the vm hashes
......................................................................

vm: factor out the vm hashes

Extracts the code which reports the devices and guest
hashes in a single, shared and simple helper.

Change-Id: Id05143021d505e815abbd227f58f460cf9b45210
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
1 file changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/43286/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 5266b71..7cc4d0b 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -386,8 +386,7 @@
                 self._evaluatedStatus = vm_status
                 current_status = self.lastStatus
                 stats['status'] = vm_status,
-                stats['hash'] = str(hash((self._domain.devices_hash,
-                                    self.guestAgent.diskMappingHash)))
+                stats['hash'] = self._getVmStatusHash()
 
                 # TODO: DOWN and exitCode must be set atomically. Once this is
                 # done we can remove the multiple conditions from this code.
@@ -403,6 +402,10 @@
             self.log.debug('Last status %s and evaluated status %s',
                            current_status, vm_status)
             self._notify('VM_status', stats)
+
+    def _getVmStatusHash(self):
+        return str(hash((self._domain.devices_hash,
+                        self.guestAgent.diskMappingHash)))
 
     def _notify(self, operation, params):
         sub_id = '|virt|%s|%s' % (operation, self.id)
@@ -1415,8 +1418,8 @@
                     self.log.exception("Error setting vm disk stats")
 
         stats.update(self._getGraphicsStats())
-        stats['hash'] = str(hash((self._domain.devices_hash,
-                                  self.guestAgent.diskMappingHash)))
+        stats['hash'] = self._getVmStatusHash()
+
         if self._watchdogEvent:
             stats['watchdogEvent'] = self._watchdogEvent
         if self._numaInfo:


-- 
To view, visit https://gerrit.ovirt.org/43286
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id05143021d505e815abbd227f58f460cf9b45210
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list