Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/controller/vm/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
// A Utility VM is a lightweight virtual machine used to host Linux (LCOW) or
// Windows (WCOW) containers. This package abstracts the VM lifecycle —
// creation, startup, stats collection, and termination — behind the [Controller]
// interface, with [Manager] as the primary implementation.
// creation, startup, stats collection, and termination — with the [Controller]
// as the primary implementation.
//
// # Lifecycle
//
Expand Down Expand Up @@ -33,7 +33,7 @@
//
// State descriptions:
//
// - [StateNotCreated]: initial state after [NewController] is called.
// - [StateNotCreated]: initial state after [New] is called.
// - [StateCreated]: after [Controller.CreateVM] succeeds; the VM exists but has not started.
// - [StateRunning]: after [Controller.StartVM] succeeds; the guest OS is up and the
// Guest Compute Service (GCS) connection is established.
Expand All @@ -51,7 +51,7 @@
//
// # Usage
//
// ctrl := vm.NewController()
// ctrl := vm.New()
//
// if err := ctrl.CreateVM(ctx, &vm.CreateOptions{
// ID: "my-uvm",
Expand Down
88 changes: 0 additions & 88 deletions internal/controller/vm/interface.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/controller/vm/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type State int32

const (
// StateNotCreated indicates the VM has not been created yet.
// This is the initial state when a Controller is first instantiated via [NewController].
// This is the initial state when a Controller is first instantiated via [New].
// Valid transitions: StateNotCreated → StateCreated (via [Controller.CreateVM])
StateNotCreated State = iota

Expand Down
52 changes: 52 additions & 0 deletions internal/controller/vm/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//go:build windows

package vm

import (
"time"

hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
"github.com/Microsoft/hcsshim/internal/protocol/guestresource"
"github.com/Microsoft/hcsshim/internal/vm/guestmanager"

"github.com/Microsoft/go-winio/pkg/guid"
)

// CreateOptions contains the configuration needed to create a new VM.
type CreateOptions struct {
// ID specifies the unique identifier for the VM.
ID string

// HCSDocument specifies the HCS schema document used to create the VM.
HCSDocument *hcsschema.ComputeSystem

// NoWritableFileShares disallows writable file shares to the UVM.
NoWritableFileShares bool

// FullyPhysicallyBacked indicates all memory allocations are backed by physical memory.
FullyPhysicallyBacked bool
}

// StartOptions contains the configuration needed to start a VM and establish
// the Guest Compute Service (GCS) connection.
type StartOptions struct {
// GCSServiceID specifies the GUID for the GCS vsock service.
GCSServiceID guid.GUID

// ConfigOptions specifies additional configuration options for the guest config.
ConfigOptions []guestmanager.ConfigOption

// ConfidentialOptions specifies security policy and confidential computing
// options for the VM. This is optional and only used for confidential VMs.
ConfidentialOptions *guestresource.ConfidentialOptions
}

// ExitStatus contains information about a stopped VM's final state.
type ExitStatus struct {
// StoppedTime is the timestamp when the VM stopped.
StoppedTime time.Time

// Err is the error that caused the VM to stop, if any.
// This will be nil if the VM exited cleanly.
Err error
}
Loading
Loading