From: Vratislav Podzimek <vpodzime(a)redhat.com>
So that we move a step closer to putting pyblock into retirement.
---
blivet/devices/dm.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/blivet/devices/dm.py b/blivet/devices/dm.py
index 041cae2..25e30cf 100644
--- a/blivet/devices/dm.py
+++ b/blivet/devices/dm.py
@@ -22,7 +22,7 @@
import os
from gi.repository import BlockDev as blockdev
-import block
+from gi.repository import GLib
from .. import errors
from .. import util
@@ -96,9 +96,13 @@ def mapName(self):
@property
def status(self):
- match = next((m for m in block.dm.maps() if m.name == self.mapName),
- None)
- return (match.live_table and not match.suspended) if match else False
+ try:
+ return blockdev.dm_map_exists(self.mapName, True, True)
+ except GLib.GError as e:
+ if "Not running as root" in e.message:
+ return False
+ else:
+ raise
#def getTargetType(self):
# return dm.getDmTarget(name=self.name)
--
To view this commit on github, visit
https://github.com/rhinstaller/blivet/commit/f077d2e79c9bbcf4d05f3cd95f7c...