# openstack.block_storage.v2.service

## The Service Class

The `Service` class inherits from `Resource`.

class openstack.block_storage.v2.service.Service(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resources_key = 'services'

    Plural form of key for resource.

  base_path = '/os-services'

    The base part of the URI for this resource.

  allow_list = True

    Allow list operation for this resource.

  active_backend_id

    The ID of active storage backend (cinder-volume services only)

  availability_zone

    The availability zone of service

  binary

    Binary name of service

  disabled_reason

    Disabled reason of service

  host

    The name of the host where service runs

  name

    Service name

  replication_status

    The volume service replication status (cinder-volume services only)

  state

    State of service

  status

    Status of service

  updated_at

    The date and time when the resource was updated

  classmethod find(session, name_or_id, ignore_missing=True, list_base_path=None, *, microversion=None, all_projects=None, **params)

    Find a resource by its name or id.

    Parameters:

      - session (`Adapter`) – The session to use for making this request.

      - name_or_id – This resource’s identifier, if needed by the request. The default is `None`.

      - ignore_missing (bool) – When set to `False` `NotFoundException` will be raised when the resource does not exist. When set to `True`, None will be returned when attempting to find a nonexistent resource.

      - list_base_path (str) – base_path to be used when need listing resources.

      - microversion (str) – API version to override the negotiated one.

      - params (dict) – Any additional parameters to be passed into underlying methods, such as to `existing()` in order to pass on URI parameters.

    Returns:

      The `Resource` object matching the given name or id or None if nothing matches.

    Raises:

      `openstack.exceptions.DuplicateResource` if more than one resource is found for this request.

    Raises:

      `openstack.exceptions.NotFoundException` if nothing is found and ignore_missing is `False`.

  commit(session, prepend_key=False, *args, **kwargs)

    Commit the state of the instance to the remote resource.

    Parameters:

      - session (`Adapter`) – The session to use for making this request.

      - prepend_key – A boolean indicating whether the resource_key should be prepended in a resource update request. Default to True.

      - retry_on_conflict (bool) – Whether to enable retries on HTTP CONFLICT (409). Value of `None` leaves the Adapter defaults.

      - base_path (str) – Base part of the URI for modifying resources, if different from `base_path`.

      - microversion (str) – API version to override the negotiated one.

      - kwargs (dict) – Parameters that will be passed to _prepare_request()

    Returns:

      This `Resource` instance.

    Raises:

      `MethodNotSupported` if `Resource.allow_commit` is not set to `True`.

  enable(session)

    Enable service.

  disable(session, *, reason=None)

    Disable service.

  failover(session, *, backend_id=None)

    Failover a service

    Only applies to replicating cinder-volume services.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.