[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH] Create setup and teardown functs for dmraid devs.
- From: Joel Granados Moreno <jgranado redhat com>
- To: anaconda-devel-list redhat com
- Subject: [PATCH] Create setup and teardown functs for dmraid devs.
- Date: Thu, 2 Apr 2009 17:11:13 +0200
* storage/devices.py (DMRaidArrayDevice): Erase the activate and
deactivate functions for the DMRaidArrayDevice. They are no really
being used.
* storage/devices.py (DMRaidArrayDevice): Create setup and teardown
functions for the class.
* storage/devices.py (Device): Add the pyblock attribute to the shallow
copy list.
---
storage/devices.py | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/storage/devices.py b/storage/devices.py
index 32e4c23..da9aacc 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -201,7 +201,8 @@ class Device(object):
new = self.__class__.__new__(self.__class__)
memo[id(self)] = new
shallow_copy_attrs = ('partedDisk', 'partedDevice',
- '_partedPartition', '_origPartedDisk')
+ '_partedPartition', '_origPartedDisk',
+ '_raidSet')
for (attr, value) in self.__dict__.items():
if attr in shallow_copy_attrs:
setattr(new, attr, copy.copy(value))
@@ -2403,12 +2404,6 @@ class DMRaidArrayDevice(DiskDevice):
""" Return a list of this array's member device instances. """
return self.parents
- def activate(self, mknod=True):
- self._raidSet.activate(mknod=mknod)
-
- def deactivate(self):
- self._raidSet.deactivate()
-
def updateSysfsPath(self):
""" Update this device's sysfs path. """
log_method_call(self, self.name, status=self.status)
@@ -2422,6 +2417,29 @@ class DMRaidArrayDevice(DiskDevice):
else:
self.sysfsPath = ''
+ def teardown(self, recursive=None):
+ """ Close, or tear down, a device. """
+ log_method_call(self, self.name, status=self.status)
+ if not self.exists:
+ raise DeviceError("device has not been created")
+
+ if self.format.exists:
+ self.format.teardown()
+
+ # This call already checks if the set is not active.
+ self._raidSet.deactivate()
+
+ def setup(self, intf=None):
+ """ Open, or set up, a device. """
+ log_method_call(self, self.name, status=self.status)
+ if not self.exists:
+ raise DeviceError("device has not been created")
+
+ # This call already checks if the set is active.
+ self._raidSet.activate(mknod=True)
+
+ udev_settle()
+
class MultipathDevice(DMDevice):
""" A multipath device """
--
1.6.0.6
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]