diff options
author | David Lehman <dlehman@redhat.com> | 2010-02-25 10:46:50 -0600 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2010-02-25 12:36:46 -0600 |
commit | f8f27c14140377d9a9a6c3c32294f27ee771af1f (patch) | |
tree | f9a896d0c5238ff2fd8f46a5e151ddb1bafe14dd | |
parent | 3556a3d70867a30be61ecb64e32a5ddfecc9d89b (diff) | |
download | anaconda-f8f27c14140377d9a9a6c3c32294f27ee771af1f.tar.gz anaconda-f8f27c14140377d9a9a6c3c32294f27ee771af1f.tar.xz anaconda-f8f27c14140377d9a9a6c3c32294f27ee771af1f.zip |
Check for the real device-mapper nodes in /proc/swaps. (#567840)
-rw-r--r-- | storage/devicelibs/swap.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/storage/devicelibs/swap.py b/storage/devicelibs/swap.py index d037d80ae..92dfe93aa 100644 --- a/storage/devicelibs/swap.py +++ b/storage/devicelibs/swap.py @@ -26,6 +26,7 @@ import iutil import os from ..errors import * +from . import dm import gettext _ = lambda x: gettext.ldgettext("anaconda", x) @@ -100,13 +101,23 @@ def swapoff(device): raise SwapError("swapoff failed for '%s'" % device) def swapstatus(device): + alt_dev = None + if device.startswith("/dev/mapper/"): + # get the real device node for device-mapper devices since the ones + # with meaningful names are just symlinks + try: + alt_dev = "/dev/%s" % dm.dm_node_from_name(device.split("/")[-1]) + except DMError: + alt_dev = None + lines = open("/proc/swaps").readlines() status = False for line in lines: if not line.strip(): continue - - if line.split()[0] == device: + + swap_dev = line.split()[0] + if swap_dev in [device, alt_dev]: status = True break |