Nir Soffer has uploaded a new change for review. Change subject: vm: Introduce drive monitoring concept ......................................................................
vm: Introduce drive monitoring concept We have two periodic operations related to monitoring drives; updating volume size and extending drives. Both are controlled by the strange concept of disks stats collection. Replace the concept of disk stats collection with the more general concept of drive monitoring. This is also a preparation for extracting the drive monitoring code to its own class. The old methods were mixing the concepts of running (start, stop) and enabling (enabled). The new methods use the enabling concept. The old methods stored the current state in self._volumesPrepared; this looks like a leftover from older implementation. Now we store the state in self._driveMonitorEnabled. Change-Id: Ia082f8bef03735c63b66e6b6c574e527bf6cafb4 Signed-off-by: Nir Soffer <[email protected]> --- M lib/vdsm/virt/periodic.py M vdsm/virt/vm.py 2 files changed, 23 insertions(+), 23 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/59765/1 diff --git a/lib/vdsm/virt/periodic.py b/lib/vdsm/virt/periodic.py index 2f57323..77ea6a7 100644 --- a/lib/vdsm/virt/periodic.py +++ b/lib/vdsm/virt/periodic.py @@ -324,7 +324,7 @@ def required(self): return (super(UpdateVolumes, self).required and # Avoid queries from storage during recovery process - self._vm.isDisksStatsCollectionEnabled()) + self._vm.driveMonitorEnabled()) def _execute(self): for drive in self._vm.getDiskDevices(): diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index f439472..c2fe1b0 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -280,7 +280,7 @@ float(self.conf.pop('elapsedTimeOffset', 0)) self._usedIndices = {} # {'ide': [], 'virtio' = []} - self.stopDisksStatsCollection() + self.disableDriveMonitor() self._vmStartEvent = threading.Event() self._vmAsyncStartError = None self._vmCreationEvent = threading.Event() @@ -772,14 +772,14 @@ def incomingMigrationPending(self): return 'migrationDest' in self.conf or 'restoreState' in self.conf - def stopDisksStatsCollection(self): - self._volumesPrepared = False + def disableDriveMonitor(self): + self._driveMonitorEnabled = False - def startDisksStatsCollection(self): - self._volumesPrepared = True + def enableDriveMonitor(self): + self._driveMonitorEnabled = True - def isDisksStatsCollectionEnabled(self): - return self._volumesPrepared + def driveMonitorEnabled(self): + return self._driveMonitorEnabled def preparePaths(self): drives = self._devSpecMapFromConf()[hwclass.DISK] @@ -795,7 +795,7 @@ else: # Now we got all the resources we needed - self.startDisksStatsCollection() + self.enableDriveMonitor() def _prepareTransientDisks(self, drives): for drive in drives: @@ -1003,7 +1003,7 @@ If this retruns True, the periodic system will invoke extendDrivesIfNeeded during this periodic cycle. """ - return self._volumesPrepared and bool(self._chunkedDrives()) + return self._driveMonitorEnabled and bool(self._chunkedDrives()) def extendDrivesIfNeeded(self): try: @@ -3514,12 +3514,12 @@ # see the XML even with 'info' as default level. self.log.info(snapxml) - # We need to stop the collection of the stats for two reasons, one - # is to prevent spurious libvirt errors about missing drive paths - # (since we're changing them), and also to prevent to trigger a drive + # We need to stop the drive monitoring for two reasons, one is to + # prevent spurious libvirt errors about missing drive paths (since + # we're changing them), and also to prevent to trigger a drive # extension for the new volume with the apparent size of the old one # (the apparentsize is updated as last step in updateDriveParameters) - self.stopDisksStatsCollection() + self.disableDriveMonitor() try: if should_freeze: @@ -3559,7 +3559,7 @@ self.log.exception("Failed to update drive information" " for '%s'", drive) finally: - self.startDisksStatsCollection() + self.enableDriveMonitor() if memoryParams: self.cif.teardownVolumePath(memoryVol) @@ -3687,11 +3687,11 @@ blockJobFlags = libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT diskToTeardown = srcDisk - # We need to stop the stats collection in order to avoid spurious + # We need to stop monitoring drives in order to avoid spurious # errors from the stats threads during the switch from the old # drive to the new one. This applies only to the case where we # actually switch to the destination. - self.stopDisksStatsCollection() + self.disableDriveMonitor() else: self.log.debug("Stopping the disk replication remaining on the " "source drive: %s", dstDisk) @@ -3721,7 +3721,7 @@ self.updateDriveParameters(dstDiskCopy) finally: self._delDiskReplica(drive) - self.startDisksStatsCollection() + self.enableDriveMonitor() return {'status': doneCode} @@ -4920,9 +4920,9 @@ # A pivot changes the top volume being used for the VM Disk. Until # we can correct our metadata following the pivot we should not - # attempt to collect disk stats. - # TODO: Stop collection only for the live merge disk - self.vm.stopDisksStatsCollection() + # attempt to monitor drives. + # TODO: Stop monitoring only for the live merge disk + self.vm.disableDriveMonitor() self.vm.log.info("Requesting pivot to complete active layer commit " "(job %s)", self.job['jobID']) @@ -4930,7 +4930,7 @@ flags = libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT ret = self.vm._dom.blockJobAbort(self.drive.name, flags) except: - self.vm.startDisksStatsCollection() + self.vm.enableDriveMonitor() raise else: if ret != 0: @@ -4964,7 +4964,7 @@ "(job %s)", self.job['jobID']) self.vm._syncVolumeChain(self.drive) if self.doPivot: - self.vm.startDisksStatsCollection() + self.vm.enableDriveMonitor() self.success = True self.vm.log.info("Synchronization completed (job %s)", self.job['jobID']) -- To view, visit https://gerrit.ovirt.org/59765 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia082f8bef03735c63b66e6b6c574e527bf6cafb4 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
