Merge "Check share network for share groups before deletion"
This commit is contained in:
commit
2c95d47b97
@ -92,6 +92,15 @@ class ShareNetworkSubnetController(wsgi.Controller,
|
||||
LOG.error(msg)
|
||||
raise exc.HTTPConflict(explanation=msg)
|
||||
|
||||
share_groups = db_api.share_group_get_all_by_share_server(
|
||||
context, share_server['id'])
|
||||
if share_groups:
|
||||
msg = _("Cannot delete share network subnet %(id)s, it has "
|
||||
"one or more share groups.") % {
|
||||
'id': share_network_subnet_id}
|
||||
LOG.error(msg)
|
||||
raise exc.HTTPConflict(explanation=msg)
|
||||
|
||||
# NOTE(silvacarlose): Do not allow the deletion of any share server
|
||||
# if any of them has the flag is_auto_deletable = False
|
||||
if not self._all_share_servers_are_auto_deletable(
|
||||
|
@ -1142,7 +1142,9 @@ class ShareServer(BASE, ManilaBase):
|
||||
'ShareInstance.deleted == "False")')
|
||||
|
||||
share_groups = orm.relationship(
|
||||
"ShareGroup", backref='share_server', primaryjoin='and_('
|
||||
"ShareGroup",
|
||||
backref='share_server',
|
||||
primaryjoin='and_('
|
||||
'ShareServer.id == ShareGroup.share_server_id,'
|
||||
'ShareGroup.deleted == "False")')
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed an issue that allowed share network subnets to be deleted when they
|
||||
were still related to a share group. An exception will now be raised when
|
||||
Manila identify such existing relationship. For more details, please refer
|
||||
to `Launchpad Bug 2004212 <https://bugs.launchpad.net/manila/+bug/2004212>`_.
|
Loading…
Reference in New Issue
Block a user