From 3cd77f39f5df37ca4476454af401682c6aa7870d Mon Sep 17 00:00:00 2001 From: Daniel Canter Date: Wed, 21 Apr 2021 11:07:17 -0700 Subject: [PATCH] Add VmEndpointRequest for eventual usage in the shim HCS today for adding a network adapter to a virtual machine sets up the switch port itself by making a VmEndpointRequest. There are cases where we will want to do this ourselves, and we need the switch ID for this which will only exist after this request. Signed-off-by: Daniel Canter --- hcn/hcn.go | 13 +++++++------ hcn/hcnendpoint.go | 8 ++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hcn/hcn.go b/hcn/hcn.go index ed311fed9d..2760152f12 100644 --- a/hcn/hcn.go +++ b/hcn/hcn.go @@ -3,6 +3,7 @@ package hcn import ( + "encoding/json" "fmt" "syscall" @@ -93,12 +94,12 @@ type HostComputeQuery struct { } type ExtraParams struct { - Resources interface{} `json:",omitempty"` - SharedContainers interface{} `json:",omitempty"` - LayeredOn string `json:",omitempty"` - SwitchGuid string `json:",omitempty"` - UtilityVM string `json:",omitempty"` - VirtualMachine string `json:",omitempty"` + Resources json.RawMessage `json:",omitempty"` + SharedContainers json.RawMessage `json:",omitempty"` + LayeredOn string `json:",omitempty"` + SwitchGuid string `json:",omitempty"` + UtilityVM string `json:",omitempty"` + VirtualMachine string `json:",omitempty"` } type Health struct { diff --git a/hcn/hcnendpoint.go b/hcn/hcnendpoint.go index e02146f8ca..545e8639d6 100644 --- a/hcn/hcnendpoint.go +++ b/hcn/hcnendpoint.go @@ -37,6 +37,7 @@ type HostComputeEndpoint struct { Routes []Route `json:",omitempty"` MacAddress string `json:",omitempty"` Flags EndpointFlags `json:",omitempty"` + Health Health `json:",omitempty"` SchemaVersion SchemaVersion `json:",omitempty"` } @@ -58,6 +59,13 @@ type ModifyEndpointSettingRequest struct { Settings json.RawMessage `json:",omitempty"` } +// VmEndpointRequest creates a switch port with identifier `PortId`. +type VmEndpointRequest struct { + PortId guid.GUID `json:",omitempty"` + VirtualNicName string `json:",omitempty"` + VirtualMachineId guid.GUID `json:",omitempty"` +} + type PolicyEndpointRequest struct { Policies []EndpointPolicy `json:",omitempty"` }