forked from rpms/python-blivet
		
	Do not ignore "Image out-of-sync" internal LVs (vtrefny)
Fixed error message when slave is missing (japokorn) Ensure WWNs are set for multipath and dmraid. (dlehman) Use ID_WWN_WITH_EXTENSION for WWNs. (dlehman) Ignore pylint error "bad-option-value" for new pylint errors (vtrefny) Fix errors found by new pylint 2.0.0 (vtrefny) Fix caching logic in ExternalResource. (dlehman) Use DiskFile to allow testing missing dependencies as non-root. (dlehman) Restore availability caching after disabling for tests. (dlehman) Preserve original blockdev plugin list in test cleanup. (dlehman) Fix positional/key-word arguments in util.Path (vtrefny) fix doc for is_s390() (dan) The key size of LUKS should be 0 by default (vponcova) Do not use rpm to check for Zanata client (vtrefny) Fixed create_device fail behavior (japokorn) Fixed KS forcing zerombr onto RO disk (japokorn) Fix BIOS device number regex in edd module. (#1552236) (dlehman) Shrink devices before growing others with common ancestors. (#1539422) (dlehman) Do not copy ksdata. (rvykydal) Find and remove stale LVM metadata immediately after creating md array. (dlehman) Adapt mock imports for compatibility w/ python2 & python3. (dlehman) Use py2-compatible syntax to get system architecture. (dlehman)
This commit is contained in:
		
							parent
							
								
									486274fa56
								
							
						
					
					
						commit
						a8c998d1fa
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -108,3 +108,4 @@ | ||||
| /blivet-2.1.11.tar.gz | ||||
| /blivet-3.0.0.b1.tar.gz | ||||
| /blivet-3.1.0.b1.tar.gz | ||||
| /blivet-3.1.0.b2.tar.gz | ||||
|  | ||||
| @ -1,28 +0,0 @@ | ||||
| From ce4a0b07d77c81c066e05c7585fa436cfc4007bf Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Feb 2018 14:35:26 +0100 | ||||
| Subject: [PATCH 1/7] Add NVDIMM plugin to list of requested plugins | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/__init__.py | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/__init__.py b/blivet/__init__.py
 | ||||
| index 38492368..a86ce8c4 100644
 | ||||
| --- a/blivet/__init__.py
 | ||||
| +++ b/blivet/__init__.py
 | ||||
| @@ -51,9 +51,9 @@ gi.require_version("BlockDev", "2.0")
 | ||||
|  from gi.repository import GLib | ||||
|  from gi.repository import BlockDev as blockdev | ||||
|  if arch.is_s390(): | ||||
| -    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390"))
 | ||||
| +    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
 | ||||
|  else: | ||||
| -    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm"))
 | ||||
| +    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
 | ||||
|   | ||||
|  _requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES) | ||||
|  try: | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,25 +0,0 @@ | ||||
| From 4c58ccbd1aba4904d8d33ce5699b43bbaaffa9ec Mon Sep 17 00:00:00 2001 | ||||
| From: Vendula Poncova <vponcova@redhat.com> | ||||
| Date: Tue, 27 Feb 2018 13:49:10 +0100 | ||||
| Subject: [PATCH] Dasd is a valid label type on s390x (#1538550) | ||||
| 
 | ||||
| Add the dasd label type to the list of valid label types for s390x. | ||||
| This bug was introduced in the commit ebd43b6. | ||||
| 
 | ||||
| Resolves: rhbz#1538550 | ||||
| ---
 | ||||
|  blivet/formats/disklabel.py          | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
 | ||||
| index 6251fceb..44f9834c 100644
 | ||||
| --- a/blivet/formats/disklabel.py
 | ||||
| +++ b/blivet/formats/disklabel.py
 | ||||
| @@ -226,7 +226,7 @@ def get_platform_label_types(cls):
 | ||||
|          elif arch.is_efi() and not arch.is_aarch64(): | ||||
|              label_types = ["gpt"] | ||||
|          elif arch.is_s390(): | ||||
| -            label_types = ["msdos"]  # since 'dasd' is only for DASD, it isn't listed here
 | ||||
| +            label_types = ["msdos", "dasd"]
 | ||||
| 
 | ||||
|          return label_types | ||||
| @ -1,34 +0,0 @@ | ||||
| From 7a9697eae467fc0ed44022d948f70f30d156d69e Mon Sep 17 00:00:00 2001 | ||||
| From: Adam Williamson <adamw@fedoraproject.org> | ||||
| Date: Fri, 11 Nov 2016 12:36:12 -0500 | ||||
| Subject: [PATCH] Fix "unknown" SAS device sysfs parsing. | ||||
| 
 | ||||
| Since the regexp matches the device type as well as the identifying | ||||
| numbers, we need to pull the numbers from match groups 2 and 3, not 1 | ||||
| and 2. | ||||
| 
 | ||||
| Resolves: rhbz#1394026 | ||||
| 
 | ||||
| Signed-off-by: Peter Jones <pjones@redhat.com> | ||||
| ---
 | ||||
|  blivet/devicelibs/edd.py | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py
 | ||||
| index 7a1a1e2..51b7ed8 100644
 | ||||
| --- a/blivet/devicelibs/edd.py
 | ||||
| +++ b/blivet/devicelibs/edd.py
 | ||||
| @@ -316,8 +316,8 @@ class EddEntry(object):
 | ||||
|                          self.sas_address = int(sas_match.group(1), base=16) | ||||
|                          self.sas_lun = int(sas_match.group(2), base=16) | ||||
|                      elif unknown_match: | ||||
| -                        self.sas_address = int(unknown_match.group(1), base=16)
 | ||||
| -                        self.sas_lun = int(unknown_match.group(2), base=16)
 | ||||
| +                        self.sas_address = int(unknown_match.group(2), base=16)
 | ||||
| +                        self.sas_lun = int(unknown_match.group(3), base=16)
 | ||||
|                      else: | ||||
|                          log.warning("edd: can not match interface for %s: %s", | ||||
|                                      self.sysfspath, interface) | ||||
| -- 
 | ||||
| 2.7.4 | ||||
| 
 | ||||
| @ -1,47 +0,0 @@ | ||||
| From 4b8bcadc43ed78a0eedb8e330684c626ef8b9d89 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 21 Jun 2017 15:36:42 -0400 | ||||
| Subject: [PATCH] Stop enforcing obsolete limits on partition count. (#1460668) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/partitioning.py     | 10 ++++------ | ||||
|  tests/partitioning_test.py | 20 +++++++++----------- | ||||
|  2 files changed, 13 insertions(+), 17 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/partitioning.py b/blivet/partitioning.py
 | ||||
| index 05cb4c6..0a973e9 100644
 | ||||
| --- a/blivet/partitioning.py
 | ||||
| +++ b/blivet/partitioning.py
 | ||||
| @@ -136,8 +136,6 @@ def get_next_partition_type(disk, no_primary=None):
 | ||||
|      part_type = None | ||||
|      extended = disk.getExtendedPartition() | ||||
|      supports_extended = disk.supportsFeature(parted.DISK_TYPE_EXTENDED) | ||||
| -    logical_count = len(disk.getLogicalPartitions())
 | ||||
| -    max_logicals = disk.getMaxLogicalPartitions()
 | ||||
|      primary_count = disk.primaryPartitionCount | ||||
| 
 | ||||
|      if primary_count < disk.maxPrimaryPartitionCount: | ||||
| @@ -153,17 +151,17 @@ def get_next_partition_type(disk, no_primary=None):
 | ||||
|                  # there is an extended and a free primary | ||||
|                  if not no_primary: | ||||
|                      part_type = parted.PARTITION_NORMAL | ||||
| -                elif logical_count < max_logicals:
 | ||||
| -                    # we have an extended with logical slots, so use one.
 | ||||
| +                else:
 | ||||
| +                    # we have an extended, so use it.
 | ||||
|                      part_type = parted.PARTITION_LOGICAL | ||||
|          else: | ||||
|              # there are two or more primary slots left. use one unless we're | ||||
|              # not supposed to make primaries. | ||||
|              if not no_primary: | ||||
|                  part_type = parted.PARTITION_NORMAL | ||||
| -            elif extended and logical_count < max_logicals:
 | ||||
| +            elif extended:
 | ||||
|                  part_type = parted.PARTITION_LOGICAL | ||||
| -    elif extended and logical_count < max_logicals:
 | ||||
| +    elif extended:
 | ||||
|          part_type = parted.PARTITION_LOGICAL | ||||
| 
 | ||||
|      return part_type | ||||
| --
 | ||||
| 1.8.3.1 | ||||
| @ -1,183 +0,0 @@ | ||||
| From 037d12cf3d137e08cbb8fa698a1a9c50d20228ea Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Feb 2018 14:54:40 +0100 | ||||
| Subject: [PATCH 2/7] Add a singleton for NVDIMM namespaces management | ||||
| 
 | ||||
| This currently allows changing mode of the namespace and getting | ||||
| information about available namespaces. | ||||
| ---
 | ||||
|  blivet/static_data/__init__.py |   1 + | ||||
|  blivet/static_data/nvdimm.py   | 152 +++++++++++++++++++++++++++++++++++++++++ | ||||
|  2 files changed, 153 insertions(+) | ||||
|  create mode 100644 blivet/static_data/nvdimm.py | ||||
| 
 | ||||
| diff --git a/blivet/static_data/__init__.py b/blivet/static_data/__init__.py
 | ||||
| index 2c720af3..c5928ab4 100644
 | ||||
| --- a/blivet/static_data/__init__.py
 | ||||
| +++ b/blivet/static_data/__init__.py
 | ||||
| @@ -1,3 +1,4 @@
 | ||||
|  from .lvm_info import lvs_info, pvs_info | ||||
|  from .luks_data import luks_data | ||||
|  from .mpath_info import mpath_members | ||||
| +from .nvdimm import nvdimm
 | ||||
| diff --git a/blivet/static_data/nvdimm.py b/blivet/static_data/nvdimm.py
 | ||||
| new file mode 100644 | ||||
| index 00000000..0644c9f6
 | ||||
| --- /dev/null
 | ||||
| +++ b/blivet/static_data/nvdimm.py
 | ||||
| @@ -0,0 +1,152 @@
 | ||||
| +#
 | ||||
| +# nvdimm.py - nvdimm class
 | ||||
| +#
 | ||||
| +# Copyright (C) 2018  Red Hat, Inc.  All rights reserved.
 | ||||
| +#
 | ||||
| +# This program is free software; you can redistribute it and/or modify
 | ||||
| +# it under the terms of the GNU General Public License as published by
 | ||||
| +# the Free Software Foundation; either version 2 of the License, or
 | ||||
| +# (at your option) any later version.
 | ||||
| +#
 | ||||
| +# This program is distributed in the hope that it will be useful,
 | ||||
| +# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | ||||
| +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | ||||
| +# GNU General Public License for more details.
 | ||||
| +#
 | ||||
| +# You should have received a copy of the GNU General Public License
 | ||||
| +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | ||||
| +#
 | ||||
| +
 | ||||
| +import gi
 | ||||
| +gi.require_version("BlockDev", "2.0")
 | ||||
| +gi.require_version("GLib", "2.0")
 | ||||
| +from gi.repository import BlockDev
 | ||||
| +from gi.repository import GLib
 | ||||
| +
 | ||||
| +from .. import util
 | ||||
| +
 | ||||
| +import logging
 | ||||
| +log = logging.getLogger("blivet")
 | ||||
| +
 | ||||
| +
 | ||||
| +class NVDIMMDependencyGuard(util.DependencyGuard):
 | ||||
| +    error_msg = "libblockdev NVDIMM functionality not available"
 | ||||
| +
 | ||||
| +    def _check_avail(self):
 | ||||
| +        try:
 | ||||
| +            BlockDev.nvdimm_is_tech_avail(BlockDev.NVDIMMTech.NVDIMM_TECH_NAMESPACE,
 | ||||
| +                                          BlockDev.NVDIMMTechMode.RECONFIGURE |
 | ||||
| +                                          BlockDev.NVDIMMTechMode.QUERY |
 | ||||
| +                                          BlockDev.NVDIMMTechMode.ACTIVATE_DEACTIVATE)
 | ||||
| +        except GLib.GError:
 | ||||
| +            return False
 | ||||
| +        return True
 | ||||
| +
 | ||||
| +blockdev_nvdimm_required = NVDIMMDependencyGuard()
 | ||||
| +
 | ||||
| +
 | ||||
| +class NVDIMM(object):
 | ||||
| +    """ NVDIMM utility class.
 | ||||
| +
 | ||||
| +        .. warning::
 | ||||
| +            Since this is a singleton class, calling deepcopy() on the instance
 | ||||
| +            just returns ``self`` with no copy being created.
 | ||||
| +    """
 | ||||
| +
 | ||||
| +    def __init__(self):
 | ||||
| +        self._namespaces = None
 | ||||
| +
 | ||||
| +    # So that users can write nvdimm() to get the singleton instance
 | ||||
| +    def __call__(self):
 | ||||
| +        return self
 | ||||
| +
 | ||||
| +    def __deepcopy__(self, memo_dict):
 | ||||
| +        # pylint: disable=unused-argument
 | ||||
| +        return self
 | ||||
| +
 | ||||
| +    @property
 | ||||
| +    def namespaces(self):
 | ||||
| +        """ Dict of all NVDIMM namespaces, including dax and disabled namespaces
 | ||||
| +        """
 | ||||
| +        if not self._namespaces:
 | ||||
| +            self.update_namespaces_info()
 | ||||
| +
 | ||||
| +        return self._namespaces
 | ||||
| +
 | ||||
| +    @blockdev_nvdimm_required(critical=True, eval_mode=util.EvalMode.onetime)
 | ||||
| +    def update_namespaces_info(self):
 | ||||
| +        """ Update information about the namespaces
 | ||||
| +        """
 | ||||
| +        namespaces = BlockDev.nvdimm_list_namespaces(idle=True)
 | ||||
| +
 | ||||
| +        self._namespaces = dict((namespace.dev, namespace) for namespace in namespaces)
 | ||||
| +
 | ||||
| +    def get_namespace_info(self, device):
 | ||||
| +        """ Get namespace information for a device
 | ||||
| +            :param str device: device name (e.g. 'pmem0') or path
 | ||||
| +        """
 | ||||
| +        for info in self.namespaces.values():
 | ||||
| +            if info.blockdev == device or \
 | ||||
| +               (device.startswith("/dev/") and info.blockdev == device[5:]):
 | ||||
| +                return info
 | ||||
| +
 | ||||
| +    @blockdev_nvdimm_required(critical=True, eval_mode=util.EvalMode.onetime)
 | ||||
| +    def enable_namespace(self, namespace):
 | ||||
| +        """ Enable a namespace
 | ||||
| +            :param str namespace: devname of the namespace (e.g. 'namespace0.0')
 | ||||
| +        """
 | ||||
| +
 | ||||
| +        if namespace not in self.namespaces.keys():
 | ||||
| +            raise ValueError("Namespace '%s' doesn't exist." % namespace)
 | ||||
| +
 | ||||
| +        BlockDev.nvdimm_namespace_enable(namespace)
 | ||||
| +
 | ||||
| +        # and update our namespaces info "cache"
 | ||||
| +        self.update_namespaces_info()
 | ||||
| +
 | ||||
| +    @blockdev_nvdimm_required(critical=True, eval_mode=util.EvalMode.onetime)
 | ||||
| +    def reconfigure_namespace(self, namespace, mode, **kwargs):
 | ||||
| +        """ Change mode of the namespace
 | ||||
| +            :param str namespace: devname of the namespace (e.g. 'namespace0.0')
 | ||||
| +            :param str mode: new mode of the namespace (one of 'sector', 'memory', 'dax')
 | ||||
| +            :keyword int sector_size: sector size when reconfiguring to the 'sector' mode
 | ||||
| +            :keyword str map_location: map location when reconfiguring to the 'memory'
 | ||||
| +                                       mode (one of 'mem', 'dev')
 | ||||
| +
 | ||||
| +            .. note::
 | ||||
| +                This doesn't change state of the devicetree. It is necessary to
 | ||||
| +                run reset() or populate() to make these changes visible.
 | ||||
| +        """
 | ||||
| +
 | ||||
| +        if namespace not in self.namespaces.keys():
 | ||||
| +            raise ValueError("Namespace '%s' doesn't exist." % namespace)
 | ||||
| +
 | ||||
| +        info = self.namespaces[namespace]
 | ||||
| +
 | ||||
| +        sector_size = kwargs.get("sector_size", None)
 | ||||
| +        map_location = kwargs.get("map_location", None)
 | ||||
| +
 | ||||
| +        if sector_size and mode != "sector":
 | ||||
| +            raise ValueError("Sector size cannot be set for selected mode '%s'." % mode)
 | ||||
| +
 | ||||
| +        if map_location and mode != "memory":
 | ||||
| +            raise ValueError("Map location cannot be set for selected mode '%s'." % mode)
 | ||||
| +
 | ||||
| +        mode_t = BlockDev.nvdimm_namespace_get_mode_from_str(mode)
 | ||||
| +
 | ||||
| +        if sector_size:
 | ||||
| +            extra = {"-l": str(sector_size)}
 | ||||
| +        elif map_location:
 | ||||
| +            extra = {"-M": map_location}
 | ||||
| +        else:
 | ||||
| +            extra = None
 | ||||
| +
 | ||||
| +        BlockDev.nvdimm_namespace_reconfigure(namespace, mode_t, info.enabled, extra)
 | ||||
| +
 | ||||
| +        # and update our namespaces info "cache"
 | ||||
| +        self.update_namespaces_info()
 | ||||
| +
 | ||||
| +
 | ||||
| +# Create nvdimm singleton
 | ||||
| +nvdimm = NVDIMM()
 | ||||
| +""" An instance of :class:`NVDIMM` """
 | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,31 +0,0 @@ | ||||
| From 152387afadf3d189539e6c8bd4b6decc0e7f15f7 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Mar 2018 10:45:46 +0100 | ||||
| Subject: [PATCH] Do not try to update potfile during make all | ||||
| 
 | ||||
| ---
 | ||||
|  po/Makefile | 4 +--- | ||||
|  1 file changed, 1 insertion(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/po/Makefile b/po/Makefile
 | ||||
| index 2f845cd..bbc6b5e 100644
 | ||||
| --- a/po/Makefile
 | ||||
| +++ b/po/Makefile
 | ||||
| @@ -27,7 +27,7 @@ MOFILES		= $(patsubst %.po,%.mo,$(POFILES))
 | ||||
|  PYSRC		= $(wildcard ../blivet/*.py ../blivet/*/*.py) | ||||
|  SRCFILES 	= $(PYSRC) | ||||
|   | ||||
| -all::  update-po $(MOFILES)
 | ||||
| +all::  refresh-po $(MOFILES)
 | ||||
|   | ||||
|  $(POTFILE): $(SRCFILES) | ||||
|  	$(XGETTEXT) -L Python --keyword=_ --keyword=N_ --keyword=P_:1,2 $(SRCFILES) | ||||
| @@ -65,5 +65,3 @@ install: $(MOFILES)
 | ||||
|  	$(MSGFMT) -o $@ $< | ||||
|   | ||||
|  .PHONY: missing depend | ||||
| -
 | ||||
| -
 | ||||
| -- 
 | ||||
| 1.8.3.1 | ||||
| 
 | ||||
| @ -1,29 +0,0 @@ | ||||
| From a14bf252c554c026215a69851c8649f705edaa5d Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Feb 2018 14:56:13 +0100 | ||||
| Subject: [PATCH 3/7] Add a function for identifying NVDIMM namespaces | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/udev.py | 9 +++++++++ | ||||
|  1 file changed, 9 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/udev.py b/blivet/udev.py
 | ||||
| index 6936a230..69e12357 100644
 | ||||
| --- a/blivet/udev.py
 | ||||
| +++ b/blivet/udev.py
 | ||||
| @@ -914,3 +914,12 @@ def device_get_fcoe_identifier(info):
 | ||||
|      if device_is_fcoe(info) and len(path_components) >= 4 and \ | ||||
|         path_components[2] == 'fc': | ||||
|          return path_components[3] | ||||
| +
 | ||||
| +
 | ||||
| +def device_is_nvdimm_namespace(info):
 | ||||
| +    if info.get("DEVTYPE") != "disk":
 | ||||
| +        return False
 | ||||
| +
 | ||||
| +    devname = info.get("DEVNAME", "")
 | ||||
| +    ninfo = blockdev.nvdimm_namespace_get_devname(devname)
 | ||||
| +    return ninfo is not None
 | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,32 +0,0 @@ | ||||
| From 39aa7041481f6e5cf954e67661f2cb55d43f9441 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 8 Mar 2018 11:40:48 -0500 | ||||
| Subject: [PATCH] Allow device specification by node to udev.get_device. | ||||
|  (#1524700) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/udev.py | 7 +++++-- | ||||
|  1 file changed, 5 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/udev.py b/blivet/udev.py
 | ||||
| index 6936a230..6eb7dab0 100644
 | ||||
| --- a/blivet/udev.py
 | ||||
| +++ b/blivet/udev.py
 | ||||
| @@ -56,9 +56,12 @@ def device_to_dict(device):
 | ||||
|      return result | ||||
|   | ||||
|   | ||||
| -def get_device(sysfs_path):
 | ||||
| +def get_device(sysfs_path=None, device_node=None):
 | ||||
|      try: | ||||
| -        device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
 | ||||
| +        if sysfs_path is not None:
 | ||||
| +            device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
 | ||||
| +        elif device_node is not None:
 | ||||
| +            device = pyudev.Devices.from_device_file(global_udev, device_node)
 | ||||
|      except pyudev.DeviceNotFoundError as e: | ||||
|          log.error(e) | ||||
|          result = None | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,100 +0,0 @@ | ||||
| From 6ae475fb80cdf1dd7f527ed0b952c613a5825ec3 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Feb 2018 14:58:12 +0100 | ||||
| Subject: [PATCH 4/7] Add 'NVDIMMNamespaceDevice' device representing NVDIMM | ||||
|  namespaces | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/devices/__init__.py |  2 +- | ||||
|  blivet/devices/disk.py     | 51 ++++++++++++++++++++++++++++++++++++++++++++-- | ||||
|  2 files changed, 50 insertions(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/__init__.py b/blivet/devices/__init__.py
 | ||||
| index 5bae1cbe..aaad30c3 100644
 | ||||
| --- a/blivet/devices/__init__.py
 | ||||
| +++ b/blivet/devices/__init__.py
 | ||||
| @@ -22,7 +22,7 @@
 | ||||
|  from .lib import device_path_to_name, device_name_to_disk_by_path, ParentList | ||||
|  from .device import Device | ||||
|  from .storage import StorageDevice | ||||
| -from .disk import DiskDevice, DiskFile, DMRaidArrayDevice, MultipathDevice, iScsiDiskDevice, FcoeDiskDevice, DASDDevice, ZFCPDiskDevice
 | ||||
| +from .disk import DiskDevice, DiskFile, DMRaidArrayDevice, MultipathDevice, iScsiDiskDevice, FcoeDiskDevice, DASDDevice, ZFCPDiskDevice, NVDIMMNamespaceDevice
 | ||||
|  from .partition import PartitionDevice | ||||
|  from .dm import DMDevice, DMLinearDevice, DMCryptDevice, DM_MAJORS | ||||
|  from .luks import LUKSDevice | ||||
| diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
 | ||||
| index 26448640..dc796cf0 100644
 | ||||
| --- a/blivet/devices/disk.py
 | ||||
| +++ b/blivet/devices/disk.py
 | ||||
| @@ -63,7 +63,7 @@ class DiskDevice(StorageDevice):
 | ||||
|      def __init__(self, name, fmt=None, | ||||
|                   size=None, major=None, minor=None, sysfs_path='', | ||||
|                   parents=None, serial=None, vendor="", model="", bus="", wwn=None, | ||||
| -                 exists=True):
 | ||||
| +                 uuid=None, exists=True):
 | ||||
|          """ | ||||
|              :param name: the device name (generally a device node's basename) | ||||
|              :type name: str | ||||
| @@ -96,7 +96,7 @@ class DiskDevice(StorageDevice):
 | ||||
|                                 major=major, minor=minor, exists=exists, | ||||
|                                 sysfs_path=sysfs_path, parents=parents, | ||||
|                                 serial=serial, model=model, | ||||
| -                               vendor=vendor, bus=bus)
 | ||||
| +                               vendor=vendor, bus=bus, uuid=uuid)
 | ||||
|   | ||||
|          self.wwn = wwn or None | ||||
|   | ||||
| @@ -660,3 +660,50 @@ class DASDDevice(DiskDevice):
 | ||||
|                                              ":".join(opts))]) | ||||
|          else: | ||||
|              return set(["rd.dasd=%s" % self.busid]) | ||||
| +
 | ||||
| +
 | ||||
| +class NVDIMMNamespaceDevice(DiskDevice):
 | ||||
| +
 | ||||
| +    """ Non-volatile memory namespace """
 | ||||
| +    _type = "nvdimm"
 | ||||
| +
 | ||||
| +    def __init__(self, device, **kwargs):
 | ||||
| +        """
 | ||||
| +            :param name: the device name (generally a device node's basename)
 | ||||
| +            :type name: str
 | ||||
| +            :keyword exists: does this device exist?
 | ||||
| +            :type exists: bool
 | ||||
| +            :keyword size: the device's size
 | ||||
| +            :type size: :class:`~.size.Size`
 | ||||
| +            :keyword parents: a list of parent devices
 | ||||
| +            :type parents: list of :class:`StorageDevice`
 | ||||
| +            :keyword format: this device's formatting
 | ||||
| +            :type format: :class:`~.formats.DeviceFormat` or a subclass of it
 | ||||
| +            :keyword mode: mode of the namespace
 | ||||
| +            :type mode: str
 | ||||
| +            :keyword devname: name of the namespace (e.g. 'namespace0.0')
 | ||||
| +            :type devname: str
 | ||||
| +            :keyword sector_size: sector size of the namespace in sector mode
 | ||||
| +            :type sector_size: str
 | ||||
| +        """
 | ||||
| +        self.mode = kwargs.pop("mode")
 | ||||
| +        self.devname = kwargs.pop("devname")
 | ||||
| +        self.sector_size = kwargs.pop("sector_size")
 | ||||
| +
 | ||||
| +        DiskDevice.__init__(self, device, **kwargs)
 | ||||
| +
 | ||||
| +    def __repr__(self):
 | ||||
| +        s = DiskDevice.__repr__(self)
 | ||||
| +        s += ("  mode = %(mode)s  devname = %(devname)s" %
 | ||||
| +              {"mode": self.mode,
 | ||||
| +               "devname": self.devname})
 | ||||
| +        if self.sector_size:
 | ||||
| +            s += ("  sector size = %(sector_size)s" % {"sector_size": self.sector_size})
 | ||||
| +        return s
 | ||||
| +
 | ||||
| +    @property
 | ||||
| +    def description(self):
 | ||||
| +        return "NVDIMM namespace %(devname)s in %(mode)s mode exported as %(path)s" \
 | ||||
| +               % {'devname': self.devname,
 | ||||
| +                  'mode': self.mode,
 | ||||
| +                  'path': self.path}
 | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,32 +0,0 @@ | ||||
| From 9dfe3cfa695f788716655e51915dfb4fa9d8fcd6 Mon Sep 17 00:00:00 2001 | ||||
| From: Adam Williamson <awilliam@redhat.com> | ||||
| Date: Mon, 19 Mar 2018 16:48:38 -0700 | ||||
| Subject: [PATCH] Don't use a 'wwn' kwarg for MDBiosRaidArrayDevice (#1557957) | ||||
| 
 | ||||
| MDBiosRaidArrayDevice's parent class doesn't take a 'wwn' kwarg, | ||||
| so the populator for it shouldn't pass one. | ||||
| 
 | ||||
| For more details, see comment 15 on the bug. | ||||
| 
 | ||||
| Resolves: rhbz#1557957 | ||||
| 
 | ||||
| Signed-off-by: Adam Williamson <awilliam@redhat.com> | ||||
| ---
 | ||||
|  blivet/populator/helpers/disk.py | 1 + | ||||
|  1 file changed, 1 insertion(+) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py
 | ||||
| index e2757b12..6c03f698 100644
 | ||||
| --- a/blivet/populator/helpers/disk.py
 | ||||
| +++ b/blivet/populator/helpers/disk.py
 | ||||
| @@ -172,6 +172,7 @@ class MDBiosRaidDevicePopulator(DiskDevicePopulator):
 | ||||
|          del kwargs["serial"] | ||||
|          del kwargs["vendor"] | ||||
|          del kwargs["bus"] | ||||
| +        del kwargs["wwn"]
 | ||||
|          return kwargs | ||||
|   | ||||
|   | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,69 +0,0 @@ | ||||
| From 5251f696f0bd8a68efde2df7c4dc948c4494ac60 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 7 Feb 2018 15:00:25 +0100 | ||||
| Subject: [PATCH 5/7] Add populator helper for NVDIMM namespaces | ||||
| 
 | ||||
| Helper for adding block-like NVDIMM namespaces to the devicetree. | ||||
| ---
 | ||||
|  blivet/populator/helpers/__init__.py |  2 +- | ||||
|  blivet/populator/helpers/disk.py     | 27 ++++++++++++++++++++++++++- | ||||
|  2 files changed, 27 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/__init__.py b/blivet/populator/helpers/__init__.py
 | ||||
| index 861426c6..dd23475a 100644
 | ||||
| --- a/blivet/populator/helpers/__init__.py
 | ||||
| +++ b/blivet/populator/helpers/__init__.py
 | ||||
| @@ -6,7 +6,7 @@ from .formatpopulator import FormatPopulator
 | ||||
|   | ||||
|  from .btrfs import BTRFSFormatPopulator | ||||
|  from .boot import AppleBootFormatPopulator, EFIFormatPopulator, MacEFIFormatPopulator | ||||
| -from .disk import DiskDevicePopulator, iScsiDevicePopulator, FCoEDevicePopulator, MDBiosRaidDevicePopulator, DASDDevicePopulator, ZFCPDevicePopulator
 | ||||
| +from .disk import DiskDevicePopulator, iScsiDevicePopulator, FCoEDevicePopulator, MDBiosRaidDevicePopulator, DASDDevicePopulator, ZFCPDevicePopulator, NVDIMMNamespaceDevicePopulator
 | ||||
|  from .disklabel import DiskLabelFormatPopulator | ||||
|  from .dm import DMDevicePopulator | ||||
|  from .dmraid import DMRaidFormatPopulator | ||||
| diff --git a/blivet/populator/helpers/disk.py b/blivet/populator/helpers/disk.py
 | ||||
| index e2757b12..ae4a7d28 100644
 | ||||
| --- a/blivet/populator/helpers/disk.py
 | ||||
| +++ b/blivet/populator/helpers/disk.py
 | ||||
| @@ -28,7 +28,7 @@ from gi.repository import BlockDev as blockdev
 | ||||
|  from ... import udev | ||||
|  from ... import util | ||||
|  from ...devices import DASDDevice, DiskDevice, FcoeDiskDevice, iScsiDiskDevice | ||||
| -from ...devices import MDBiosRaidArrayDevice, ZFCPDiskDevice
 | ||||
| +from ...devices import MDBiosRaidArrayDevice, ZFCPDiskDevice, NVDIMMNamespaceDevice
 | ||||
|  from ...devices import device_path_to_name | ||||
|  from ...storage_log import log_method_call | ||||
|  from .devicepopulator import DevicePopulator | ||||
| @@ -214,3 +214,28 @@ class ZFCPDevicePopulator(DiskDevicePopulator):
 | ||||
|   | ||||
|          log.info("%s is a zfcp device", udev.device_get_name(self.data)) | ||||
|          return kwargs | ||||
| +
 | ||||
| +
 | ||||
| +class NVDIMMNamespaceDevicePopulator(DiskDevicePopulator):
 | ||||
| +    priority = 20
 | ||||
| +
 | ||||
| +    _device_class = NVDIMMNamespaceDevice
 | ||||
| +
 | ||||
| +    @classmethod
 | ||||
| +    def match(cls, data):
 | ||||
| +        return (super(NVDIMMNamespaceDevicePopulator, NVDIMMNamespaceDevicePopulator).match(data) and
 | ||||
| +                udev.device_is_nvdimm_namespace(data))
 | ||||
| +
 | ||||
| +    def _get_kwargs(self):
 | ||||
| +        kwargs = super(NVDIMMNamespaceDevicePopulator, self)._get_kwargs()
 | ||||
| +
 | ||||
| +        from ...static_data import nvdimm
 | ||||
| +        ninfo = nvdimm.get_namespace_info(self.data.get("DEVNAME"))
 | ||||
| +
 | ||||
| +        kwargs["mode"] = blockdev.nvdimm_namespace_get_mode_str(ninfo.mode)
 | ||||
| +        kwargs["devname"] = ninfo.dev
 | ||||
| +        kwargs["uuid"] = ninfo.uuid
 | ||||
| +        kwargs["sector_size"] = ninfo.sector_size
 | ||||
| +
 | ||||
| +        log.info("%s is an NVDIMM namespace device", udev.device_get_name(self.data))
 | ||||
| +        return kwargs
 | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
| @ -1,40 +0,0 @@ | ||||
| From d4792dd0d2824eedbcf8cd8d28434ed8f6e938dc Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Tue, 13 Mar 2018 14:46:32 +0100 | ||||
| Subject: [PATCH 7/7] Add 'nvdimm' tag for NVDIMM namespaces | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/devices/disk.py | 4 ++++ | ||||
|  blivet/devices/lib.py  | 1 + | ||||
|  2 files changed, 5 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
 | ||||
| index dc796cf0..9021126c 100644
 | ||||
| --- a/blivet/devices/disk.py
 | ||||
| +++ b/blivet/devices/disk.py
 | ||||
| @@ -692,6 +692,10 @@ class NVDIMMNamespaceDevice(DiskDevice):
 | ||||
|   | ||||
|          DiskDevice.__init__(self, device, **kwargs) | ||||
|   | ||||
| +        self._clear_local_tags()
 | ||||
| +        self.tags.add(Tags.local)
 | ||||
| +        self.tags.add(Tags.nvdimm)
 | ||||
| +
 | ||||
|      def __repr__(self): | ||||
|          s = DiskDevice.__repr__(self) | ||||
|          s += ("  mode = %(mode)s  devname = %(devname)s" % | ||||
| diff --git a/blivet/devices/lib.py b/blivet/devices/lib.py
 | ||||
| index 70b769a4..021f2cfd 100644
 | ||||
| --- a/blivet/devices/lib.py
 | ||||
| +++ b/blivet/devices/lib.py
 | ||||
| @@ -31,6 +31,7 @@ LINUX_SECTOR_SIZE = Size(512)
 | ||||
|  class Tags(str, Enum): | ||||
|      """Tags that describe various classes of disk.""" | ||||
|      local = 'local' | ||||
| +    nvdimm = 'nvdimm'
 | ||||
|      remote = 'remote' | ||||
|      removable = 'removable' | ||||
|      ssd = 'ssd' | ||||
| -- 
 | ||||
| 2.14.3 | ||||
| 
 | ||||
							
								
								
									
										30
									
								
								530.patch
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								530.patch
									
									
									
									
									
								
							| @ -1,30 +0,0 @@ | ||||
| From 67d36789c8ff88b4ba14da7022f63b6831d75da3 Mon Sep 17 00:00:00 2001 | ||||
| From: Adam Williamson <awilliam@redhat.com> | ||||
| Date: Thu, 22 Dec 2016 15:09:47 -0800 | ||||
| Subject: [PATCH] Shallow copy another alignment property (#1408282) | ||||
| 
 | ||||
| Several blivet classes use custom __deepcopy__ methods to avoid | ||||
| deep copying some parted objects which we know can't be deep | ||||
| copied. Unfortunately the list of attributes excepted from deep | ||||
| copying for `DiskLabel` was missing one parted Alignment object, | ||||
| and with Python 3.6, we blow up trying to deepcopy that. This | ||||
| fixes the problem by adding that attribute to the list of ones | ||||
| we know have to be shallow copied. | ||||
| ---
 | ||||
|  blivet/formats/disklabel.py | 3 ++- | ||||
|  1 file changed, 2 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
 | ||||
| index f6b9d83..2dad706 100644
 | ||||
| --- a/blivet/formats/disklabel.py
 | ||||
| +++ b/blivet/formats/disklabel.py
 | ||||
| @@ -90,7 +90,8 @@ def __deepcopy__(self, memo):
 | ||||
|              We can't do copy.deepcopy on parted objects, which is okay. | ||||
|          """ | ||||
|          return util.variable_copy(self, memo, | ||||
| -                                  shallow=('_parted_device', '_optimal_alignment', '_minimal_alignment',),
 | ||||
| +                                  shallow=('_parted_device', '_optimal_alignment', '_minimal_alignment',
 | ||||
| +                                           '_disk_label_alignment'),
 | ||||
|                                    duplicate=('_parted_disk', '_orig_parted_disk')) | ||||
|   | ||||
|      def __repr__(self): | ||||
| @ -21,9 +21,9 @@ Name: python-blivet | ||||
| Url: https://storageapis.wordpress.com/projects/blivet | ||||
| Version: 3.1.0 | ||||
| 
 | ||||
| %global prerelease .b1 | ||||
| %global prerelease .b2 | ||||
| # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 | ||||
| Release: 0.4%{?prerelease}%{?dist} | ||||
| Release: 0.1%{?prerelease}%{?dist} | ||||
| Epoch: 1 | ||||
| License: LGPLv2+ | ||||
| Group: System Environment/Libraries | ||||
| @ -191,6 +191,30 @@ configuration. | ||||
| %endif | ||||
| 
 | ||||
| %changelog | ||||
| * Mon Jul 30 2018 David Lehman <dlehman@redhat.com> - 3.1.0-0.1.b2 | ||||
| - Do not ignore "Image out-of-sync" internal LVs (vtrefny) | ||||
| - Fixed error message when slave is missing (japokorn) | ||||
| - Ensure WWNs are set for multipath and dmraid. (dlehman) | ||||
| - Use ID_WWN_WITH_EXTENSION for WWNs. (dlehman) | ||||
| - Ignore pylint error "bad-option-value" for new pylint errors (vtrefny) | ||||
| - Fix errors found by new pylint 2.0.0 (vtrefny) | ||||
| - Fix caching logic in ExternalResource. (dlehman) | ||||
| - Use DiskFile to allow testing missing dependencies as non-root. (dlehman) | ||||
| - Restore availability caching after disabling for tests. (dlehman) | ||||
| - Preserve original blockdev plugin list in test cleanup. (dlehman) | ||||
| - Fix positional/key-word arguments in util.Path (vtrefny) | ||||
| - fix doc for is_s390() (dan) | ||||
| - The key size of LUKS should be 0 by default (vponcova) | ||||
| - Do not use rpm to check for Zanata client (vtrefny) | ||||
| - Fixed create_device fail behavior (japokorn) | ||||
| - Fixed KS forcing zerombr onto RO disk (japokorn) | ||||
| - Fix BIOS device number regex in edd module. (#1552236) (dlehman) | ||||
| - Shrink devices before growing others with common ancestors. (#1539422) (dlehman) | ||||
| - Do not copy ksdata. (rvykydal) | ||||
| - Find and remove stale LVM metadata immediately after creating md array. (dlehman) | ||||
| - Adapt mock imports for compatibility w/ python2 & python3. (dlehman) | ||||
| - Use py2-compatible syntax to get system architecture. (dlehman) | ||||
| 
 | ||||
| * Tue Jul 17 2018 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-0.4.b1 | ||||
| - Force command line based libblockdev LVM plugin (vtrefny) | ||||
| 
 | ||||
|  | ||||
| @ -1,40 +0,0 @@ | ||||
| From 7ef50d3b7061353838e44c8dc202eb5f6b012f40 Mon Sep 17 00:00:00 2001 | ||||
| From: Vratislav Podzimek <vpodzime@redhat.com> | ||||
| Date: Thu, 4 May 2017 13:03:06 +0200 | ||||
| Subject: [PATCH] Look the disk up for a partition by name not sys_name | ||||
| 
 | ||||
| udev.device_get_partition_disk() returns the device name as given | ||||
| by device_get_name() not sys_name. So when trying to find a match | ||||
| we need to compare it to the same value for devices we iterate | ||||
| over. | ||||
| 
 | ||||
| Also don't call resolve_devspec() on the returned value, | ||||
| udev.device_get_partition_disk() is already doing it. | ||||
| 
 | ||||
| Resolves: rhbz#1445302 | ||||
| ---
 | ||||
|  blivet/populator/helpers/partition.py | 8 ++++---- | ||||
|  1 file changed, 4 insertions(+), 4 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/partition.py b/blivet/populator/helpers/partition.py
 | ||||
| index 617b5e7..73b15f1 100644
 | ||||
| --- a/blivet/populator/helpers/partition.py
 | ||||
| +++ b/blivet/populator/helpers/partition.py
 | ||||
| @@ -57,13 +57,13 @@ def run(self):
 | ||||
|                  return device | ||||
|   | ||||
|          disk = None | ||||
| -        sys_name = udev.device_get_partition_disk(self.data)
 | ||||
| -        if sys_name:
 | ||||
| -            disk_name = udev.resolve_devspec(sys_name)
 | ||||
| +        disk_name = udev.device_get_partition_disk(self.data)
 | ||||
| +        if disk_name:
 | ||||
|              disk = self._devicetree.get_device_by_name(disk_name) | ||||
|              if disk is None: | ||||
|                  # create a device instance for the disk | ||||
| -                disk_info = next((i for i in udev.get_devices() if i.sys_name == sys_name), None)
 | ||||
| +                disk_info = next((i for i in udev.get_devices()
 | ||||
| +                                  if udev.device_get_name(i) == disk_name), None)
 | ||||
|                  if disk_info is not None: | ||||
|                      self._devicetree.handle_device(disk_info) | ||||
|                      disk = self._devicetree.get_device_by_name(disk_name) | ||||
							
								
								
									
										2
									
								
								sources
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								sources
									
									
									
									
									
								
							| @ -1 +1 @@ | ||||
| SHA512 (blivet-3.1.0.b1.tar.gz) = 8766ada8cf3779047a4c4ad49eb348422e56195cb5135aa0d68c63b54ca76b0010138a457123ac5969b259abe7a6c4b927c1fd317f0f9084b3da4229e19715ee | ||||
| SHA512 (blivet-3.1.0.b2.tar.gz) = a9e24b3be6961d7f27a43ebc3ab41629065969bda5b7f1f33c5c47441cd268f181e3459ffbdfee7af6ee71d9b8d3e2f130cff0ceb88c5bd861c57bded406a3e4 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user