Pyontapi 0.3.2 documentation

Multi-Filer configuration

«  Getting started   ::   Contents   ::   API Reference  »

Multi-Filer configuration

Changed in version 0.2.2: The syntax for the settings dictionary changed in version 0.2.2. Please update your configuration file as explained below.

If you have more than one filer in your environment and want to use the pyontapi library in your program to do tasks like creating snapshots, you may want to use the pyontapi multi-filer interface.

Roles and Filer-specific Roles

New in version 0.2.2.

In complex storage environments you may want to have different roles for different capabilities on your storage systems. For example, you may want to have a special role that is allowed to delete volumes.

In the NA_CONFIG dictionary you can define the following parameters:

  • roles: Here you can define your roles. You must define the default role and may have additional roles here, for example a role super-role where you have a different user and a special password. A special role overwrites the settings of the default role.
  • filer-roles: The filer-roles allow you to overwrite the default roles for specific filers. For example you have four filers in your environment and one DFM. With the filer-specific roles you can overwrite the settings for all roles (default or special roles) only for this filer by defining a filer-role (‘netapp-dfm1’ in the example below).

An example NA_CONFIG dictionary may look like the following:

NA_CONFIG = {
    'roles': {
        'default': {
            'user': 'root',
            'password': 'secret',
            'style': 'LOGIN',
        },
        'my-fancy-role': {
            # now I have super cow powers
            'password': 'toptoptop-secret',
        },
    },

    'filer-roles': {

        'netapp-dfm1': {
            # settings for a dfm system called netapp-dfm1
            'default': {
                'server_type': 'DFM',
            },
        },
    },
}

Preferably you define the NA_CONFIG dictionary in the local_settings.py file in the pyontapi folder. If you want to define your configuration somewhere else, you need to run the following command anywhere in your code before invoking the first API command on a filer:

from schtob.pyontapi import Filers
Filers.setup_config(my_configuration)

Using the schtob.pyontapi.Filers object

Once you have defined your configuration, you can access any filer in your environment through the schtob.pyontapi.Filers object like this:

>>> from schtob.pyontapi import Filers, errors
>>> try:
...     result = Filers('filer-name').system.get_ontapi_version()
... except errors.APIFailure, exc:
...     print exc.get_error()
...
>>> print result
{'major-version': 1, 'minor-version': 9}

The schtob.pyontapi.Filers object accepts the role as second parameter:

>>> from schtob.pyontapi import Filers, errors
>>> filer = Filers('netapp-filer-1', 'special-role')

This means that you have connected to the filer using some special configuration parameters that you have defined in your settings file.

«  Getting started   ::   Contents   ::   API Reference  »