Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-133687 / 25.04 / remove dead endpoint (unlock_services_restart_choices) #15447

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions src/middlewared/middlewared/plugins/pool_/unlock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from middlewared.plugins.zfs_.utils import zvol_name_to_path
from middlewared.schema import Dict, returns, Str
from middlewared.service import accepts, private, Service
from middlewared.service import private, Service

from .utils import dataset_mountpoint

Expand All @@ -10,36 +9,6 @@ class PoolDatasetService(Service):
class Config:
namespace = 'pool.dataset'

@accepts(Str('dataset'), roles=['DATASET_READ'])
@returns(Dict('services_to_restart', additional_attrs=True))
async def unlock_services_restart_choices(self, dataset):
"""
Get a mapping of services identifiers and labels that can be restart on dataset unlock.
"""
dataset_instance = await self.middleware.call('pool.dataset.get_instance_quick', dataset)
services = {
'cifs': 'SMB',
'ftp': 'FTP',
'iscsitarget': 'iSCSI',
'nfs': 'NFS',
}

result = {}
for k, v in services.items():
if await self.middleware.call('service.started_or_enabled', k):
result[k] = v

result.update({
k: services[k] for k in map(
lambda a: a['service'], await self.middleware.call('pool.dataset.attachments', dataset)
) if k in services
})

if await self.middleware.call('pool.dataset.unlock_restarted_vms', dataset_instance):
result['vms'] = 'Virtual Machines'

return result

@private
async def unlock_restarted_vms(self, dataset):
result = []
Expand Down
Loading