Comment 2 for bug 2015328

Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

Hi,

Commenting back here to retain the "low-hanging-fruit" tag on this bug. In the fix, the code must check if the reset_replica_state action is being run against an "active" replica.

In https://review.opendev.org/c/openstack/manila/+/857980/3/manila/api/openstack/wsgi.py#1267 ; we're introducing a "get" operation in the mix, so we'd have the data to verify the existing replica_state; so we'd need to add the following validation:

  if (status_attr == 'replica_state'
          and resource['replica_state'] == constants.REPLICA_STATE_ACTIVE):
     msg = _("Cannot reset replica_state of active replica")
     raise webob.exc.HTTPBadRequest(explanation=msg)