@@ -847,6 +859,28 @@ def removeInternalLV(self, int_lv):
self.name)
raise ValueError(msg)
+ @property
+ def cached(self):
+ return bool(self.cache)
+
+ @property
+ def cache(self):
+ if self.exists and not self._cache:
+ # check if we have a cache pool internal LV
+ pool = None
+ for lv in self._internal_lvs:
+ if isinstance(lv, LVMCachePoolLogicalVolumeDevice):
+ pool = lv
+
+ self._cache = LVMCache(self, size=pool.size, exists=True)
+
+ return self._cache
This always creates an `LVMCache`, no? So then the `cached` property above will always be
True for existing LVs. I think it just needs an `if pool is not None:` guarding the
assignment to `self._cache`.
--
To view this pull request on github, visit
https://github.com/rhinstaller/blivet/pull/156#discussion_r33150879