Skip to content

Conversation

@fregataa
Copy link
Member

@fregataa fregataa commented Sep 8, 2025

resolves #5776 (BA-2290)

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

@fregataa fregataa added this to the 25Q2 milestone Sep 8, 2025
@fregataa fregataa self-assigned this Sep 8, 2025
@github-actions github-actions bot added size:XL 500~ LoC comp:storage-proxy Related to Storage proxy component labels Sep 8, 2025
@fregataa fregataa force-pushed the feat/bgtask-vfolder-delete branch from a7e1c41 to 0650b00 Compare September 8, 2025 08:48
@fregataa fregataa force-pushed the feat/add-privileged-worker branch 2 times, most recently from 1e32ad6 to dacdba5 Compare September 8, 2025 09:35
@fregataa fregataa force-pushed the feat/bgtask-vfolder-delete branch from 0650b00 to 67e2fa4 Compare September 8, 2025 18:05
@fregataa fregataa force-pushed the feat/add-privileged-worker branch from dacdba5 to 0dc54fb Compare September 9, 2025 01:41
Base automatically changed from feat/bgtask-vfolder-delete to main September 9, 2025 03:50
@fregataa fregataa force-pushed the feat/add-privileged-worker branch from 0dc54fb to ff4a5cc Compare September 9, 2025 05:53
Copilot AI review requested due to automatic review settings September 11, 2025 04:43
@fregataa fregataa force-pushed the feat/add-privileged-worker branch from ff4a5cc to b35b5b3 Compare September 11, 2025 04:43
Copy link
Contributor

Copilot AI left a 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:
Copy link

Copilot AI Sep 11, 2025

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.

Suggested change
if local_config.debug.enabled:

Copilot uses AI. Check for mistakes.

@override
async def teardown(self, resource: LoggerResult) -> None:
resource.logger.__exit__()
Copy link

Copilot AI Sep 11, 2025

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.

Suggested change
resource.logger.__exit__()
resource.logger.__exit__(None, None, None)

Copilot uses AI. Check for mistakes.
@property
@override
def name(self) -> str:
return "storage-worker-redis-config"
Copy link

Copilot AI Sep 11, 2025

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.

Suggested change
return "storage-worker-redis-config"
return "storage-worker-message-queue"

Copilot uses AI. Check for mistakes.
Comment on lines +13 to +17
def create(self) -> BackgroundTaskHandlerRegistry:
registry = BackgroundTaskHandlerRegistry()
registry.register(VFolderDeleteTaskHandler(self._volume_pool, self._event_producer))

return registry
Copy link

Copilot AI Sep 11, 2025

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.

Copilot uses AI. Check for mistakes.
@fregataa fregataa marked this pull request as draft September 25, 2025 09:39
@HyeockJinKim HyeockJinKim modified the milestones: 25Q2, 25.16 Oct 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:storage-proxy Related to Storage proxy component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add runnable Privileged Storage Worker component

3 participants