refactor: inherit StorageDriver instead of working around it

An OMV box is a NAS built on Debian, but this driver inherited LinuxDriver alone
and implemented the storage getters by name, because inheriting StorageDriver as
well would have let its NotImplementedError stubs shadow LinuxDriver's working
package and service methods. DEVICE_CLASS = "storage" then existed to tell
netOrk what the class hierarchy no longer said.

napalm-device-types v1.0 makes role bases declaration-only, so both roles can be
declared honestly and in the order that matters:

    class OpenMediaVaultDriver(StorageDriver, LinuxDriver):

device_class comes from that first base now, so DEVICE_CLASS is gone.
This commit is contained in:
Christian Manivong
2026-08-21 12:50:27 +07:00
parent 67939ace75
commit 0f57745725
2 changed files with 10 additions and 11 deletions
+10 -11
View File
@@ -33,26 +33,25 @@ from napalm_device_types.models import (
StorageServiceDict, StorageServiceDict,
VolumeSnapshotDict, VolumeSnapshotDict,
) )
from napalm_device_types import StorageDriver
from napalm_linux.linux import LinuxDriver from napalm_linux.linux import LinuxDriver
class OpenMediaVaultDriver(LinuxDriver): class OpenMediaVaultDriver(StorageDriver, LinuxDriver):
"""NAPALM driver for OpenMediaVault NAS systems. """NAPALM driver for OpenMediaVault NAS systems.
Inherits all Linux OS functionality from LinuxDriver (packages, Declares both roles it fills: a NAS built on Debian. Storage comes first,
services, users, processes, cron, Docker) and adds OMV-specific so netOrk shows it as storage rather than as a Linux host.
storage management capabilities.
NAS services are exposed via ``get_storage_services()`` to avoid a Inherits all Linux OS functionality from LinuxDriver (packages, services,
naming collision with LinuxDriver's ``get_services()`` (which returns users, processes, cron, Docker) -- OMV really is Debian, so apt applies --
the full systemd service list). and adds OMV-specific storage management on top.
NAS services are ``get_storage_services()``; the systemd service list stays
``get_services()``. Two names for two different things.
""" """
TYPE_LABEL = "Storage" TYPE_LABEL = "Storage"
# Declared outright: the driver inherits LinuxDriver for the OS surface, so
# the issubclass chain would otherwise classify an OMV NAS as "linux" and
# the UI would never render its Storage tab.
DEVICE_CLASS = "storage"
DRIVER_NAME = "openmediavault" DRIVER_NAME = "openmediavault"
driver_name = "openmediavault" driver_name = "openmediavault"
SSH_FINGERPRINT = [ SSH_FINGERPRINT = [