Skip to content

Commit

Permalink
Merge pull request #1172 from vojtechtrefny/3.9-devel_nvdimm-remove
Browse files Browse the repository at this point in the history
Remove support for NVDIMM namespaces
  • Loading branch information
vojtechtrefny authored Dec 4, 2023
2 parents 9889ff7 + 51e10c0 commit 4957d84
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 335 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ To install these dependencies use following commands:
# dnf install python3-blockdev libblockdev-plugins-all python3-bytesize libbytesize python3-pyparted parted libselinux-python3
* On Debian and Ubuntu based distributions:

# apt-get install python3-blockdev python3-bytesize python3-parted python3-selinux gir1.2-blockdev-3.0 libblockdev-lvm3 libblockdev-btrfs3 libblockdev-swap3 libblockdev-loop3 libblockdev-crypto3 libblockdev-mpath3 libblockdev-dm3 libblockdev-mdraid3 libblockdev-nvdimm3 libblockdev-fs3
# apt-get install python3-blockdev python3-bytesize python3-parted python3-selinux gir1.2-blockdev-3.0 libblockdev-lvm3 libblockdev-btrfs3 libblockdev-swap3 libblockdev-loop3 libblockdev-crypto3 libblockdev-mpath3 libblockdev-dm3 libblockdev-mdraid3 libblockdev-fs3

### Development

Expand Down
4 changes: 2 additions & 2 deletions blivet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def log_bd_message(level, msg):
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", "nvdimm", "nvme", "fs"))
_REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvme", "fs"))
else:
_REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm", "nvme", "fs"))
_REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvme", "fs"))

_requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES)
try:
Expand Down
2 changes: 1 addition & 1 deletion blivet/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, MultipathDevice, iScsiDiskDevice, FcoeDiskDevice, DASDDevice, ZFCPDiskDevice, NVDIMMNamespaceDevice, NVMeNamespaceDevice, NVMeFabricsNamespaceDevice
from .disk import DiskDevice, DiskFile, MultipathDevice, iScsiDiskDevice, FcoeDiskDevice, DASDDevice, ZFCPDiskDevice, NVMeNamespaceDevice, NVMeFabricsNamespaceDevice
from .partition import PartitionDevice
from .dm import DMDevice, DMLinearDevice, DMCryptDevice, DMIntegrityDevice, DM_MAJORS
from .luks import LUKSDevice, IntegrityDevice
Expand Down
57 changes: 0 additions & 57 deletions blivet/devices/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,63 +586,6 @@ def dracut_setup_args(self):
return set(["rd.dasd=%s" % self.busid])


class NVDIMMNamespaceDevice(DiskDevice):

""" Non-volatile memory namespace """
_type = "nvdimm"
_packages = ["ndctl"]

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.id_path = kwargs.pop("id_path")
self._sector_size = kwargs.pop("sector_size")

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" %
{"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}

@property
def sector_size(self):
return self._sector_size


NVMeController = namedtuple("NVMeController", ["name", "serial", "nvme_ver", "id", "subsysnqn",
"transport", "transport_address"])

Expand Down
1 change: 0 additions & 1 deletion blivet/devices/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
class Tags(str, Enum):
"""Tags that describe various classes of disk."""
local = 'local'
nvdimm = 'nvdimm'
nvme = 'nvme'
remote = 'remote'
removable = 'removable'
Expand Down
2 changes: 1 addition & 1 deletion blivet/populator/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from .btrfs import BTRFSFormatPopulator
from .boot import EFIFormatPopulator, MacEFIFormatPopulator
from .disk import DiskDevicePopulator, iScsiDevicePopulator, FCoEDevicePopulator, MDBiosRaidDevicePopulator, DASDDevicePopulator, ZFCPDevicePopulator, NVDIMMNamespaceDevicePopulator, NVMeNamespaceDevicePopulator, NVMeFabricsNamespaceDevicePopulator
from .disk import DiskDevicePopulator, iScsiDevicePopulator, FCoEDevicePopulator, MDBiosRaidDevicePopulator, DASDDevicePopulator, ZFCPDevicePopulator, NVMeNamespaceDevicePopulator, NVMeFabricsNamespaceDevicePopulator
from .disklabel import DiskLabelFormatPopulator
from .dm import DMDevicePopulator
from .loop import LoopDevicePopulator
Expand Down
28 changes: 1 addition & 27 deletions blivet/populator/helpers/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from ... import udev
from ... import util
from ...devices import DASDDevice, DiskDevice, FcoeDiskDevice, iScsiDiskDevice
from ...devices import MDBiosRaidArrayDevice, ZFCPDiskDevice, NVDIMMNamespaceDevice
from ...devices import MDBiosRaidArrayDevice, ZFCPDiskDevice
from ...devices import NVMeNamespaceDevice, NVMeFabricsNamespaceDevice
from ...devices import device_path_to_name
from ...storage_log import log_method_call
Expand Down Expand Up @@ -230,32 +230,6 @@ def _get_kwargs(self):
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
kwargs["id_path"] = udev.device_get_path(self.data)

log.info("%s is an NVDIMM namespace device", udev.device_get_name(self.data))
return kwargs


class NVMeNamespaceDevicePopulator(DiskDevicePopulator):
priority = 20

Expand Down
1 change: 0 additions & 1 deletion blivet/static_data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .lvm_info import lvs_info, pvs_info, vgs_info
from .luks_data import luks_data
from .mpath_info import mpath_members
from .nvdimm import nvdimm
from .stratis_info import stratis_info
153 changes: 0 additions & 153 deletions blivet/static_data/nvdimm.py

This file was deleted.

14 changes: 0 additions & 14 deletions blivet/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,20 +1037,6 @@ def device_get_fcoe_identifier(info):
return path_components[3]


def device_is_nvdimm_namespace(info):
if info.get("DEVTYPE") != "disk":
return False

if not blockdev.is_plugin_available(blockdev.Plugin.NVDIMM):
# nvdimm plugin is not available -- even if this is an nvdimm device we
# don't have tools to work with it, so we should pretend it's just a disk
return False

devname = info.get("DEVNAME", "")
ninfo = blockdev.nvdimm_namespace_get_devname(devname)
return ninfo is not None


def device_is_nvme_namespace(info):
if info.get("DEVTYPE") != "disk":
return False
Expand Down
Loading

0 comments on commit 4957d84

Please sign in to comment.