Documentation ¶
Index ¶
- Constants
- Variables
- type PreferredRootFSType
- type UVMOptions
- type UtilityVM
- func (uvm *UtilityVM) AddNetNS(id string, endpoints []*hns.HNSEndpoint) (err error)
- func (uvm *UtilityVM) AddPlan9(hostPath string, uvmPath string, readOnly bool) error
- func (uvm *UtilityVM) AddSCSI(hostPath string, uvmPath string) (int, int32, error)
- func (uvm *UtilityVM) AddVPMEM(hostPath string, expose bool) (uint32, string, error)
- func (uvm *UtilityVM) AddVSMB(hostPath string, guestRequest interface{}, ...) error
- func (uvm *UtilityVM) Close() error
- func (uvm *UtilityVM) ComputeSystem() *hcs.System
- func (uvm *UtilityVM) ContainerCounter() uint64
- func (uvm *UtilityVM) GetVSMBUvmPath(hostPath string) (string, error)
- func (uvm *UtilityVM) ID() string
- func (uvm *UtilityVM) Modify(hcsModificationDocument interface{}) error
- func (uvm *UtilityVM) OS() string
- func (uvm *UtilityVM) RemoveNetNS(id string) error
- func (uvm *UtilityVM) RemovePlan9(hostPath string) error
- func (uvm *UtilityVM) RemoveSCSI(hostPath string) error
- func (uvm *UtilityVM) RemoveVPMEM(hostPath string) error
- func (uvm *UtilityVM) RemoveVSMB(hostPath string) error
- func (uvm *UtilityVM) Start() error
- func (uvm *UtilityVM) Terminate() error
- func (uvm *UtilityVM) Wait() error
Constants ¶
const ( // MaxVPMEM is the maximum number of VPMem devices that may be added to an LCOW // utility VM MaxVPMEM = 128 // DefaultVPMEM is the default number of VPMem devices that may be added to an LCOW // utility VM if the create request doesn't specify how many. DefaultVPMEM = 64 )
const ( PreferredRootFSTypeInitRd = 0 PreferredRootFSTypeVHD = 1 )
Variables ¶
var ( ErrNoAvailableLocation = fmt.Errorf("no available location") ErrNotAttached = fmt.Errorf("not attached") ErrAlreadyAttached = fmt.Errorf("already attached") ErrNoSCSIControllers = fmt.Errorf("no SCSI controllers configured for this utility VM") ErrNoUvmParameter = fmt.Errorf("invalid parameters - uvm parameter missing") ErrTooManyAttachments = fmt.Errorf("too many SCSI attachments") )
Functions ¶
This section is empty.
Types ¶
type PreferredRootFSType ¶
type PreferredRootFSType int
type UVMOptions ¶
type UVMOptions struct { ID string // Identifier for the uvm. Defaults to generated GUID. Owner string // Specifies the owner. Defaults to executable name. OperatingSystem string // "windows" or "linux". Resources *specs.WindowsResources // Optional resources for the utility VM. Supports Memory.limit and CPU.Count only currently. // TODO consider extending? AdditionHCSDocumentJSON string // Optional additional JSON to merge into the HCS document prior // WCOW specific parameters LayerFolders []string // Set of folders for base layers and scratch. Ordered from top most read-only through base read-only layer, followed by scratch // LCOW specific parameters BootFilesPath string // Folder in which kernel and root file system reside. Defaults to \Program Files\Linux Containers KernelFile string // Filename under BootFilesPath for the kernel. Defaults to `kernel` RootFSFile string // Filename under BootFilesPath for the UVMs root file system. Defaults are `initrd.img` or `rootfs.vhd`. PreferredRootFSType *PreferredRootFSType // Controls searching for the RootFSFile. KernelBootOptions string // Additional boot options for the kernel EnableGraphicsConsole bool // If true, enable a graphics console for the utility VM ConsolePipe string // The named pipe path to use for the serial console. eg \\.\pipe\vmpipe VPMemDeviceCount *int32 // Number of VPMem devices. Limit at 128. If booting UVM from VHD, device 0 is taken. LCOW Only. SCSIControllerCount *int // The number of SCSI controllers. Defaults to 1 if omitted. Currently we only support 0 or 1. }
UVMOptions are the set of options passed to Create() to create a utility vm.
type UtilityVM ¶
type UtilityVM struct {
// contains filtered or unexported fields
}
UtilityVM is the object used by clients representing a utility VM
func Create ¶
func Create(opts *UVMOptions) (_ *UtilityVM, err error)
Create creates an HCS compute system representing a utility VM.
WCOW Notes:
- If the scratch folder does not exist, it will be created
- If the scratch folder does not contain `sandbox.vhdx` it will be created based on the system template located in the layer folders.
- The scratch is always attached to SCSI 0:0
func (*UtilityVM) AddNetNS ¶
func (uvm *UtilityVM) AddNetNS(id string, endpoints []*hns.HNSEndpoint) (err error)
func (*UtilityVM) AddPlan9 ¶
AddPlan9 adds a Plan9 share to a utility VM. Each Plan9 share is ref-counted and only added if it isn't already.
func (*UtilityVM) AddSCSI ¶
AddSCSI adds a SCSI disk to a utility VM at the next available location.
We are in control of everything ourselves. Hence we have ref- counting and so-on tracking what SCSI locations are available or used.
hostPath is required uvmPath is optional.
Returns the controller ID (0..3) and LUN (0..63) where the disk is attached.
func (*UtilityVM) AddVPMEM ¶
AddVPMEM adds a VPMEM disk to a utility VM at the next available location.
Returns the location(0..MaxVPMEM-1) where the device is attached, and if exposed, the utility VM path which will be /tmp/p<location>//
func (*UtilityVM) AddVSMB ¶
func (uvm *UtilityVM) AddVSMB(hostPath string, guestRequest interface{}, options *hcsschema.VirtualSmbShareOptions) error
AddVSMB adds a VSMB share to a Windows utility VM. Each VSMB share is ref-counted and only added if it isn't already. This is used for read-only layers, mapped directories to a container, and for mapped pipes.
func (*UtilityVM) ComputeSystem ¶
func (*UtilityVM) ContainerCounter ¶
ContainerCounter is used for where we layout things for a container in a utility VM. For WCOW it'll be C:\c\N\. For LCOW it'll be /run/gcs/c/N/.
func (*UtilityVM) GetVSMBUvmPath ¶
GetVSMBUvmPath returns the guest path of a VSMB mount.
func (*UtilityVM) RemoveNetNS ¶
func (*UtilityVM) RemovePlan9 ¶
RemovePlan9 removes a Plan9 share from a utility VM. Each Plan9 share is ref-counted and only actually removed when the ref-count drops to zero.
func (*UtilityVM) RemoveSCSI ¶
RemoveSCSI removes a SCSI disk from a utility VM. As an external API, it is "safe". Internal use can call removeSCSI.
func (*UtilityVM) RemoveVPMEM ¶
RemoveVPMEM removes a VPMEM disk from a utility VM. As an external API, it is "safe". Internal use can call removeVPMEM.
func (*UtilityVM) RemoveVSMB ¶
RemoveVSMB removes a VSMB share from a utility VM. Each VSMB share is ref-counted and only actually removed when the ref-count drops to zero.