[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Put in some handling for redundant method calls and devices containing '/'.
- From: David Lehman <dlehman redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH] Put in some handling for redundant method calls and devices containing '/'.
- Date: Thu, 20 Mar 2008 12:25:07 -0500
---
cryptodev.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/cryptodev.py b/cryptodev.py
index 2cd14d7..080d198 100644
--- a/cryptodev.py
+++ b/cryptodev.py
@@ -62,10 +62,16 @@ class LUKSDevice:
return self.scheme
def setDevice(self, device):
+ if self._device == device:
+ return
+
self._device = device
if device is not None:
+ if device.startswith("/dev/"):
+ device = device[5:]
+
name = "%s-%s" % (self.scheme.lower(),
- os.path.basename(device))
+ device.replace("/", "-"))
self.setName(name)
def getDevice(self, encrypted=0):
@@ -78,6 +84,9 @@ class LUKSDevice:
def setName(self, name, lock=False):
"""Set the name of the mapped device, eg: 'dmcrypt-sda3'"""
+ if self.name == name:
+ return
+
if self.name and not self.getStatus():
raise RuntimeError, "Cannot rename an active mapping."
--
1.5.4.1
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]