storage: make DirectoryThinPool helper less verbose, add sudo
Don't print scary messages when given pool cannot be found. Also, add sudo to make it work from non-root user (tests)
This commit is contained in:
parent
1bc640f3e0
commit
825de49767
@ -932,9 +932,12 @@ class DirectoryThinPool:
|
||||
fs_major = (fs_stat.st_dev & 0xff00) >> 8
|
||||
fs_minor = fs_stat.st_dev & 0xff
|
||||
|
||||
root_table = subprocess.check_output(["dmsetup",
|
||||
sudo = []
|
||||
if os.getuid():
|
||||
sudo = ['sudo']
|
||||
root_table = subprocess.check_output(sudo + ["dmsetup",
|
||||
"-j", str(fs_major), "-m", str(fs_minor),
|
||||
"table"])
|
||||
"table"], stderr=subprocess.DEVNULL)
|
||||
|
||||
_start, _sectors, target_type, target_args = \
|
||||
root_table.decode().split(" ", 3)
|
||||
|
Loading…
Reference in New Issue
Block a user