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:
Binary file not shown.
@@ -33,26 +33,25 @@ from napalm_device_types.models import (
|
||||
StorageServiceDict,
|
||||
VolumeSnapshotDict,
|
||||
)
|
||||
from napalm_device_types import StorageDriver
|
||||
from napalm_linux.linux import LinuxDriver
|
||||
|
||||
|
||||
class OpenMediaVaultDriver(LinuxDriver):
|
||||
class OpenMediaVaultDriver(StorageDriver, LinuxDriver):
|
||||
"""NAPALM driver for OpenMediaVault NAS systems.
|
||||
|
||||
Inherits all Linux OS functionality from LinuxDriver (packages,
|
||||
services, users, processes, cron, Docker) and adds OMV-specific
|
||||
storage management capabilities.
|
||||
Declares both roles it fills: a NAS built on Debian. Storage comes first,
|
||||
so netOrk shows it as storage rather than as a Linux host.
|
||||
|
||||
NAS services are exposed via ``get_storage_services()`` to avoid a
|
||||
naming collision with LinuxDriver's ``get_services()`` (which returns
|
||||
the full systemd service list).
|
||||
Inherits all Linux OS functionality from LinuxDriver (packages, services,
|
||||
users, processes, cron, Docker) -- OMV really is Debian, so apt applies --
|
||||
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"
|
||||
# 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"
|
||||
SSH_FINGERPRINT = [
|
||||
|
||||
Reference in New Issue
Block a user