[rhel7-branch 1/6] Remove redundant check for parents in Blivet.newBTRFS.
dwlehman
installerbot-noreply at redhat.com
Fri May 29 17:35:10 UTC 2015
From: David Lehman <dlehman at redhat.com>
We already check parent type in BTRFSSubVolumeDevice, but we should be
using BTRFSValueError if those checks fail.
(cherry picked from commit 58884e4581a2076675c728c8a5ce15a04c4c3e62)
Resolves: rhbz#1072285
---
blivet/__init__.py | 5 -----
blivet/devices/btrfs.py | 4 ++--
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 1f47add..b57b9cb 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1223,11 +1223,6 @@ def newBTRFS(self, *args, **kwargs):
if kwargs.pop("subvol", False):
dev_class = BTRFSSubVolumeDevice
- # make sure there's a valid parent device
- parents = kwargs.get("parents", [])
- if not parents or len(parents) != 1 or \
- not isinstance(parents[0], BTRFSVolumeDevice):
- raise ValueError("new btrfs subvols require a parent volume")
# set up the subvol name, using mountpoint if necessary
if not name:
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py
index 23874ae..9290a13 100644
--- a/blivet/devices/btrfs.py
+++ b/blivet/devices/btrfs.py
@@ -434,10 +434,10 @@ def __init__(self, *args, **kwargs):
super(BTRFSSubVolumeDevice, self).__init__(*args, **kwargs)
if len(self.parents) != 1:
- raise errors.DeviceError("%s %s must have exactly one parent." % (self.type, self.name))
+ raise errors.BTRFSValueError("%s %s must have exactly one parent." % self.type)
if not isinstance(self.parents[0], BTRFSDevice):
- raise errors.DeviceError("%s %s's unique parent must be a BTRFSDevice." % (self.type, self.name))
+ raise errors.BTRFSValueError("%s %s's unique parent must be a BTRFSDevice." % self.type)
self.volume._addSubVolume(self)
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/ad176cb177fdd587e747fb72339f95a168890c00
More information about the anaconda-patches
mailing list