+ @property
+ def pvs(self):
+ """
+ To avoid having to make an LVM API call for every single item being
+ reported, the call gets set only once, using that stored call for
+ subsequent calls
+ """
+ if getattr(self, '_pvs', None) is not None:
+ return self._pvs
+ self._pvs = api.get_api_pvs()
+ return self._pvs
+
+ def match_devices(self, lv_uuid):
+ """
+ It is possible to have more than one PV reported *with the same name*,
+ to avoid incorrect or duplicate contents we correlated the lv uuid to
+ the one on the physical device.
+ """
+ devices = []
+ for device in self.pvs:
+ if device.get('lv_uuid') == lv_uuid:
+ devices.append(device['pv_name'])
+ return devices
+