[blivet:master 20/26] Add lists of supported RAID levels for btrfs and lvm
mulhern
amulhern at redhat.com
Thu May 29 18:47:38 UTC 2014
Update raid level code in BTRFSDevice appropriately so that it no longer
get raid.RAIDLevels(), instead gets the list of BTRFS supported RAID levels.
Note that lvm does not itself actually support linear. Linear is an option
when making an lvm filesystem on top of RAID, so linear really belongs
in mdraid's supported RAID levels.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/devicelibs/btrfs.py | 3 +++
blivet/devicelibs/lvm.py | 3 +++
blivet/devices.py | 3 +--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/blivet/devicelibs/btrfs.py b/blivet/devicelibs/btrfs.py
index 61697ba..4d2eb6c 100644
--- a/blivet/devicelibs/btrfs.py
+++ b/blivet/devicelibs/btrfs.py
@@ -23,6 +23,7 @@
import os
import re
+from . import raid
from .. import util
from ..errors import BTRFSError
@@ -32,6 +33,8 @@ log = logging.getLogger("blivet")
# this is the volume id btrfs always assigns to the top-level volume/tree
MAIN_VOLUME_ID = 5
+RAID_levels = raid.RAIDLevels(["raid0", "raid1", "raid10", "single"])
+
def btrfs(args, capture=False):
if capture:
exec_func = util.capture_output
diff --git a/blivet/devicelibs/lvm.py b/blivet/devicelibs/lvm.py
index 67fc1e5..3c55adb 100644
--- a/blivet/devicelibs/lvm.py
+++ b/blivet/devicelibs/lvm.py
@@ -26,6 +26,7 @@ from decimal import Decimal
import logging
log = logging.getLogger("blivet")
+from . import raid
from ..size import Size
from .. import util
from .. import arch
@@ -44,6 +45,8 @@ LVM_THINP_MAX_METADATA_SIZE = Size("16 GiB")
LVM_THINP_MIN_CHUNK_SIZE = Size("64 KiB")
LVM_THINP_MAX_CHUNK_SIZE = Size("1 GiB")
+RAID_levels = raid.RAIDLevels(["raid0", "raid1"])
+
def has_lvm():
if util.find_program_in_path("lvm"):
for line in open("/proc/devices").readlines():
diff --git a/blivet/devices.py b/blivet/devices.py
index 6993ded..5513b2d 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -29,7 +29,6 @@ from decimal import Decimal
import re
# device backend modules
-from .devicelibs import raid
from .devicelibs import mdraid
from .devicelibs import lvm
from .devicelibs import dm
@@ -4755,7 +4754,7 @@ class BTRFSVolumeDevice(BTRFSDevice, ContainerDevice):
def _removeParent(self, member):
# btrfs won't let you degrade it
limits = []
- levels = raid.RAIDLevels()
+ levels = btrfs.RAID_levels
if self.dataLevel and self.dataLevel != "single":
limits.append(levels.raidLevel(self.dataLevel).min_members)
--
1.8.3.1
More information about the anaconda-patches
mailing list