Nir Soffer has posted comments on this change.

Change subject: vm, guestagent: hash to include also the disk mapping
......................................................................


Patch Set 3:

(5 comments)

Lets keep changes minimal, we can and should improve the way we hash stuff, but 
later.

http://gerrit.ovirt.org/#/c/31701/3/vdsm/virt/guestagent.py
File vdsm/virt/guestagent.py:

Line 121:         self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Line 122:         self._stopped = True
Line 123:         self.guestStatus = None
Line 124:         self.guestDiskMapping = {}
Line 125:         self.diskMappingHash = 0
Lets keep the same format used in vm.py - '0'
Line 126:         self.guestInfo = {
Line 127:             'username': user,
Line 128:             'memUsage': 0,
Line 129:             'guestCPUCount': -1,


Line 304:                 disks.append(disk)
Line 305:             self.guestInfo['disksUsage'] = disks
Line 306:             self.guestDiskMapping = args.get('mapping', {})
Line 307:             self.diskMappingHash = 
hash(json.dumps(self.guestDiskMapping,
Line 308:                                                     sort_keys=True))
The hash should be a string. hash does return a number, but we should not use 
really use it for this purpose anyway. Lets keep the same format used in vm.py.
Line 309:         elif message == 'number-of-cpus':
Line 310:             self.guestInfo['guestCPUCount'] = int(args['count'])
Line 311:         else:
Line 312:             self.log.error('Unknown message type %s', message)


http://gerrit.ovirt.org/#/c/31701/3/vdsm/virt/vm.py
File vdsm/virt/vm.py:

Line 1543:         self._qemuguestSocketFile = 
self._makeChannelPath(_QEMU_GA_DEVICE_NAME)
Line 1544:         self.guestAgent = guestagent.GuestAgent(
Line 1545:             self._guestSocketFile, self.cif.channelListener, 
self.log)
Line 1546:         self._lastXMLDesc = '<domain><uuid>%s</uuid></domain>' % 
self.id
Line 1547:         self._devXmlHash = 0
This change is not needed.
Line 1548:         self._released = False
Line 1549:         self._releaseLock = threading.Lock()
Line 1550:         self.saveState()
Line 1551:         self._watchdogEvent = {}


Line 2533:                     self.log.error("Error setting vm disk stats",
Line 2534:                                    exc_info=True)
Line 2535: 
Line 2536:         stats.update(self._getGraphicsStats())
Line 2537:         stats['hash'] = str(hash((self._devXmlHash, 
self.guestAgent.diskMappingHash)))
Nice!
Line 2538:         if self._watchdogEvent:
Line 2539:             stats['watchdogEvent'] = self._watchdogEvent
Line 2540:         return stats
Line 2541: 


Line 4514:     def _getUnderlyingVmInfo(self):
Line 4515:         self._lastXMLDesc = self._dom.XMLDesc(0)
Line 4516:         devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \
Line 4517:             getElementsByTagName('devices')[0]
Line 4518:         self._devXmlHash = hash(devxml.toxml())
This change is not needed.
Line 4519: 
Line 4520:         return self._lastXMLDesc
Line 4521: 
Line 4522:     def _ejectFloppy(self):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I148196ccf353613f9cffed7753e7100bd1dd30de
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
Gerrit-Reviewer: Michal Skrivanek <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Vinzenz Feenstra <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to