--- storage/devicelibs/swap.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/storage/devicelibs/swap.py b/storage/devicelibs/swap.py index d037d80..02a07d4 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,20 @@ def swapoff(device): raise SwapError("swapoff failed for '%s'" % device)
def swapstatus(device): + alt_dev = device + if device.startswith("/dev/mapper/"): + # get the real device node for device-mapper devices since the ones + # with meaningful names are just symlinks + alt_dev = "/dev/%s" % dm.dm_node_from_name(device.split("/")[-1]) + 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
--- 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 d037d80..92dfe93 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
On Thu, 2010-02-25 at 10:54 -0600, David Lehman wrote:
storage/devicelibs/swap.py | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
Tested here, works on KVM and real hardware live installs.
On 02/25/2010 05:54 PM, David Lehman wrote:
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 d037d80..92dfe93 100644
David,
This will also fix #590384. Can I cherrypick it for rhel6?
Ales
On Tue, 2010-05-11 at 15:56 +0200, Ales Kozumplik wrote:
On 02/25/2010 05:54 PM, David Lehman wrote:
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 d037d80..92dfe93 100644
David,
This will also fix #590384. Can I cherrypick it for rhel6?
Sure, go ahead. If I had known it was relevant for rhel6 I would have done so myself.
Dave
Ales
anaconda-devel@lists.stg.fedoraproject.org