Skip to content

feat(restart): support cpu/memory resource updates on restart#1100

Open
zhangjaycee wants to merge 2 commits into
alibaba:masterfrom
zhangjaycee:feature/restart-resources
Open

feat(restart): support cpu/memory resource updates on restart#1100
zhangjaycee wants to merge 2 commits into
alibaba:masterfrom
zhangjaycee:feature/restart-resources

Conversation

@zhangjaycee

Copy link
Copy Markdown
Collaborator

close #1099

@zhangjaycee zhangjaycee force-pushed the feature/restart-resources branch 4 times, most recently from 849db0f to 35b5001 Compare June 16, 2026 05:59
@zhangjaycee zhangjaycee changed the title feat(restart): support cpu/memory/disk resource updates on restart feat(restart): support cpu/memory resource updates on restart Jun 16, 2026
@zhangjaycee zhangjaycee marked this pull request as ready for review June 16, 2026 06:00
Move the inline _apply_cpu_overcommit_default from sandbox_api.py to
rock/common/cpu_overcommit.py so both start and restart flows can reuse
the same overcommit logic. The new function takes nacos_provider as an
explicit parameter instead of reading from the module-level global.
- Add limit_cpus to SandboxRestartRequest and restart_async
- Build DockerDeploymentConfig from persisted spec in restart_async,
  apply resource overrides, validate via validate_sandbox_spec
- Reuse apply_cpu_overcommit when cpus changes without explicit limit_cpus
- Simplify on_restart to receive a fully-built config instead of raw
  resource_overrides dict
- Add _docker_update_resources (reuses _cpus/_memory) to apply resource
  changes to stopped containers before docker start
- Add unit tests for _docker_update_resources and restart resource flows
@zhangjaycee zhangjaycee force-pushed the feature/restart-resources branch from 35b5001 to addb51f Compare June 16, 2026 10:17
from rock.deployments.config import DockerDeploymentConfig


async def apply_cpu_overcommit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

封装到类

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support CPU/memory/disk resource updates on sandbox restart

2 participants