Skip to content

Comments

adds guest manager interfaces + implementation for guest operations#2598

Open
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:feat/vm-package-guestmanager
Open

adds guest manager interfaces + implementation for guest operations#2598
rawahars wants to merge 1 commit intomicrosoft:mainfrom
rawahars:feat/vm-package-guestmanager

Conversation

@rawahars
Copy link
Contributor

This pull request introduces a new guest-side management layer for virtual machines (VMs), clearly separating guest operations from host-side management and configuration. It does so by defining new interfaces and concrete implementations for interacting with the guest via the Guest Compute Service (GCS).

Note This PR is dependent upon #2597


The most important changes are:

Guest Manager Interface and Implementation:

  • Introduced the GuestOps interface in internal/vm/guest.go, which defines APIs for establishing a GCS connection and performing guest-side operations (network, storage, device, security policy, etc.). This interface is the contract for guest management.
  • Added a new guestManager implementation of GuestOps in internal/vm/guestmanager/hcs.go, which manages the GCS connection lifecycle, applies configuration options, and exposes guest-side management interfaces.

Guest Resource Management Implementations:

  • Implemented concrete guest-side managers for:
    • Network operations (GuestNetworkManager) in internal/vm/guestmanager/network.go
    • Directory mapping (DirectoryManager) in internal/vm/guestmanager/mapped_directory.go
    • Combined layers management (LayersManager) in internal/vm/guestmanager/combinedlayers.go
    • Device management (GuestDeviceManager) in internal/vm/guestmanager/device.go
    • Block CIMs management (BlockCIMsManager) in internal/vm/guestmanager/block_cims.go

This refactor lays a foundation for clean separation between host and guest responsibilities.

@rawahars rawahars requested a review from a team as a code owner February 11, 2026 06:13
@rawahars rawahars force-pushed the feat/vm-package-guestmanager branch from 76df85b to 3807b37 Compare February 11, 2026 11:14
@rawahars rawahars force-pushed the feat/vm-package-guestmanager branch 2 times, most recently from 640e16d to 5515496 Compare February 13, 2026 08:37
@rawahars rawahars force-pushed the feat/vm-package-guestmanager branch from 5515496 to 2625d6a Compare February 15, 2026 16:21
Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
@rawahars rawahars force-pushed the feat/vm-package-guestmanager branch from 2625d6a to 2217a34 Compare February 15, 2026 16:22
}

// CreateConnection accepts the GCS connection and performs initial setup.
func (gm *Guest) CreateConnection(ctx context.Context, opts ...ConfigOption) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this part should be a layer up. The other "managers" are about configuration and setup. This one seems to actually invoke things and actually connect to sockets etc.

)

// updateHvSocketAddress configures the HvSocket address for GCS communication.
func (gm *Guest) updateHvSocketAddress(ctx context.Context, settings *hcsschema.HvSocketAddress) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the case for updating the connection address?


// AcceptConnection accepts a connection and then closes a listener.
// It monitors ctx.Done() and uvm.Wait() for early termination.
func AcceptConnection(ctx context.Context, uvm vmmanager.LifetimeManager, l net.Listener, closeConnection bool) (net.Conn, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

To make this layer more testable do we need the connection be be given to the guest manager? Like leave this as the framing layer and the actual transport part is separate than this interface? Or is there a reason the guest manager needs to have connection management?

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.

3 participants