Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- fix allocations_get missing query argument
- fix manila period task authentication issue
  • Loading branch information
zhenz committed Aug 8, 2022
1 parent d285bc9 commit 4216bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion blazar/api/v1/networks/v1_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def allocations_list(req, query, detail=False):
return api_utils.render(allocations=_api.list_allocations(query))


@rest.get('/<network_id>/allocation')
@rest.get('/<network_id>/allocation', query=True)
@validation.check_exists(_api.get_network, network_id='network_id')
def allocations_get(req, network_id, query):
"""List all allocations on a specific network segment."""
Expand Down
14 changes: 7 additions & 7 deletions blazar/plugins/networks/storage_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class StoragePlugin():
def __init__(self):
super(StoragePlugin, self).__init__()
self.neutron_client = neutron.BlazarNeutronClient()
self.manila_client = manila.BlazarManilaClient()
# get ganesha subnetpool by name
ganesha_subnetpool = self.neutron_client.list_subnetpools(
name=CONF.network_storage.storage_subnetpool
Expand Down Expand Up @@ -134,8 +133,9 @@ def _get_ganesha_router_interfaces(self):
run_immediately=True
)
def _set_manila_share_access_rules(self, manager_obj, context):
manila_client = manila.BlazarManilaClient()
# get all available shares
shares = self.manila_client.shares.list(
shares = manila_client.shares.list(
search_opts={
"all_tenants": 1,
"share_type": CONF.network_storage.ceph_nfs_share_type,
Expand All @@ -148,7 +148,7 @@ def _set_manila_share_access_rules(self, manager_obj, context):
for share in shares:
try:
proj = share.project_id
access_rules = self.manila_client.shares.access_list(share.id)
access_rules = manila_client.shares.access_list(share.id)
existing_ip_to_rule_id = {
rule.access_to: rule.id for rule in access_rules
if rule.access_level == "rw"
Expand All @@ -158,11 +158,11 @@ def _set_manila_share_access_rules(self, manager_obj, context):
ips_to_add = set(new_ips).difference(existing_ips)
ips_to_delete = set(existing_ips).difference(new_ips)
for ip in ips_to_add:
self.manila_client.shares.allow(
manila_client.shares.allow(
share.id, "ip", ip, "rw"
)
for ip in ips_to_delete:
self.manila_client.shares.deny(
manila_client.shares.deny(
share.id, existing_ip_to_rule_id[ip]
)
# all users should have ro access to a public share
Expand All @@ -172,12 +172,12 @@ def _set_manila_share_access_rules(self, manager_obj, context):
]
if share.is_public and not existing_ro_rule_ids:
for prefix in self.ganesha_subnetpool["prefixes"]:
self.manila_client.shares.allow(
manila_client.shares.allow(
share.id, "ip", prefix, "ro"
)
if not share.is_public and existing_ro_rule_ids:
for rule_id in existing_ro_rule_ids:
self.manila_client.shares.deny(
manila_client.shares.deny(
share.id, rule_id
)
except Exception as e:
Expand Down

0 comments on commit 4216bf0

Please sign in to comment.