-
Notifications
You must be signed in to change notification settings - Fork 164
feat(BA-2290): Add Privileged Storage Worker #5779
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
base: main
Are you sure you want to change the base?
Conversation
a7e1c41 to
0650b00
Compare
1e32ad6 to
dacdba5
Compare
0650b00 to
67e2fa4
Compare
dacdba5 to
0dc54fb
Compare
0dc54fb to
ff4a5cc
Compare
ff4a5cc to
b35b5b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Privileged Storage Worker component that runs with elevated privileges to handle sensitive storage operations. The implementation includes comprehensive bootstrap stages, configuration management, and integration with the existing storage system.
- Add complete privileged storage worker infrastructure with configurable root privilege validation
- Implement bootstrap stages for logger, monitor, etcd, Redis, event handling, and background task management
- Integrate privileged worker into the storage CLI with a new entry point
Reviewed Changes
Copilot reviewed 20 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ai/backend/storage/privileged/server.py | Main server entry point with multiprocess worker management |
| src/ai/backend/storage/privileged/config.py | Configuration validation with root privilege checking |
| src/ai/backend/storage/privileged/bootstrap/ | Bootstrap stages for component initialization |
| src/ai/backend/storage/bgtask/tags.py | Renamed constant for privileged worker tagging |
| src/ai/backend/storage/BUILD | Added CLI entry point for privileged worker |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| log_config = logging.getLogger("ai.backend.storage.config") | ||
| if local_config.debug.enabled: | ||
| log_config.debug("debug mode enabled.") | ||
| if local_config.debug.enabled: |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug condition is checked twice on lines 128 and 130. Consider combining these checks into a single block to reduce duplication.
| if local_config.debug.enabled: |
|
|
||
| @override | ||
| async def teardown(self, resource: LoggerResult) -> None: | ||
| resource.logger.__exit__() |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logger teardown calls __exit__() without the required arguments. Context managers require three parameters (exc_type, exc_val, exc_tb). Use resource.logger.__exit__(None, None, None) or consider using a more explicit teardown method.
| resource.logger.__exit__() | |
| resource.logger.__exit__(None, None, None) |
| @property | ||
| @override | ||
| def name(self) -> str: | ||
| return "storage-worker-redis-config" |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provisioner name is incorrect. It should be 'storage-worker-message-queue' to match the actual functionality of this class.
| return "storage-worker-redis-config" | |
| return "storage-worker-message-queue" |
| def create(self) -> BackgroundTaskHandlerRegistry: | ||
| registry = BackgroundTaskHandlerRegistry() | ||
| registry.register(VFolderDeleteTaskHandler(self._volume_pool, self._event_producer)) | ||
|
|
||
| return registry |
Copilot
AI
Sep 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method creates a registry and registers a handler but doesn't return it on line 16. The return statement should come after line 15.
resolves #5776 (BA-2290)
Checklist: (if applicable)
ai.backend.testdocsdirectory