reset replica state not forbidden for active replica

Bug #2015328 reported by Maurice Escher
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
In Progress
Medium
Gray Lutalo

Bug Description

Hi,

what happened:

I had a share in a replication setup, A was my active replica (replica_state 'active'), B was my non-active replica (replica_state 'error', but the exact state doesn't matter).

I triggered 'manila share-replica-reset-state <ID_of_A>' (probably my good intention was to do something to get out of the error on B). By default this set the replica_state of A to 'out_of_sync'.

I ended up in a situation with no active replica left.
I expected some server side validation preventing me to do such a stupid thing ;)

Can a respective safeguard be implemented?

Thanks,
Maurice

P.S.:
The out_of_sync replica A went into replica_state error later during periodic replica update.
Another user deleted (with force option?) the replica A in error as part of a cleanup.
Ooops -> my share was gone, data lost.

Vida Haririan (vhariria)
Changed in manila:
importance: Undecided → Low
Vida Haririan (vhariria)
Changed in manila:
status: New → Incomplete
tags: added: low-hanging-fruit
Changed in manila:
status: Incomplete → New
importance: Low → Medium
Revision history for this message
Vida Haririan (vhariria) wrote :
Vida Haririan (vhariria)
Changed in manila:
status: New → Triaged
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)

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

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/manila/+/899320

Changed in manila:
status: Triaged → In Progress
Revision history for this message
Gray Lutalo (gray-00) wrote :
Changed in manila:
assignee: nobody → Gray Lutalo (gray-00)
assignee: Gray Lutalo (gray-00) → nobody
Changed in manila:
assignee: nobody → Gray Lutalo (gray-00)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.