Only enforce multiattach policy for retype target

We should only be checking multiattach policy if the target
of a retype is multiattach capable. If they are already on
a type and policy has changed, we should not block retyping.

Change-Id: Id4cfb7771439940c59b828ea7f1d95bcfe7d1e26
This commit is contained in:
Sean McGinnis 2018-02-16 08:59:25 -06:00
parent 0841b40789
commit aea249f360

@ -1653,7 +1653,11 @@ class API(base.Base):
'of: %s.') % volume.status
LOG.info(msg)
raise exception.InvalidInput(reason=msg)
context.authorize(vol_policy.MULTIATTACH_POLICY)
# If they are retyping to a multiattach capable, make sure they
# are allowed to do so.
if tgt_is_multiattach:
context.authorize(vol_policy.MULTIATTACH_POLICY)
# We're checking here in so that we can report any quota issues as
# early as possible, but won't commit until we change the type. We