Skip to content

refactor(uvm): split Update into WCOW and LCOW specific files#6

Draft
Copilot wants to merge 4 commits intofeat/lcow-shimfrom
copilot/refactor-update-methods-for-wcow-lcow
Draft

refactor(uvm): split Update into WCOW and LCOW specific files#6
Copilot wants to merge 4 commits intofeat/lcow-shimfrom
copilot/refactor-update-methods-for-wcow-lcow

Conversation

Copy link

Copilot AI commented Mar 15, 2026

UtilityVM.Update mixed WCOW and LCOW resource handling in a single method, making it harder to maintain and extend independently per container type.

Changes

  • update_uvm_wcow.go — new file with updateWCOW, handling *specs.WindowsResources (memory limit, CPU maximum/shares)
  • update_uvm_lcow.go — new file with updateLCOW, handling *specs.LinuxResources (memory limit, CPU quota/shares) and *ctrdtaskapi.PolicyFragment
  • update_uvm.go — replaced monolithic implementation with a thin OS dispatcher:
func (uvm *UtilityVM) Update(ctx context.Context, data interface{}, annots map[string]string) error {
    if uvm.operatingSystem == "windows" {
        return uvm.updateWCOW(ctx, data, annots)
    }
    return uvm.updateLCOW(ctx, data, annots)
}

This mirrors the existing create_wcow.go/create_lcow.go pattern and makes the separation ready for future compile-time build tag gating if WCOW-only or LCOW-only binaries are needed.

Original prompt

if i need to segregate the Update method into 2 such that WCOW functionality is specific to WCOW file and LCOW in LCOW file. Then we can have same method in both files and can compile the correct file at compile time using build tags. How should I refactor it? Just tell me the approach

The user has attached the following files from their workspace:

  • internal/uvm/update_uvm.go

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

rawahars and others added 3 commits March 12, 2026 22:29
In this commit, we are adding the initial draft of `containerd-shim-lcow-v1`. This shim is used for running Linux Containers on Windows.

As part of this commit, we are adding the following-
- The main entrypoint and supporting logic to start + serve the shim server.
- The stubs for Task Service and Shimdiag service.
- The implementation for `Sandbox` service.
- The implementation for `VM Controller` which manages the VM lifecycle and operations.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
Co-authored-by: rawahars <65640262+rawahars@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor Update method for WCOW and LCOW separation refactor(uvm): split Update into WCOW and LCOW specific files Mar 15, 2026
Copilot AI requested a review from rawahars March 15, 2026 23:17
@rawahars rawahars force-pushed the feat/lcow-shim branch 10 times, most recently from 4451f3c to 8c846bb Compare March 24, 2026 13:23
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.

2 participants