[PATCH rhel6-branch] Increment MD container child counter even if its volumes are ignored (#1120640)
by Artur Paszkiewicz
Volumes which are not selected in Specialized Storage Devices are
ignored in addUdevDevice. This causes that their parent container
won't have its child counter incremented, which can later cause an
incorrect unusedRaidMembersWarning.
Resolves: rhbz#1120640
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz(a)intel.com>
---
storage/devicetree.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 4045cdf..b9ea399 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1328,6 +1328,13 @@ class DeviceTree(object):
# slice off the "/dev/" part, lvm filter cares only about the rest
partitions_paths = [p[5:] for p in partitions_paths]
map(lvm.lvm_cc_addFilterRejectRegexp, partitions_paths)
+
+ if udev_device_get_md_container(info):
+ parentName = devicePathToName(udev_device_get_md_container(info))
+ container = self.getDeviceByName(parentName)
+ if container:
+ container.addChild()
+
return
log.debug("scanning %s (%s)..." % (name, sysfs_path))
--
1.8.4.5
8 years, 3 months
[blivet] small md cleanups
by David Lehman
Patch 1 is from previous pyudev set, but since it grew a followup it
seemed worth separating into its own set.
In testing I found that I no longer know how to hit the issue we're
handling with patch 2 here, but it should be better with this change.
Previously we would look up the correct device by UUID and use it, but
would not update its name to match reality. (The array must be active --
otherwise we wouldn't be in addUdevMDDevice.)
Patch 3 is fairly self-explanatory and just walks back part of a slightly
overzealous recent patch.
David Lehman (3):
Remove an obsolete block related to unpredictable md device names.
Update md name when lookup relied on UUID.
Don't pass md array UUID as member format UUID.
blivet/devicetree.py | 41 ++++++-----------------------------------
1 file changed, 6 insertions(+), 35 deletions(-)
--
1.9.3
9 years, 8 months
[blivet] Drop our pyudev in favor of python-udev (v2)
by David Lehman
Previous patch 3 is now part of a separate set.
Patch 1 has the suggested fixes from the list as well as conversion of
new logging statements in StorageDevice.updateSysfsPath to pass arguments
separately instead of formatting the string in advance.
Patch 2 has added comment disabling pylint warning about defining _mdInfo
outside of __init__.
Patch 3 (separate lvm and md metadata...) has added disabling of pylint
warnings for unused argument 'info'.
Patch 4 (adapt multipath...) is unchanged.
Patch 5 is new and just removes some things no longer used.
Patch 6 is also new and removes a function that is no longer useful.
David Lehman (6):
Replace our pyudev with the package python-pyudev.
Cache MD metadata while populating the devicetree.
Keep lvm and md metadata separate from udev info.
Adapt multipath detection code to external pyudev module.
Remove some unused multipath-specific functions from blivet.udev.
Remove parse_uevent_file since it won't work with pyudev.
blivet/deviceaction.py | 4 +-
blivet/devices.py | 95 +++++++--------------
blivet/devicetree.py | 122 ++++++++++++++------------
blivet/pyudev.py | 226 -------------------------------------------------
blivet/udev.py | 145 ++++++++-----------------------
blivet/util.py | 2 +-
python-blivet.spec | 1 +
tests/udev_test.py | 130 +---------------------------
8 files changed, 143 insertions(+), 582 deletions(-)
delete mode 100644 blivet/pyudev.py
--
1.9.3
9 years, 8 months
[master] Protect/hide zRAM devices properly
by Vratislav Podzimek
We use zRAM devices as swaps so they should be protected and hidden from the
user.
Vratislav Podzimek (1):
Mark zRAM devices as protected and ignore them
pyanaconda/anaconda.py | 7 ++++++-
pyanaconda/ui/gui/spokes/custom.py | 2 +-
pyanaconda/ui/lib/disks.py | 3 +--
3 files changed, 8 insertions(+), 4 deletions(-)
--
1.9.3
9 years, 8 months
[blivet] unit test updates
by David Lehman
Prompted by jenkins, I ran blivet's unit tests as root in a vm and here
is what I had to do to make it run, aside from applying my recent
pyparted patch to the code in python's site-lib.
Patch 2 is old code that I've wanted to remove for some time now, which I
found was getting triggered erroneously when manipulating a container's
member set as part of the action tests.
David Lehman (4):
Bypass size getter when mocking new devices.
Remove unused lvm and md activation code.
Clean up mocking done by udev tests when finished.
Update selinux tests for default context of mounts under /tmp.
blivet/devices.py | 20 --------------------
tests/formats_test/selinux_test.py | 6 +++---
tests/storagetestcase.py | 2 +-
tests/udev_test.py | 12 ++++++++++--
4 files changed, 14 insertions(+), 26 deletions(-)
--
1.9.3
9 years, 8 months
[blivet] Drop our pyudev in favor of python-pyudev
by David Lehman
This is nice in that we can drop some custom code, but python-pyudev
also provides classes that make it really easy to listen for uevents.
David Lehman (5):
Replace our pyudev with the package python-pyudev.
Cache MD metadata while populating the devicetree.
Remove an obsolete block related to unpredictable md device names.
Keep lvm and md metadata separate from udev info.
Adapt multipath detection code to external pyudev module.
blivet/deviceaction.py | 4 +-
blivet/devices.py | 95 +++++++--------------
blivet/devicetree.py | 147 +++++++++++++++-----------------
blivet/pyudev.py | 226 -------------------------------------------------
blivet/udev.py | 122 +++++++++-----------------
blivet/util.py | 2 +-
python-blivet.spec | 1 +
tests/udev_test.py | 91 +-------------------
8 files changed, 141 insertions(+), 547 deletions(-)
delete mode 100644 blivet/pyudev.py
--
1.9.3
9 years, 8 months
[blivet][master] Fix issues reported by pyflakes
by Vratislav Podzimek
Unused imports and variables.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
blivet/__init__.py | 9 ---------
blivet/formats/__init__.py | 4 ++--
tests/devicelibs_test/btrfs_test.py | 3 ---
tests/partitioning_test.py | 8 ++++----
4 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index f2240ce..e384551 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -50,11 +50,8 @@ get_bootloader = lambda: None
##
import os
-from os import statvfs
import time
import stat
-import errno
-import sys
import copy
import tempfile
import shlex
@@ -82,7 +79,6 @@ from .devicelibs.dm import name_from_dm_node
from .devicelibs.crypto import generateBackupPassphrase
from .devicelibs.edd import get_edd_dict
from .devicelibs.dasd import make_dasd_list, write_dasd_conf
-from . import udev
from . import iscsi
from . import fcoe
from . import zfcp
@@ -112,11 +108,6 @@ def enable_installer_mode():
global ERROR_RAISE
from pyanaconda import iutil # pylint: disable=redefined-outer-name
- from pyanaconda.constants import shortProductName # pylint: disable=redefined-outer-name
- from pyanaconda.constants import productName # pylint: disable=redefined-outer-name
- from pyanaconda.bootloader import get_bootloader # pylint: disable=redefined-outer-name
- from pyanaconda.errors import errorHandler # pylint: disable=redefined-outer-name
- from pyanaconda.errors import ERROR_RAISE # pylint: disable=redefined-outer-name
if hasattr(iutil, 'getTargetPhysicalRoot'):
# For anaconda versions > 21.43
diff --git a/blivet/formats/__init__.py b/blivet/formats/__init__.py
index eabd22f..70280e8 100644
--- a/blivet/formats/__init__.py
+++ b/blivet/formats/__init__.py
@@ -27,10 +27,10 @@ from ..util import get_sysfs_path_by_name
from ..util import run_program
from ..util import ObjectID
from ..storage_log import log_method_call
-from ..errors import DeviceFormatError, DMError, FormatCreateError, FormatDestroyError, FormatSetupError, MDRaidError, StorageError
+from ..errors import DeviceFormatError, DMError, FormatCreateError, FormatDestroyError, FormatSetupError, MDRaidError
from ..devicelibs.dm import dm_node_from_name
from ..devicelibs.mdraid import md_node_from_name
-from ..i18n import _, N_
+from ..i18n import N_
from ..size import Size
import logging
diff --git a/tests/devicelibs_test/btrfs_test.py b/tests/devicelibs_test/btrfs_test.py
index 42e2156..dcf1bcd 100755
--- a/tests/devicelibs_test/btrfs_test.py
+++ b/tests/devicelibs_test/btrfs_test.py
@@ -60,7 +60,6 @@ class BTRFSAsRootTestCase1(loopbackedtestcase.LoopBackedTestCase):
These tests are limited to simple creating and scanning.
"""
_LOOP_DEV0 = self.loopDevices[0]
- _LOOP_DEV1 = self.loopDevices[1]
##
## create_volume
@@ -108,8 +107,6 @@ class BTRFSAsRootTestCase2(BTRFSMountDevice):
def testSubvolume(self):
"""Tests which focus on subvolumes."""
- _LOOP_DEV0 = self.loopDevices[0]
- _LOOP_DEV1 = self.loopDevices[1]
# no subvolumes yet
self.assertEqual(btrfs.list_subvolumes(self.mountpoint), [])
diff --git a/tests/partitioning_test.py b/tests/partitioning_test.py
index 6b0d9b6..41ca1a0 100644
--- a/tests/partitioning_test.py
+++ b/tests/partitioning_test.py
@@ -194,10 +194,10 @@ class PartitioningTestCase(unittest.TestCase):
placeholder = addPartition(disk.format, free,
parted.PARTITION_NORMAL, Size("10 MiB"))
all_free = disk.format.partedDisk.getFreeSpaceRegions()
- extended = addPartition(disk.format, all_free[1],
- parted.PARTITION_EXTENDED, Size("30 MiB"),
- alignment.alignUp(all_free[1],
- placeholder.geometry.end))
+ addPartition(disk.format, all_free[1],
+ parted.PARTITION_EXTENDED, Size("30 MiB"),
+ alignment.alignUp(all_free[1],
+ placeholder.geometry.end))
disk.format.removePartition(placeholder)
self.assertEqual(len(disk.format.partitions), 1)
--
1.9.3
9 years, 8 months
[master/rhel7-branch][PATCH] Use blivet's getFreeSpace for limitting automatic swap size
by Vratislav Podzimek
We should limit swap size to 10 % of available free space not overall disk
space. Blivet's getFreeSpace can help us a lot with this.
Resolves: rhbz#1053462
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/kickstart.py | 30 ++++++++++++++++++++++--------
pyanaconda/ui/gui/spokes/custom.py | 3 +++
pyanaconda/ui/gui/spokes/storage.py | 12 +++---------
3 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index c8ac223..8a3a942 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -200,8 +200,7 @@ def removeExistingFormat(device, storage):
def getAvailableDiskSpace(storage):
"""
- Get overall disk space available on disks we may use (not free space on the
- disks, but overall space on the disks).
+ Get overall disk space available on disks we may use.
:param storage: blivet.Blivet instance
:return: overall disk space available in MB
@@ -209,13 +208,28 @@ def getAvailableDiskSpace(storage):
"""
- disk_space = 0
- for disk in storage.disks:
- if not storage.config.clearPartDisks or \
- disk.name in storage.config.clearPartDisks:
- disk_space += disk.size
- return disk_space
+ free_space = storage.getFreeSpace()
+ if free_space:
+ return sum(float(disk_free.convertTo("MB")) for disk_free, fs_free in free_space.values())
+ else:
+ return 0
+
+def refreshAutoSwapSize(storage):
+ """
+ Refresh size of the auto partitioning request for swap device accordingly to
+ the current state of the storage configuration.
+
+ :param storage: blivet.Blivet instance
+
+ """
+
+ for request in storage.autoPartitionRequests:
+ if request.fstype == "swap":
+ disk_space = getAvailableDiskSpace(storage)
+ request.size = swap_lib.swapSuggestion(disk_space=disk_space)
+ break
+
###
### SUBCLASSES OF PYKICKSTART COMMAND HANDLERS
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 61506fc..7372e47 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -82,6 +82,8 @@ from pyanaconda.ui.gui.utils import setViewportBackground, gtk_action_wait, enli
really_hide, really_show
from pyanaconda.ui.gui.categories.system import SystemCategory
from pyanaconda.ui.lib.disks import size_str
+from pyanaconda.kickstart import refreshAutoSwapSize
+
# pylint: disable-msg=E0611
from gi.repository import Gdk, Gtk
@@ -2647,6 +2649,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self.clear_errors()
with ui_storage_logger():
try:
+ refreshAutoSwapSize(self.__storage)
doAutoPartition(self.__storage, self.data)
except NoDisksError as e:
# No handling should be required for this.
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bdd48ef..db4a5c3 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -53,14 +53,13 @@ from pyanaconda.ui.gui.spokes.lib.resize import ResizeDialog
from pyanaconda.ui.gui.categories.system import SystemCategory
from pyanaconda.ui.gui.utils import enlightbox, gtk_call_once, gtk_action_wait
-from pyanaconda.kickstart import doKickstartStorage, getAvailableDiskSpace
+from pyanaconda.kickstart import doKickstartStorage, refreshAutoSwapSize
from blivet.size import Size
from blivet.devices import MultipathDevice
from blivet.errors import StorageError
from blivet.errors import SanityError
from blivet.errors import SanityWarning
from blivet.platform import platform
-from blivet.devicelibs import swap as swap_lib
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.product import productName
from pyanaconda.flags import flags
@@ -340,13 +339,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# user may have set up before now.
self.storage.config.clearNonExistent = self.data.autopart.autopart
- # refresh the autopart swap size suggestion with currently selected disks
- for request in self.storage.autoPartitionRequests:
- if request.fstype == "swap":
- disk_space = getAvailableDiskSpace(self.storage)
- request.size = swap_lib.swapSuggestion(disk_space=disk_space)
- break
-
def execute(self):
# Spawn storage execution as a separate thread so there's no big delay
# going back from this spoke to the hub while StorageChecker.run runs.
@@ -872,6 +864,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
# catch-all. Just stay on this spoke.
return
+ if self.autopart:
+ refreshAutoSwapSize(self.storage)
self.applyOnSkip = True
NormalSpoke.on_back_clicked(self, button)
--
1.9.3
9 years, 8 months
[blivet:master] Break once metadata value is found.
by Anne Mulhern
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/devicelibs/mdraid.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py
index 516bbba..9335117 100644
--- a/blivet/devicelibs/mdraid.py
+++ b/blivet/devicelibs/mdraid.py
@@ -315,6 +315,7 @@ def mdexamine(device):
if name == "metadata":
info["MD_METADATA"] = value
+ break
process_UUIDS(info, ('MD_UUID', 'MD_DEV_UUID'))
--
1.9.3
9 years, 8 months
[PATCH] main: https is a sane package source URL scheme
by Colin Walters
Not sure exactly why sanitize_repo() was written this way; annotate
traces it to a rename from an earlier file and I was too lazy
to go back farther.
Anyways, I want to use https, so rework this code to add it.
---
src/sbin/lorax | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
9 years, 8 months