Skip to content

iSNS

Internet Storage Name Service (iSNS) — a discovery protocol for iSCSI and FC storage networks. Wraps the isnsadm CLI for registering and querying storage services.

sts.isns

iSNS (Internet Storage Name Service) client configuration and isnsadm wrapper.

IsnsAdm pydantic-model

Bases: StsBaseModel

Wrapper for the isnsadm command-line tool.

Attributes:

Name Type Description
debug str | None

Debug level passed to isnsadm via --debug.

Show JSON schema:
{
  "additionalProperties": false,
  "description": "Wrapper for the ``isnsadm`` command-line tool.\n\nAttributes:\n    debug: Debug level passed to isnsadm via ``--debug``.",
  "properties": {
    "debug": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Debug"
    }
  },
  "title": "IsnsAdm",
  "type": "object"
}

Fields:

  • debug (str | None)
Source code in sts_libs/src/sts/isns.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
class IsnsAdm(StsBaseModel):
    """Wrapper for the ``isnsadm`` command-line tool.

    Attributes:
        debug: Debug level passed to isnsadm via ``--debug``.
    """

    CLI_NAME: ClassVar[str] = 'isnsadm'
    PACKAGE_NAME: ClassVar[str] = 'isns-utils'
    SERVICE_NAME: ClassVar[str] = 'isnsd'

    debug: str | None = None

    def _run(self, *args: str, **kwargs: str | None) -> CommandResult:
        """Run the isnsadm command."""
        command = [self.CLI_NAME]
        if self.debug:
            command.extend(['--debug', self.debug])
        if args:
            command.extend(args)
        if kwargs:
            for key, value in kwargs.items():
                if value is not None:
                    command.extend([f'{key},{value}'])

        return run(' '.join(command))

    def register(self, **kwargs: str | None) -> CommandResult:
        """Register objects with isnsadm."""
        return self._run('--register', **kwargs)

    def list_objects(self, *args: str) -> CommandResult:
        """List objects with isnsadm.

        Possible type names are: entities, nodes, portals, dds, ddsets, portal-groups, and policies.
        https://www.mankier.com/8/isnsadm
        """
        return self._run('--list', *args)

list_objects(*args)

List objects with isnsadm.

Possible type names are: entities, nodes, portals, dds, ddsets, portal-groups, and policies. https://www.mankier.com/8/isnsadm

Source code in sts_libs/src/sts/isns.py
63
64
65
66
67
68
69
def list_objects(self, *args: str) -> CommandResult:
    """List objects with isnsadm.

    Possible type names are: entities, nodes, portals, dds, ddsets, portal-groups, and policies.
    https://www.mankier.com/8/isnsadm
    """
    return self._run('--list', *args)

register(**kwargs)

Register objects with isnsadm.

Source code in sts_libs/src/sts/isns.py
59
60
61
def register(self, **kwargs: str | None) -> CommandResult:
    """Register objects with isnsadm."""
    return self._run('--register', **kwargs)

IsnsadmConf

Bases: Config

iSNS client configuration file (/etc/isns/isnsadm.conf).

Source code in sts_libs/src/sts/isns.py
22
23
24
25
26
27
28
29
class IsnsadmConf(Config):
    """iSNS client configuration file (``/etc/isns/isnsadm.conf``)."""

    CONFIG_PATH = Path('/etc/isns/isnsadm.conf')

    def __init__(self) -> None:
        """Initialize the IsnsadmConf instance."""
        super().__init__(self.CONFIG_PATH)

__init__()

Initialize the IsnsadmConf instance.

Source code in sts_libs/src/sts/isns.py
27
28
29
def __init__(self) -> None:
    """Initialize the IsnsadmConf instance."""
    super().__init__(self.CONFIG_PATH)