Skip to content

Conversation

@rawahars
Copy link

@rawahars rawahars commented Jan 7, 2026

This pull request introduces several changes to improve container and pod management, especially around resource allocation, mount paths, and lifecycle tracking. The most significant updates involve passing the pod (sandbox) ID throughout the container creation process, updating root and mount paths to be pod-aware, and adding lifecycle tracking methods for compute systems and utility VMs.

Pod-aware container creation and resource management:

  • The sandboxID (pod ID) is now passed through the container and task creation stack (newHcsTask, createContainer, etc.), and included in the CreateOptions struct. Mount and root paths for both LCOW and WCOW containers are updated to include the sandboxID, ensuring container filesystems and sandbox mounts are properly namespaced and isolated within their respective pods.

    For LCOWs, Prior to this change, the container root directory path was of the format-
    /run/gcs/c/<CONTAINER_ID>
    We are changing it now to-
    /run/gcs/pods/<SANDBOX_ID>/<CONTAINER_ID>

    For WCOWs, the only directory which is of our interest is C:\\SandboxMounts. After our change, it would be of format- C:\\SandboxMounts\\<SANDBOX_ID>

Lifecycle tracking and utility methods:

  • Added stopTime field and methods (Stopped, StartTime, StopTime) to the System struct, and corresponding methods to UtilityVM, to track and expose start/stop times and stopped state for compute systems and utility VMs. This aids in lifecycle management. These will be used in follow-up PRs for sandbox api implementation.

Resource allocation and defaults:

  • Set default CPU period and quota for LCOW containers if not specified, ensuring containers have CPU resource defaults as specified in https://docs.kernel.org/scheduler/sched-bwc.html .

  • Adjusted logic in allocateLinuxResources to always set layers and scratch paths, improving resource cleanup and allocation.

    Earlier, during the cleanup workflow, we were skipping the cleanup of image layers for pause container. This was because the cleanup happened automatically since the UVM was terminated. With multi-pod feature, that is not true and hence we are performing pause image cleanup in all cases.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
Presently, during the cleanup workflow, we were skipping the cleanup of image layers for pause container. This was because the cleanup happened automatically since the UVM was terminated. With multi-pod feature, that is not true and hence we are performing pause image cleanup in all cases.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars requested a review from a team as a code owner January 7, 2026 13:33
@rawahars rawahars changed the title Sandbox api pr 3 Pod-aware container creation, resource defaults, and lifecycle tracking enhancements Jan 7, 2026
For LCOW containers, if the CPU Period and Quota are not set in the Linux Resource Limits, then we set the default values for the same. This commit adds the change.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
…ot directories

For LCOWs, Prior to this change, the container root directory path was of the format-
'<Root Dir>/c/<CONTAINER_ID>'
We are changing it now to-
'<Root Dir>/pods/<SANDBOX_ID>/<CONTAINER_ID>'

For WCOWs, the only directory which is of our interest is 'C:\\SandboxMounts'. After our change, it would be of format- 'C:\\SandboxMounts\\<SANDBOX_ID>'

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
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.

1 participant