[PATCH 06/11] Split out logic to determine container based on factory and/or device.
David Lehman
dlehman at redhat.com
Thu Aug 16 21:48:45 UTC 2012
---
pyanaconda/storage/__init__.py | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index b3bac3e..f37341d 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1921,6 +1921,20 @@ class Storage(object):
self, size, [d.name for d in disks], raid_level))
return factory_class(self, size, disks, raid_level, encrypted)
+ def getContainer(self, factory, device=None):
+ container = None
+ if device:
+ if hasattr(device, "vg"):
+ container = device.vg
+ elif hasattr(device, "volume"):
+ container = device.volume
+ else:
+ containers = [c for c in factory.container_list if not c.exists]
+ if containers:
+ container = containers[0]
+
+ return container
+
def newDevice(self, device_type, size, **kwargs):
""" Schedule creation of a device based on a top-down specification.
@@ -1978,17 +1992,7 @@ class Storage(object):
factory = self.getDeviceFactory(device_type, size, **kwargs)
self.size_sets = [] # clear this since there are no growable reqs now
-
- container = None
- if device:
- if hasattr(device, "vg"):
- container = device.vg
- elif hasattr(device, "volume"):
- container = device.volume
- else:
- containers = [c for c in factory.container_list if not c.exists]
- if containers:
- container = containers[0]
+ container = self.getContainer(factory, device=device)
# TODO: striping, mirroring, &c
# TODO: non-partition members (pv-on-md)
--
1.7.7.6
More information about the anaconda-patches
mailing list