From f0d9bf82b91d5c32580780a9a977cccff1e8a765 Mon Sep 17 00:00:00 2001 From: Vratislav Podzimek Date: Tue, 16 Jun 2015 13:06:02 +0200 Subject: [PATCH] Create cached LVs before non-cached LVs In order to minimize the risk of non-cached LVs taking space on fast PVs that should be used by caches. --- blivet/deviceaction.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py index 4fd6df236..41b8289b7 100644 --- a/blivet/deviceaction.py +++ b/blivet/deviceaction.py @@ -26,7 +26,7 @@ from . import udev from .util import get_current_entropy from .devices import StorageDevice -from .devices import PartitionDevice +from .devices import PartitionDevice, LVMLogicalVolumeDevice from .formats import getFormat, luks from parted import partitionFlag, PARTITION_LBA from .i18n import _, N_ @@ -334,6 +334,14 @@ def requires(self, action): otherNum = action.device.partedPartition.number if selfNum > otherNum: rc = True + elif (action.isCreate and action.isDevice and + isinstance(self.device, LVMLogicalVolumeDevice) and + isinstance(action.device, LVMLogicalVolumeDevice) and + self.device.vg == action.device.vg): + # create cached LVs before non-cached LVs so that fast cache space + # is not taken by non-cached LVs + if not self.device.cached and action.device.cached: + rc = True elif (action.isAdd and action.container == self.container): rc = True