[blivet:master 10/11] Fall back to accepting defaults if btrfs creation fails (#1109195)
mulhern
amulhern at redhat.com
Tue Jun 17 15:08:01 UTC 2014
Resolves: fed#1109195
At the point where the filesystem is being created failure because btrfs
is not comfortable with the options specified is worse than success
w/out those particular options.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/devices.py | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index d488422..097eab3 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -5220,10 +5220,25 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice):
def _create(self):
log_method_call(self, self.name, status=self.status)
- btrfs.create_volume(devices=[d.path for d in self.parents],
- label=self.format.label,
- data=self.dataLevel,
- metadata=self.metaDataLevel)
+ try:
+ btrfs.create_volume(devices=[d.path for d in self.parents],
+ label=self.format.label,
+ data=self.dataLevel,
+ metadata=self.metaDataLevel)
+ return
+ except errors.BTRFSError:
+ pass
+
+ log.warning("failed to create device %s with specified options %s, omitting options for second attempt", self, {'label' : self.format.label, 'data' : self.dataLevel, 'metadata' : self.metaDataLevel})
+
+ try:
+ btrfs.create_volume(devices=[d.path for d in self.parents])
+ return
+ except errors.BTRFSError:
+ pass
+
+ raise errors.DeviceCreateError("failed to create device %s on %s" % (self, [d.path for d in self.parents]))
+
def _postCreate(self):
super(BTRFSVolumeDevice, self)._postCreate()
--
1.9.3
More information about the anaconda-patches
mailing list