Comment 4 for bug 1821898

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinderlib (master)

Reviewed: https://review.opendev.org/648212
Committed: https://git.openstack.org/cgit/openstack/cinderlib/commit/?id=385e6f4a1ec5c382885321b3db9d80f26f66c117
Submitter: Zuul
Branch: master

commit 385e6f4a1ec5c382885321b3db9d80f26f66c117
Author: Gorka Eguileor <email address hidden>
Date: Wed Mar 27 19:46:05 2019 +0100

    Add support for IBM SVC

    When initializing IBM SVC with the memory persistence we get an exception:

      return IMPL.volume_get_all_by_host(context, host, filters=filters)
      AttributeError: 'DB' object has no attribute 'volume_get_all_by_host'

    The issue is caused by the SVC driver accessing the database directly,
    which is not considered good practice in Cinder nowadays.

    The problem with drivers using the DB directly is that cinderlib doesn't
    require a DB, it can work storing everything in memory. To facilitate
    storage of the resources' metadata cinderlib has its own persistence
    plugin mechanism, and has some ad-hoc "workarounds" in the DB class for
    drivers that access the DB directly.

    The IBM driver has the following DB dependencies:

    - volume_get_all_by_host when using objects.VolumeList.get_all_by_host

    - volume_type_get when using objects.VolumeType.get_by_name_or_id

    - volume_type_get_by_name when using
      objects.VolumeType.get_by_name_or_id

    - volume_get directly called by get_by_id when using
      objects.Volume.get_by_id

    - _group_type_get_full directly called by get_by_id when using
      objects.GroupType.get_by_id

    - volume_admin_metadata_get direct call

    - volume_admin_metadata_update direct call

    - volume_admin_metadata_delete direct call

    In cinderlib we don't currently support groups or consistency groups, so
    we don't need to implement `_group_type_get_full` and we have already
    implemented workaround for methods `volume_get` and `volume_type_get`,
    so this patch implements the remaining 5 methods volume_get_all_by_host,
    volume_type_get_by_name, volume_admin_metadata_get,
    volume_admin_metadata_update, and volume_admin_metadata_delete in the DB
    class.

    Closes-Bug: #1821898
    Change-Id: I94b4864c5823976f4a9cac2e40943b74aca4066e