package client
import "github.com/Microsoft/opengcs/client"
Index ¶
- Constants
- func CopyFile(srcFile, destFile string, overwrite bool) error
- func LayerVhdDetails(folder string) (string, int64, bool, error)
- type Config
- func (config *Config) CreateExt4Vhdx(destFile string, sizeGB uint32, cacheFile string) error
- func (config *Config) GenerateDefault(options []string) error
- func (config *Config) HotAddVhd(hostPath string, containerPath string, readOnly bool, mount bool) error
- func (config *Config) HotRemoveVhd(hostPath string) error
- func (config *Config) RunProcess(commandLine string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (hcsshim.Process, error)
- func (config *Config) StartUtilityVM() error
- func (config *Config) TarToVhd(targetVHDFile string, reader io.Reader) (int64, error)
- func (config *Config) Validate() error
- func (config *Config) VhdToTar(vhdFile string, uvmMountPath string, isSandbox bool, vhdSize int64) (io.ReadCloser, error)
- type Mode
- type Options
Constants ¶
const ( // ModeActualError means an error has occurred during validation ModeActualError = iota // ModeActualVhdx means that we are going to use VHDX boot after validation ModeActualVhdx // ModeActualKernelInitrd means that we are going to use kernel+initrd for boot after validation ModeActualKernelInitrd // ModeRequestAuto means auto-select the boot mode for a utility VM ModeRequestAuto = iota // VHDX will be priority over kernel+initrd // ModeRequestVhdx means request VHDX boot if possible ModeRequestVhdx // ModeRequestKernelInitrd means request Kernel+initrd boot if possible ModeRequestKernelInitrd // DefaultVhdxSizeGB is the size of the default sandbox & scratch in GB DefaultVhdxSizeGB = 20 )
Functions ¶
func CopyFile ¶
CopyFile is a utility for copying a file - used for the sandbox cache. Uses CopyFileW win32 API for performance
func LayerVhdDetails ¶
LayerVhdDetails is a utility for getting a file name, size and indication of sandbox for a VHD(x) in a folder. A read-only layer will be layer.vhd. A read-write layer will be sandbox.vhdx.
Types ¶
type Config ¶
type Config struct { Options // Configuration options Name string // Name of the utility VM RequestedMode Mode // What mode is preferred when validating ActualMode Mode // What mode was obtained during validation UvmTimeoutSeconds int // How long to wait for the utility VM to respond in seconds Uvm hcsshim.Container // The actual container MappedVirtualDisks []hcsshim.MappedVirtualDisk // Data-disks to be attached }
Config is the structure used to configuring a utility VM. There are two ways of starting. Either supply a VHD, or a Kernel+Initrd. For the latter, both must be supplied, and both must be in the same directory.
VHD is the priority.
func (*Config) CreateExt4Vhdx ¶
CreateExt4Vhdx does what it says on the tin. It is the responsibility of the caller to synchronise simultaneous attempts to create the cache file.
func (*Config) GenerateDefault ¶
GenerateDefault generates a default config from a set of options If baseDir is not supplied, defaults to $env:ProgramFiles\Linux Containers
func (*Config) HotAddVhd ¶
func (config *Config) HotAddVhd(hostPath string, containerPath string, readOnly bool, mount bool) error
HotAddVhd hot-adds a VHD to a utility VM. This is used in the global one-utility-VM- service-VM per host scenario. In order to do a graphdriver `Diff`, we hot-add the sandbox to /mnt/<id> so that we can run `exportSandbox` inside the utility VM to get a tar-stream of the sandboxes contents back to the daemon.
func (*Config) HotRemoveVhd ¶
HotRemoveVhd hot-removes a VHD from a utility VM. This is used in the global one-utility-VM- service-VM per host scenario.
func (*Config) RunProcess ¶
func (config *Config) RunProcess(commandLine string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (hcsshim.Process, error)
RunProcess runs the given command line program in the utilityVM. It takes in an input to the reader to feed into stdin and returns stdout to output. IMPORTANT: It is the responsibility of the caller to call Close() on the returned process.
func (*Config) StartUtilityVM ¶
StartUtilityVM creates and starts a utility VM from a configuration.
func (*Config) TarToVhd ¶
TarToVhd streams a tarstream contained in an io.Reader to a fixed vhd file
func (*Config) Validate ¶
Validate validates a Config structure for starting a utility VM.
func (*Config) VhdToTar ¶
func (config *Config) VhdToTar(vhdFile string, uvmMountPath string, isSandbox bool, vhdSize int64) (io.ReadCloser, error)
VhdToTar does what is says - it exports a VHD in a specified folder (either a read-only layer.vhd, or a read-write sandbox.vhd) to a ReadCloser containing a tar-stream of the layers contents.
type Mode ¶
type Mode uint
Mode is the operational mode, both requested, and actual after verification
type Options ¶
type Options struct { KirdPath string // Path to where kernel/initrd are found (defaults to %PROGRAMFILES%\Linux Containers) KernelFile string // Kernel for Utility VM (embedded in a UEFI bootloader) - does NOT include full path, just filename InitrdFile string // Initrd image for Utility VM - does NOT include full path, just filename Vhdx string // VHD for booting the utility VM - is a full path TimeoutSeconds int // Requested time for the utility VM to respond in seconds (may be over-ridden by environment) BootParameters string // Additional boot parameters for initrd booting (not VHDx) }
Options is the structure used by a client to define configurable options for a utility VM.
func ParseOptions ¶
ParseOptions parses a set of K-V pairs into options used by opengcs. Note for consistency with the LCOW graphdriver in docker, we keep the same convention of an `lcow.` prefix.
Source Files ¶
config.go createext4vhdx.go hotaddvhd.go hotremovevhd.go layervhddetails.go process.go tartovhd.go utilities.go vhdtotar.go
- Version
- v0.3.2
- Published
- Aug 8, 2017
- Platform
- windows/amd64
- Imports
- 14 packages
- Last checked
- 17 minutes ago –
Tools for package owners.