diff --git a/internal/cpugroup/cpugroup.go b/internal/cpugroup/cpugroup.go index ab3b757efb..61cd703586 100644 --- a/internal/cpugroup/cpugroup.go +++ b/internal/cpugroup/cpugroup.go @@ -53,9 +53,8 @@ func Create(ctx context.Context, id string, logicalProcessors []uint32) error { return nil } -// getCPUGroupConfig finds the cpugroup config information for group with `id` -//nolint:unused -func getCPUGroupConfig(ctx context.Context, id string) (*hcsschema.CpuGroupConfig, error) { +// GetCPUGroupConfig finds the cpugroup config information for group with `id` +func GetCPUGroupConfig(ctx context.Context, id string) (*hcsschema.CpuGroupConfig, error) { query := hcsschema.PropertyQuery{ PropertyTypes: []hcsschema.PropertyType{hcsschema.PTCPUGroup}, } diff --git a/internal/cpugroup/cpugroup_test.go b/internal/cpugroup/cpugroup_test.go index 07af7894f8..13cd3c83ac 100644 --- a/internal/cpugroup/cpugroup_test.go +++ b/internal/cpugroup/cpugroup_test.go @@ -31,7 +31,7 @@ func TestCPUGroupCreateWithIDAndDelete(t *testing.T) { } }() - _, err = getCPUGroupConfig(ctx, id.String()) + _, err = GetCPUGroupConfig(ctx, id.String()) if err != nil { t.Fatalf("failed to find cpugroup on host with: %v", err) } diff --git a/internal/hcs/schema2/cpu_group_config.go b/internal/hcs/schema2/cpu_group_config.go index f1a28cd389..0be0475d41 100644 --- a/internal/hcs/schema2/cpu_group_config.go +++ b/internal/hcs/schema2/cpu_group_config.go @@ -14,5 +14,5 @@ type CpuGroupConfig struct { Affinity *CpuGroupAffinity `json:"Affinity,omitempty"` GroupProperties []CpuGroupProperty `json:"GroupProperties,omitempty"` // Hypervisor CPU group IDs exposed to clients - HypervisorGroupId int32 `json:"HypervisorGroupId,omitempty"` + HypervisorGroupId uint64 `json:"HypervisorGroupId,omitempty"` } diff --git a/internal/vm/builder.go b/internal/vm/builder.go index 4be3eee296..288daad76a 100644 --- a/internal/vm/builder.go +++ b/internal/vm/builder.go @@ -67,7 +67,7 @@ type StorageQosManager interface { // WindowsConfigManager manages options specific to a Windows host (cpugroups etc.) type WindowsConfigManager interface { // SetCPUGroup sets the CPU group that the Utility VM will belong to on a Windows host. - SetCPUGroup(id string) error + SetCPUGroup(ctx context.Context, id string) error } // LinuxConfigManager manages options specific to a Linux host. diff --git a/internal/vm/hcs/builder.go b/internal/vm/hcs/builder.go index f37a0f08b8..676e114bf6 100644 --- a/internal/vm/hcs/builder.go +++ b/internal/vm/hcs/builder.go @@ -10,6 +10,8 @@ import ( "github.com/pkg/errors" ) +var _ vm.UVMBuilder = &utilityVMBuilder{} + type utilityVMBuilder struct { id string guestOS vm.GuestOS @@ -81,7 +83,6 @@ func (uvmb *utilityVMBuilder) Create(ctx context.Context) (_ vm.UVM, err error) guestOS: uvmb.guestOS, cs: cs, backingType: backingType, - state: vm.StateCreated, } properties, err := cs.Properties(ctx) diff --git a/internal/vm/hcs/hcs.go b/internal/vm/hcs/hcs.go index 67c44a95d9..1c7f337304 100644 --- a/internal/vm/hcs/hcs.go +++ b/internal/vm/hcs/hcs.go @@ -12,9 +12,10 @@ import ( "golang.org/x/sys/windows" ) +var _ vm.UVM = &utilityVM{} + type utilityVM struct { id string - state vm.State guestOS vm.GuestOS cs *hcs.System backingType vm.MemoryBackingType diff --git a/internal/vm/hcs/windows.go b/internal/vm/hcs/windows.go index 029c71d417..e4775b0528 100644 --- a/internal/vm/hcs/windows.go +++ b/internal/vm/hcs/windows.go @@ -1,10 +1,12 @@ package hcs import ( + "context" + hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2" ) -func (uvmb *utilityVMBuilder) SetCPUGroup(id string) error { +func (uvmb *utilityVMBuilder) SetCPUGroup(ctx context.Context, id string) error { uvmb.doc.VirtualMachine.ComputeTopology.Processor.CpuGroup = &hcsschema.CpuGroup{Id: id} return nil } diff --git a/internal/vm/remotevm/boot.go b/internal/vm/remotevm/boot.go new file mode 100644 index 0000000000..9f170033b1 --- /dev/null +++ b/internal/vm/remotevm/boot.go @@ -0,0 +1,27 @@ +package remotevm + +import ( + "github.com/Microsoft/hcsshim/internal/vmservice" +) + +func (uvmb *utilityVMBuilder) SetLinuxKernelDirectBoot(kernel, initRD, cmd string) error { + uvmb.config.BootConfig = &vmservice.VMConfig_DirectBoot{ + DirectBoot: &vmservice.DirectBoot{ + KernelPath: kernel, + InitrdPath: initRD, + KernelCmdline: cmd, + }, + } + return nil +} + +func (uvmb *utilityVMBuilder) SetUEFIBoot(firmware, devPath, args string) error { + uvmb.config.BootConfig = &vmservice.VMConfig_Uefi{ + Uefi: &vmservice.UEFI{ + FirmwarePath: firmware, + DevicePath: devPath, + OptionalData: args, + }, + } + return nil +} diff --git a/internal/vm/remotevm/builder.go b/internal/vm/remotevm/builder.go new file mode 100644 index 0000000000..b289428044 --- /dev/null +++ b/internal/vm/remotevm/builder.go @@ -0,0 +1,109 @@ +package remotevm + +import ( + "context" + "io" + "io/ioutil" + "net" + "os/exec" + + "github.com/Microsoft/hcsshim/internal/jobobject" + "github.com/Microsoft/hcsshim/internal/log" + "github.com/Microsoft/hcsshim/internal/vm" + "github.com/Microsoft/hcsshim/internal/vmservice" + "github.com/containerd/ttrpc" + ptypes "github.com/gogo/protobuf/types" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +var _ vm.UVMBuilder = &utilityVMBuilder{} + +type utilityVMBuilder struct { + id string + guestOS vm.GuestOS + job *jobobject.JobObject + config *vmservice.VMConfig + client vmservice.VMService +} + +func NewUVMBuilder(ctx context.Context, id, owner, binPath, addr string, guestOS vm.GuestOS) (vm.UVMBuilder, error) { + var job *jobobject.JobObject + if binPath != "" { + log.G(ctx).WithFields(logrus.Fields{ + "binary": binPath, + "address": addr, + }).Debug("starting remotevm server process") + + opts := &jobobject.Options{ + Name: id, + } + job, err := jobobject.Create(ctx, opts) + if err != nil { + return nil, errors.Wrap(err, "failed to create job object for remotevm process") + } + + cmd := exec.Command(binPath, "--ttrpc", addr) + p, err := cmd.StdoutPipe() + if err != nil { + return nil, errors.Wrap(err, "failed to create stdout pipe") + } + + if err := cmd.Start(); err != nil { + return nil, errors.Wrap(err, "failed to start remotevm server process") + } + + if err := job.Assign(uint32(cmd.Process.Pid)); err != nil { + return nil, errors.Wrap(err, "failed to assign remotevm process to job") + } + + if err := job.SetTerminateOnLastHandleClose(); err != nil { + return nil, errors.Wrap(err, "failed to set terminate on last handle closed for remotevm job object") + } + + // Wait for stdout to close. This is our signal that the server is successfully up and running. + _, _ = io.Copy(ioutil.Discard, p) + } + + conn, err := net.Dial("unix", addr) + if err != nil { + return nil, errors.Wrapf(err, "failed to dial remotevm address %q", addr) + } + + c := ttrpc.NewClient(conn, ttrpc.WithOnClose(func() { conn.Close() })) + vmClient := vmservice.NewVMClient(c) + + return &utilityVMBuilder{ + id: id, + guestOS: guestOS, + config: &vmservice.VMConfig{ + MemoryConfig: &vmservice.MemoryConfig{}, + DevicesConfig: &vmservice.DevicesConfig{}, + ProcessorConfig: &vmservice.ProcessorConfig{}, + SerialConfig: &vmservice.SerialConfig{}, + ExtraData: make(map[string]string), + }, + job: job, + client: vmClient, + }, nil +} + +func (uvmb *utilityVMBuilder) Create(ctx context.Context) (vm.UVM, error) { + // Grab what capabilities the virtstack supports up front. + capabilities, err := uvmb.client.CapabilitiesVM(ctx, &ptypes.Empty{}) + if err != nil { + return nil, errors.Wrap(err, "failed to get virtstack capabilities from vmservice") + } + + if _, err := uvmb.client.CreateVM(ctx, &vmservice.CreateVMRequest{Config: uvmb.config, LogID: uvmb.id}); err != nil { + return nil, errors.Wrap(err, "failed to create remote VM") + } + + return &utilityVM{ + id: uvmb.id, + job: uvmb.job, + config: uvmb.config, + client: uvmb.client, + capabilities: capabilities, + }, nil +} diff --git a/internal/vm/remotevm/memory.go b/internal/vm/remotevm/memory.go new file mode 100644 index 0000000000..f0933cfc4e --- /dev/null +++ b/internal/vm/remotevm/memory.go @@ -0,0 +1,36 @@ +package remotevm + +import ( + "github.com/Microsoft/hcsshim/internal/vm" + "github.com/Microsoft/hcsshim/internal/vmservice" +) + +func (uvmb *utilityVMBuilder) SetMemoryLimit(memoryMB uint64) error { + if uvmb.config.MemoryConfig == nil { + uvmb.config.MemoryConfig = &vmservice.MemoryConfig{} + } + uvmb.config.MemoryConfig.MemoryMb = memoryMB + return nil +} + +func (uvmb *utilityVMBuilder) SetMemoryConfig(config *vm.MemoryConfig) error { + if uvmb.config.MemoryConfig == nil { + uvmb.config.MemoryConfig = &vmservice.MemoryConfig{} + } + uvmb.config.MemoryConfig.AllowOvercommit = config.BackingType == vm.MemoryBackingTypeVirtual + uvmb.config.MemoryConfig.ColdHint = config.ColdHint + uvmb.config.MemoryConfig.ColdDiscardHint = config.ColdDiscardHint + uvmb.config.MemoryConfig.DeferredCommit = config.DeferredCommit + uvmb.config.MemoryConfig.HotHint = config.HotHint + return vm.ErrNotSupported +} + +func (uvmb *utilityVMBuilder) SetMMIOConfig(lowGapMB uint64, highBaseMB uint64, highGapMB uint64) error { + if uvmb.config.MemoryConfig == nil { + uvmb.config.MemoryConfig = &vmservice.MemoryConfig{} + } + uvmb.config.MemoryConfig.HighMmioBaseInMb = highBaseMB + uvmb.config.MemoryConfig.LowMmioGapInMb = lowGapMB + uvmb.config.MemoryConfig.HighMmioGapInMb = highGapMB + return nil +} diff --git a/internal/vm/remotevm/network.go b/internal/vm/remotevm/network.go new file mode 100644 index 0000000000..ceddeb4752 --- /dev/null +++ b/internal/vm/remotevm/network.go @@ -0,0 +1,120 @@ +package remotevm + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "github.com/Microsoft/go-winio/pkg/guid" + "github.com/Microsoft/hcsshim/hcn" + "github.com/Microsoft/hcsshim/internal/vmservice" + "github.com/pkg/errors" +) + +func getSwitchID(endpointID, portID string) (string, error) { + // Get updated endpoint with new fields (need switch ID) + ep, err := hcn.GetEndpointByID(endpointID) + if err != nil { + return "", errors.Wrapf(err, "failed to get endpoint %q", endpointID) + } + + type ExtraInfo struct { + Allocators []struct { + SwitchId string + EndpointPortGuid string + } + } + + var exi ExtraInfo + if err := json.Unmarshal(ep.Health.Extra.Resources, &exi); err != nil { + return "", errors.Wrapf(err, "failed to unmarshal resource data from endpoint %q", endpointID) + } + + if len(exi.Allocators) == 0 { + return "", errors.New("no resource data found for endpoint") + } + + // NIC should only ever belong to one switch but there are cases where there's more than one allocator + // in the returned data. It seems they only ever contain empty strings so search for the first entry + // that actually contains a switch ID and that has the matching port GUID we made earlier. + var switchID string + for _, allocator := range exi.Allocators { + if allocator.SwitchId != "" && strings.ToLower(allocator.EndpointPortGuid) == portID { + switchID = allocator.SwitchId + break + } + } + return switchID, nil +} + +func (uvm *utilityVM) AddNIC(ctx context.Context, nicID, endpointID, macAddr string) error { + portID, err := guid.NewV4() + if err != nil { + return errors.Wrap(err, "failed to generate guid for port") + } + + vmEndpointRequest := hcn.VmEndpointRequest{ + PortId: portID, + VirtualNicName: fmt.Sprintf("%s--%s", nicID, portID), + VirtualMachineId: guid.GUID{}, + } + + m, err := json.Marshal(vmEndpointRequest) + if err != nil { + return errors.Wrap(err, "failed to marshal endpoint request json") + } + + if err := hcn.ModifyEndpointSettings(endpointID, &hcn.ModifyEndpointSettingRequest{ + ResourceType: hcn.EndpointResourceTypePort, + RequestType: hcn.RequestTypeAdd, + Settings: json.RawMessage(m), + }); err != nil { + return errors.Wrap(err, "failed to configure switch port") + } + + switchID, err := getSwitchID(endpointID, portID.String()) + if err != nil { + return err + } + + nic := &vmservice.NICConfig{ + NicID: nicID, + MacAddress: macAddr, + PortID: portID.String(), + SwitchID: switchID, + } + + if _, err := uvm.client.ModifyResource(ctx, + &vmservice.ModifyResourceRequest{ + Type: vmservice.ModifyType_ADD, + Resource: &vmservice.ModifyResourceRequest_NicConfig{ + NicConfig: nic, + }, + }, + ); err != nil { + return errors.Wrap(err, "failed to add network adapter") + } + + return nil +} + +func (uvm *utilityVM) RemoveNIC(ctx context.Context, nicID, endpointID, macAddr string) error { + nic := &vmservice.NICConfig{ + NicID: nicID, + MacAddress: macAddr, + } + + if _, err := uvm.client.ModifyResource(ctx, + &vmservice.ModifyResourceRequest{ + Type: vmservice.ModifyType_REMOVE, + Resource: &vmservice.ModifyResourceRequest_NicConfig{ + NicConfig: nic, + }, + }, + ); err != nil { + return errors.Wrap(err, "failed to remove network adapter") + } + + return nil +} diff --git a/internal/vm/remotevm/processor.go b/internal/vm/remotevm/processor.go new file mode 100644 index 0000000000..9e1ca2264a --- /dev/null +++ b/internal/vm/remotevm/processor.go @@ -0,0 +1,15 @@ +package remotevm + +import ( + "context" + + "github.com/Microsoft/hcsshim/internal/vmservice" +) + +func (uvmb *utilityVMBuilder) SetProcessorCount(ctx context.Context, count uint32) error { + if uvmb.config.ProcessorConfig == nil { + uvmb.config.ProcessorConfig = &vmservice.ProcessorConfig{} + } + uvmb.config.ProcessorConfig.ProcessorCount = count + return nil +} diff --git a/internal/vm/remotevm/remotevm.go b/internal/vm/remotevm/remotevm.go new file mode 100644 index 0000000000..733e33b49d --- /dev/null +++ b/internal/vm/remotevm/remotevm.go @@ -0,0 +1,105 @@ +package remotevm + +import ( + "context" + + "github.com/Microsoft/hcsshim/internal/jobobject" + "github.com/Microsoft/hcsshim/internal/vm" + "github.com/Microsoft/hcsshim/internal/vmservice" + ptypes "github.com/gogo/protobuf/types" + "github.com/pkg/errors" +) + +var _ vm.UVM = &utilityVM{} + +type utilityVM struct { + id string + waitError error + job *jobobject.JobObject + config *vmservice.VMConfig + client vmservice.VMService + capabilities *vmservice.CapabilitiesVMResponse +} + +var vmSupportedResourceToVMService = map[vm.Resource]vmservice.CapabilitiesVMResponse_Resource{ + vm.VPMem: vmservice.CapabilitiesVMResponse_Vpmem, + vm.SCSI: vmservice.CapabilitiesVMResponse_Scsi, + vm.PCI: vmservice.CapabilitiesVMResponse_Vpci, + vm.Plan9: vmservice.CapabilitiesVMResponse_Plan9, + vm.Network: vmservice.CapabilitiesVMResponse_VMNic, + vm.Memory: vmservice.CapabilitiesVMResponse_Memory, + vm.Processor: vmservice.CapabilitiesVMResponse_Processor, +} + +func (uvm *utilityVM) ID() string { + return uvm.id +} + +func (uvm *utilityVM) Start(ctx context.Context) error { + // The expectation is the VM should be in a paused state after creation. + if _, err := uvm.client.ResumeVM(ctx, &ptypes.Empty{}); err != nil { + return errors.Wrap(err, "failed to start remote VM") + } + return nil +} + +func (uvm *utilityVM) Stop(ctx context.Context) error { + if _, err := uvm.client.TeardownVM(ctx, &ptypes.Empty{}); err != nil { + return errors.Wrap(err, "failed to stop remote VM") + } + return nil +} + +func (uvm *utilityVM) Wait() error { + _, err := uvm.client.WaitVM(context.Background(), &ptypes.Empty{}) + if err != nil { + uvm.waitError = err + return errors.Wrap(err, "failed to wait on remote VM") + } + return nil +} + +func (uvm *utilityVM) Pause(ctx context.Context) error { + if _, err := uvm.client.PauseVM(ctx, &ptypes.Empty{}); err != nil { + return errors.Wrap(err, "failed to pause remote VM") + } + return nil +} + +func (uvm *utilityVM) Resume(ctx context.Context) error { + if _, err := uvm.client.ResumeVM(ctx, &ptypes.Empty{}); err != nil { + return errors.Wrap(err, "failed to resume remote VM") + } + return nil +} + +func (uvm *utilityVM) Save(ctx context.Context) error { + return vm.ErrNotSupported +} + +func (uvm *utilityVM) Supported(resource vm.Resource, operation vm.ResourceOperation) bool { + var foundResource *vmservice.CapabilitiesVMResponse_SupportedResource + for _, supportedResource := range uvm.capabilities.SupportedResources { + if vmSupportedResourceToVMService[resource] == supportedResource.Resource { + foundResource = supportedResource + } + } + + supported := false + switch operation { + case vm.Add: + supported = foundResource.Add + case vm.Remove: + supported = foundResource.Remove + case vm.Update: + supported = foundResource.Update + default: + return false + } + + return supported +} + +func (uvm *utilityVM) ExitError() error { + return uvm.waitError +} diff --git a/internal/vm/remotevm/scsi.go b/internal/vm/remotevm/scsi.go new file mode 100644 index 0000000000..ba30dde4af --- /dev/null +++ b/internal/vm/remotevm/scsi.go @@ -0,0 +1,104 @@ +package remotevm + +import ( + "context" + "fmt" + + "github.com/Microsoft/hcsshim/internal/vm" + "github.com/Microsoft/hcsshim/internal/vmservice" + "github.com/pkg/errors" +) + +func getSCSIDiskType(typ vm.SCSIDiskType) (vmservice.DiskType, error) { + var diskType vmservice.DiskType + switch typ { + case vm.SCSIDiskTypeVHD1: + diskType = vmservice.DiskType_SCSI_DISK_TYPE_VHD1 + case vm.SCSIDiskTypeVHDX: + diskType = vmservice.DiskType_SCSI_DISK_TYPE_VHDX + case vm.SCSIDiskTypePassThrough: + diskType = vmservice.DiskType_SCSI_DISK_TYPE_PHYSICAL + default: + return -1, fmt.Errorf("unsupported SCSI disk type: %d", typ) + } + return diskType, nil +} + +func (uvmb *utilityVMBuilder) AddSCSIController(id uint32) error { + return nil +} + +func (uvmb *utilityVMBuilder) AddSCSIDisk(ctx context.Context, controller, lun uint32, path string, typ vm.SCSIDiskType, readOnly bool) error { + diskType, err := getSCSIDiskType(typ) + if err != nil { + return err + } + + disk := &vmservice.SCSIDisk{ + Controller: controller, + Lun: lun, + HostPath: path, + Type: diskType, + ReadOnly: readOnly, + } + + uvmb.config.DevicesConfig.ScsiDisks = append(uvmb.config.DevicesConfig.ScsiDisks, disk) + return nil +} + +func (uvmb *utilityVMBuilder) RemoveSCSIDisk(ctx context.Context, controller, lun uint32, path string) error { + return vm.ErrNotSupported +} + +func (uvm *utilityVM) AddSCSIController(id uint32) error { + return vm.ErrNotSupported +} + +func (uvm *utilityVM) AddSCSIDisk(ctx context.Context, controller, lun uint32, path string, typ vm.SCSIDiskType, readOnly bool) error { + diskType, err := getSCSIDiskType(typ) + if err != nil { + return err + } + + disk := &vmservice.SCSIDisk{ + Controller: controller, + Lun: lun, + HostPath: path, + Type: diskType, + ReadOnly: readOnly, + } + + if _, err := uvm.client.ModifyResource(ctx, + &vmservice.ModifyResourceRequest{ + Type: vmservice.ModifyType_ADD, + Resource: &vmservice.ModifyResourceRequest_ScsiDisk{ + ScsiDisk: disk, + }, + }, + ); err != nil { + return errors.Wrap(err, "failed to add SCSI disk") + } + + return nil +} + +func (uvm *utilityVM) RemoveSCSIDisk(ctx context.Context, controller, lun uint32, path string) error { + disk := &vmservice.SCSIDisk{ + Controller: controller, + Lun: lun, + HostPath: path, + } + + if _, err := uvm.client.ModifyResource(ctx, + &vmservice.ModifyResourceRequest{ + Type: vmservice.ModifyType_REMOVE, + Resource: &vmservice.ModifyResourceRequest_ScsiDisk{ + ScsiDisk: disk, + }, + }, + ); err != nil { + return errors.Wrapf(err, "failed to remove SCSI disk %q", path) + } + + return nil +} diff --git a/internal/vm/remotevm/serial.go b/internal/vm/remotevm/serial.go new file mode 100644 index 0000000000..599f7b5242 --- /dev/null +++ b/internal/vm/remotevm/serial.go @@ -0,0 +1,14 @@ +package remotevm + +import ( + "github.com/Microsoft/hcsshim/internal/vmservice" +) + +func (uvmb *utilityVMBuilder) SetSerialConsole(port uint32, listenerPath string) error { + config := &vmservice.SerialConfig_Config{ + Port: port, + SocketPath: listenerPath, + } + uvmb.config.SerialConfig.Ports = []*vmservice.SerialConfig_Config{config} + return nil +} diff --git a/internal/vm/remotevm/stats.go b/internal/vm/remotevm/stats.go new file mode 100644 index 0000000000..ca2a780280 --- /dev/null +++ b/internal/vm/remotevm/stats.go @@ -0,0 +1,12 @@ +package remotevm + +import ( + "context" + + "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats" + "github.com/Microsoft/hcsshim/internal/vm" +) + +func (uvm *utilityVM) Stats(ctx context.Context) (*stats.VirtualMachineStatistics, error) { + return nil, vm.ErrNotSupported +} diff --git a/internal/vm/remotevm/storage.go b/internal/vm/remotevm/storage.go new file mode 100644 index 0000000000..f2f7783316 --- /dev/null +++ b/internal/vm/remotevm/storage.go @@ -0,0 +1,18 @@ +package remotevm + +import ( + "github.com/pkg/errors" +) + +func (uvmb *utilityVMBuilder) SetStorageQos(iopsMaximum int64, bandwidthMaximum int64) error { + // The way that HCS handles these options is a bit odd. They launch the vmworker process in a job object and + // set the bandwidth and iops limits on the worker process' job object. To keep parity with what we expose today + // in HCS we can do the same here as we launch the server process in a job object. + if uvmb.job != nil { + if err := uvmb.job.SetIOLimit(bandwidthMaximum, iopsMaximum); err != nil { + return errors.Wrap(err, "failed to set storage qos values on remotevm process") + } + } + + return nil +} diff --git a/internal/vm/remotevm/vmsocket.go b/internal/vm/remotevm/vmsocket.go new file mode 100644 index 0000000000..048c9e48bd --- /dev/null +++ b/internal/vm/remotevm/vmsocket.go @@ -0,0 +1,93 @@ +package remotevm + +import ( + "context" + "io/ioutil" + "net" + "os" + + "github.com/Microsoft/go-winio/pkg/guid" + "github.com/Microsoft/hcsshim/internal/vm" + "github.com/Microsoft/hcsshim/internal/vmservice" + "github.com/pkg/errors" +) + +func (uvm *utilityVM) VMSocketListen(ctx context.Context, listenType vm.VMSocketType, connID interface{}) (_ net.Listener, err error) { + // Make a temp file and delete to "reserve" a unique name for the unix socket + f, err := ioutil.TempFile("", "") + if err != nil { + return nil, errors.Wrap(err, "failed to create temp file for unix socket") + } + + if err := f.Close(); err != nil { + return nil, errors.Wrap(err, "failed to close temp file") + } + + if err := os.Remove(f.Name()); err != nil { + return nil, errors.Wrap(err, "failed to delete temp file to free up name") + } + + l, err := net.Listen("unix", f.Name()) + if err != nil { + return nil, errors.Wrapf(err, "failed to listen on unix socket %q", f.Name()) + } + + defer func() { + if err != nil { + _ = l.Close() + } + }() + + switch listenType { + case vm.HvSocket: + serviceGUID, ok := connID.(guid.GUID) + if !ok { + return nil, errors.New("parameter passed to hvsocketlisten is not a GUID") + } + if err := uvm.hvSocketListen(ctx, serviceGUID.String(), f.Name()); err != nil { + return nil, errors.Wrap(err, "failed to setup relay to hvsocket listener") + } + case vm.VSock: + port, ok := connID.(uint32) + if !ok { + return nil, errors.New("parameter passed to vsocklisten is not the right type") + } + if err := uvm.vsockListen(ctx, port, f.Name()); err != nil { + return nil, errors.Wrap(err, "failed to setup relay to vsock listener") + } + default: + return nil, errors.New("unknown vmsocket type requested") + } + + return l, nil +} + +func (uvm *utilityVM) hvSocketListen(ctx context.Context, serviceID string, listenerPath string) error { + if _, err := uvm.client.VMSocket(ctx, &vmservice.VMSocketRequest{ + Type: vmservice.ModifyType_ADD, + Config: &vmservice.VMSocketRequest_HvsocketList{ + HvsocketList: &vmservice.HVSocketListen{ + ServiceID: serviceID, + ListenerPath: listenerPath, + }, + }, + }); err != nil { + return err + } + return nil +} + +func (uvm *utilityVM) vsockListen(ctx context.Context, port uint32, listenerPath string) error { + if _, err := uvm.client.VMSocket(ctx, &vmservice.VMSocketRequest{ + Type: vmservice.ModifyType_ADD, + Config: &vmservice.VMSocketRequest_VsockListen{ + VsockListen: &vmservice.VSockListen{ + Port: port, + ListenerPath: listenerPath, + }, + }, + }); err != nil { + return err + } + return nil +} diff --git a/internal/vm/remotevm/windows.go b/internal/vm/remotevm/windows.go new file mode 100644 index 0000000000..17aefa5422 --- /dev/null +++ b/internal/vm/remotevm/windows.go @@ -0,0 +1,21 @@ +package remotevm + +import ( + "context" + + "github.com/Microsoft/hcsshim/internal/cpugroup" + "github.com/Microsoft/hcsshim/internal/vmservice" +) + +func (uvmb *utilityVMBuilder) SetCPUGroup(ctx context.Context, id string) error { + if uvmb.config.WindowsOptions == nil { + uvmb.config.WindowsOptions = &vmservice.WindowsOptions{} + } + // Map from guid to the underlying hypervisor ID. + conf, err := cpugroup.GetCPUGroupConfig(ctx, id) + if err != nil { + return err + } + uvmb.config.WindowsOptions.CpuGroupID = conf.HypervisorGroupId + return nil +} diff --git a/internal/vm/vm.go b/internal/vm/vm.go index 0799d933f1..4e0b31ca5f 100644 --- a/internal/vm/vm.go +++ b/internal/vm/vm.go @@ -9,14 +9,10 @@ import ( ) var ( - ErrNotSupported = errors.New("virtstack does not support the operation") - ErrAlreadySet = errors.New("field has already been set") - ErrUnknownGuestOS = errors.New("unknown guest operating system supplied") - - ErrNotInPreCreatedState = errors.New("VM is not in pre-created state") - ErrNotInCreatedState = errors.New("VM is not in created state") - ErrNotInRunningState = errors.New("VM is not in running state") - ErrNotInPausedState = errors.New("VM is not in paused state") + ErrNotSupported = errors.New("virtstack does not support the operation") + ErrAlreadySet = errors.New("field has already been set") + ErrUnsupportedGuestOS = errors.New("virtstack does not support the guest operating system") + ErrUnknownGuestOS = errors.New("unknown guest operating system supplied") ) const ( @@ -76,6 +72,8 @@ const ( VSMB PCI Plan9 + Memory + Processor CPUGroup ) @@ -96,18 +94,6 @@ const ( Linux GuestOS = "linux" ) -// State signifies the states that a Utility VM can be in. The state of the Utility VM should be the source of truth for what -// operations can be performed at a given moment. -type State uint8 - -const ( - StatePreCreated State = iota - StateCreated - StateRunning - StateTerminated - StatePaused -) - // SCSIDiskType refers to the disk type of the scsi device. This is either a vhd, vhdx, or a physical disk. type SCSIDiskType uint8 diff --git a/internal/vmservice/vmservice.pb.go b/internal/vmservice/vmservice.pb.go index 417a109bf7..9a97c1c738 100644 --- a/internal/vmservice/vmservice.pb.go +++ b/internal/vmservice/vmservice.pb.go @@ -27,9 +27,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package -// -// Modify existing VM request/response -// type ModifyType int32 const ( @@ -176,9 +173,6 @@ func (CapabilitiesVMResponse_SupportedGuestOS) EnumDescriptor() ([]byte, []int) return fileDescriptor_272f12cfdaa6c7c8, []int{15, 1} } -// -// VM lifecycle request/response -// type DirectBoot struct { KernelPath string `protobuf:"bytes,1,opt,name=kernel_path,json=kernelPath,proto3" json:"kernel_path,omitempty"` InitrdPath string `protobuf:"bytes,2,opt,name=initrd_path,json=initrdPath,proto3" json:"initrd_path,omitempty"` @@ -555,7 +549,7 @@ func _VMConfig_OneofSizer(msg proto.Message) (n int) { // WindowsOptions contains virtual machine configurations that are only present on a Windows host. type WindowsOptions struct { - CpuGroupID uint32 `protobuf:"varint,1,opt,name=cpu_group_id,json=cpuGroupId,proto3" json:"cpu_group_id,omitempty"` + CpuGroupID uint64 `protobuf:"varint,1,opt,name=cpu_group_id,json=cpuGroupId,proto3" json:"cpu_group_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -676,8 +670,8 @@ var xxx_messageInfo_SerialConfig_Config proto.InternalMessageInfo type CreateVMRequest struct { Config *VMConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` // Optional ID to be used by the VM service in log messages. It's up to the - // server/virtstack to make use of this field. Useful for debugging to be able to - // correlate events in the virtstack for a given vm that the client launched. + // virtstack to make use of this field. Useful for debugging to be able to + // correlate events for a given vm that the client launched. LogID string `protobuf:"bytes,2,opt,name=log_id,json=logId,proto3" json:"log_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1121,7 +1115,6 @@ func (m *VSockListen) XXX_DiscardUnknown() { var xxx_messageInfo_VSockListen proto.InternalMessageInfo -// Abstraction around a hypervisor socket transport (Hvsocket, Vsock) type VMSocketRequest struct { Type ModifyType `protobuf:"varint,1,opt,name=type,proto3,enum=vmservice.ModifyType" json:"type,omitempty"` // Types that are valid to be assigned to Config: @@ -1971,95 +1964,95 @@ var fileDescriptor_272f12cfdaa6c7c8 = []byte{ 0x5e, 0xc8, 0xa3, 0x33, 0xab, 0x8c, 0x93, 0xf5, 0xc6, 0x3d, 0xa8, 0x67, 0x37, 0x51, 0x03, 0x96, 0x8e, 0xf1, 0x99, 0x4e, 0xb1, 0xe2, 0x13, 0x5d, 0x81, 0xe5, 0x13, 0xc7, 0x8f, 0xb1, 0xce, 0xa9, 0x6a, 0x71, 0x37, 0x7f, 0xdb, 0x68, 0x55, 0x01, 0xc4, 0x9d, 0xd5, 0x29, 0x66, 0x0b, 0xea, 0x59, - 0x85, 0xd1, 0xff, 0x41, 0xd5, 0x9d, 0xc4, 0xf6, 0x28, 0xa2, 0xf1, 0xc4, 0x26, 0x9e, 0x0a, 0xe3, - 0x56, 0xfd, 0xfc, 0xe5, 0x16, 0xb4, 0x27, 0xf1, 0x03, 0x41, 0xee, 0x75, 0x2c, 0x70, 0x93, 0x6f, - 0xcf, 0xfc, 0x8d, 0x01, 0xd5, 0xb4, 0x5b, 0xd0, 0x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x9b, 0xd0, 0x98, 0xb7, 0x10, 0xaa, 0xc0, 0x8a, - 0xce, 0xe6, 0x8d, 0x9c, 0x10, 0xf3, 0x90, 0x84, 0xf1, 0x8b, 0x86, 0x61, 0xba, 0x50, 0xef, 0x0e, - 0x07, 0x32, 0x57, 0x3e, 0x24, 0x8c, 0xe3, 0x10, 0x7d, 0x0a, 0xa0, 0xaf, 0x93, 0xe4, 0xf8, 0x72, - 0xab, 0x76, 0xfe, 0x72, 0xab, 0x3c, 0x50, 0xd4, 0x5e, 0xc7, 0x2a, 0x6b, 0x40, 0xcf, 0x13, 0x6d, - 0xb8, 0x2f, 0xf9, 0x70, 0x94, 0x4e, 0xbf, 0xd5, 0x84, 0x28, 0x13, 0xf0, 0x7d, 0xa8, 0xc8, 0x33, - 0xf4, 0x09, 0x17, 0x25, 0xf1, 0x1f, 0x25, 0xe7, 0xef, 0x06, 0xac, 0x0e, 0xfb, 0x4a, 0xdb, 0x24, - 0xaa, 0x3f, 0x86, 0x82, 0x88, 0x4c, 0x29, 0xac, 0x9e, 0xa9, 0xe9, 0x7d, 0xea, 0x91, 0xa3, 0x33, - 0x19, 0xbc, 0x12, 0x82, 0x7e, 0x01, 0xb5, 0xf1, 0x89, 0x2e, 0x15, 0x42, 0xee, 0x05, 0x81, 0x93, - 0xb5, 0x45, 0x37, 0x67, 0x55, 0x13, 0x0e, 0x41, 0x41, 0x3f, 0x83, 0xaa, 0x5c, 0xda, 0x4a, 0x2d, - 0xdd, 0xc4, 0xa4, 0xe3, 0x36, 0x75, 0xcf, 0x6e, 0xce, 0xaa, 0x48, 0xb4, 0x5a, 0xb6, 0x4a, 0x49, - 0x15, 0x33, 0xff, 0x6c, 0x40, 0x29, 0xe9, 0x33, 0xd1, 0x26, 0x80, 0x4b, 0x43, 0x1e, 0x51, 0xdf, - 0xc7, 0x91, 0xb6, 0x49, 0x8a, 0x22, 0xde, 0xac, 0x1f, 0x87, 0xba, 0x4a, 0x88, 0x4f, 0x31, 0x38, - 0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d, 0x4a, 0x98, 0x0f, 0x7b, 0x09, 0x72, 0x49, 0x55, 0x9f, 0x84, 0x3c, 0x03, 0x3a, 0x8c, + 0x91, 0x51, 0x38, 0x03, 0x16, 0x14, 0x30, 0x21, 0x2b, 0xa0, 0x79, 0x17, 0xea, 0xd3, 0x9c, 0xa2, + 0x54, 0xff, 0x08, 0x1a, 0x9c, 0x72, 0xc7, 0xb7, 0xa3, 0x38, 0xe4, 0x24, 0xc0, 0x76, 0x98, 0x68, + 0x5e, 0x97, 0x74, 0x4b, 0x91, 0x1f, 0x31, 0xf3, 0xb7, 0x06, 0xac, 0x1d, 0x44, 0x74, 0x82, 0x23, + 0x4e, 0x30, 0x9b, 0x39, 0xa4, 0x0d, 0xcb, 0xfc, 0x6c, 0x82, 0x55, 0xd2, 0xaf, 0x37, 0x3f, 0xcb, + 0xe6, 0xaf, 0x79, 0x78, 0x8a, 0xf6, 0xf8, 0x6c, 0x82, 0x2d, 0xc5, 0x6b, 0x7e, 0x22, 0x15, 0x4b, + 0x6d, 0x20, 0x80, 0xa2, 0x52, 0xba, 0x91, 0x43, 0x35, 0x28, 0x4f, 0xd5, 0x6e, 0x18, 0xe6, 0x1f, + 0x0d, 0xb8, 0x92, 0x15, 0xad, 0xfd, 0x78, 0x07, 0x74, 0x96, 0xb5, 0x99, 0xb8, 0xdc, 0xd4, 0x9b, + 0xf3, 0x29, 0x59, 0x5e, 0xdd, 0xaa, 0x04, 0x29, 0x17, 0xb6, 0xd2, 0xa5, 0x4f, 0x71, 0xe7, 0x17, + 0x32, 0x4d, 0xd6, 0x76, 0xa9, 0xaa, 0x28, 0xd7, 0xe6, 0xef, 0x0a, 0x70, 0xb5, 0xed, 0x4c, 0x9c, + 0x43, 0xe2, 0x93, 0x39, 0xcd, 0x3c, 0x58, 0x63, 0xf1, 0x44, 0xc4, 0x15, 0xf6, 0xec, 0x08, 0x33, + 0x1a, 0x47, 0x2e, 0x4e, 0xea, 0xe4, 0xad, 0xd4, 0x11, 0x17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, 0x6c, 0xae, 0xaf, 0xb9, 0x94, 0xff, 0xa7, 0x50, 0xf8, 0x3a, + 0x26, 0xfc, 0x75, 0x3d, 0xd5, 0xfa, 0xe0, 0xbb, 0xef, 0x37, 0x73, 0xff, 0xfc, 0x7e, 0x33, 0xf7, + 0xeb, 0xf3, 0x4d, 0xe3, 0xbb, 0xf3, 0x4d, 0xe3, 0x1f, 0xe7, 0x9b, 0xc6, 0xbf, 0xcf, 0x37, 0x8d, + 0x6f, 0x66, 0x3f, 0x95, 0x0f, 0x8b, 0x92, 0xe9, 0xd6, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x96, + 0xae, 0xa5, 0x20, 0xa9, 0x16, 0x00, 0x00, } func (m *DirectBoot) Marshal() (dAtA []byte, err error) { @@ -6206,7 +6199,7 @@ func (m *WindowsOptions) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CpuGroupID |= uint32(b&0x7F) << shift + m.CpuGroupID |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/internal/vmservice/vmservice.proto b/internal/vmservice/vmservice.proto index 81645fb9b5..be32b09e8b 100644 --- a/internal/vmservice/vmservice.proto +++ b/internal/vmservice/vmservice.proto @@ -109,7 +109,7 @@ message VMConfig { // WindowsOptions contains virtual machine configurations that are only present on a Windows host. message WindowsOptions { - uint32 cpu_group_id = 1; + uint64 cpu_group_id = 1; } message SerialConfig {