Add more association support to network API
Adds API support to: - Disassociate only host from network - Disassociate only project from network - Associate network with host (project already supported) New functionality is added to a new extension networks_associate, but the original networks extension is modified to allow networks_associate to extend how it needs to. The original behavior of the networks extension is preserved (no new functionality, nor change in existing behavior) in terms of the API presented. Bumps RPC API version for network RPC server version in order add the associate function which allows to both associate and disassociate a network with a host and or tenant. Has overlap with disassociate and add_network_to_project but these are kept for backwards compatibility DocImpact Implmenents: blueprint apis-for-nova-manage Change-Id: I78fd76e0696d1c872646355ab04d32f051551def
This commit is contained in:
@@ -785,9 +785,12 @@ def network_delete_safe(context, network_id):
|
||||
return IMPL.network_delete_safe(context, network_id)
|
||||
|
||||
|
||||
def network_disassociate(context, network_id):
|
||||
"""Disassociate the network from project or raise if it does not exist."""
|
||||
return IMPL.network_disassociate(context, network_id)
|
||||
def network_disassociate(context, network_id, disassociate_host=True,
|
||||
disassociate_project=True):
|
||||
"""Disassociate the network from project or host and raise if it does
|
||||
not exist."""
|
||||
return IMPL.network_disassociate(context, network_id, disassociate_host,
|
||||
disassociate_project)
|
||||
|
||||
|
||||
def network_get(context, network_id, project_only="allow_none"):
|
||||
|
||||
@@ -2135,9 +2135,14 @@ def network_delete_safe(context, network_id):
|
||||
|
||||
|
||||
@require_admin_context
|
||||
def network_disassociate(context, network_id):
|
||||
network_update(context, network_id, {'project_id': None,
|
||||
'host': None})
|
||||
def network_disassociate(context, network_id, disassociate_host,
|
||||
disassociate_project):
|
||||
net_update = {}
|
||||
if disassociate_project:
|
||||
net_update['project_id'] = None
|
||||
if disassociate_host:
|
||||
net_update['host'] = None
|
||||
network_update(context, network_id, net_update)
|
||||
|
||||
|
||||
@require_context
|
||||
|
||||
Reference in New Issue
Block a user