summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-09-03 16:52:19 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-09-04 09:42:44 -1000
commitf3a9063c024396cb04908deda1f9643511108291 (patch)
tree244390ca38776a397edf69956f0f61f990ede005 /storage
parentb8b14a762b224001c9925807885930dff724447f (diff)
downloadanaconda-f3a9063c024396cb04908deda1f9643511108291.tar.gz
anaconda-f3a9063c024396cb04908deda1f9643511108291.tar.xz
anaconda-f3a9063c024396cb04908deda1f9643511108291.zip
Support a force=True argument on SwapSpace.create()
force=True will tear down the device, unmount if necessary, and then reformat it.
Diffstat (limited to 'storage')
-rw-r--r--storage/formats/swap.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/storage/formats/swap.py b/storage/formats/swap.py
index 392ed11ae..e1dacb09d 100644
--- a/storage/formats/swap.py
+++ b/storage/formats/swap.py
@@ -132,10 +132,14 @@ class SwapSpace(DeviceFormat):
""" Create the device. """
log_method_call(self, device=self.device,
type=self.type, status=self.status)
- if self.exists:
+ force = kwargs.get("force")
+
+ if not force and self.exists:
raise SwapSpaceError("format already exists")
- if self.status:
+ if force:
+ self.teardown()
+ elif self.status:
raise SwapSpaceError("device exists and is active")
DeviceFormat.create(self, *args, **kwargs)