Skip to content

Commit

Permalink
Merge pull request #755 from vojtechtrefny/3.1-devel_pvfree-fix
Browse files Browse the repository at this point in the history
Do not raise exception if can't get PV free space
  • Loading branch information
vojtechtrefny committed Feb 26, 2019
2 parents e512a9a + 5ee2dee commit a410512
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions blivet/formats/lvmpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from ..errors import PhysicalVolumeError
from . import DeviceFormat, register_device_format
from .. import udev
from ..static_data.lvm_info import pvs_info

import logging
log = logging.getLogger("blivet")
Expand Down Expand Up @@ -162,8 +163,12 @@ def free(self):
if self.exists:
# we don't have any actual value, but the PV exists and is
# active, we should try to determine it
pv_info = blockdev.lvm.pvinfo(self.device)
self._free = Size(pv_info.pv_free)
pv_info = pvs_info.cache.get(self.device.path)
if pv_info is None:
log.error("Failed to get free space information for the PV '%s'", self.device)
self._free = Size(0)
else:
self._free = Size(pv_info.pv_free)
else:
raise PhysicalVolumeError("Unknown free space information for the PV '%s'" % self.device)

Expand Down

0 comments on commit a410512

Please sign in to comment.