From 12b02a180881297d330d6261e166a97a79023fe2 Mon Sep 17 00:00:00 2001 From: Maksim An Date: Tue, 15 Feb 2022 14:02:28 -0800 Subject: [PATCH] Fix bugs in network setup introduced by a refactor PR (#1299) When consolidating guest protocol into its own package in https://github.com/microsoft/hcsshim/pull/1240 wrong constant definition was used for adding a network namespace. Fix this by using the correct constants. Signed-off-by: Maksim An --- internal/uvm/network.go | 4 ++-- .../github.com/Microsoft/hcsshim/internal/uvm/network.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/uvm/network.go b/internal/uvm/network.go index eb800bc4db..dca3ad5ab9 100644 --- a/internal/uvm/network.go +++ b/internal/uvm/network.go @@ -345,7 +345,7 @@ func (uvm *UtilityVM) AddNetNS(ctx context.Context, hcnNamespace *hcn.HostComput guestNamespace := hcsschema.ModifySettingRequest{ GuestRequest: guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeNetworkNamespace, - RequestType: guestrequest.RequestTypeRemove, + RequestType: guestrequest.RequestTypeAdd, Settings: hcnNamespace, }, } @@ -686,7 +686,7 @@ func (uvm *UtilityVM) AddNICInGuest(ctx context.Context, cfg *guestresource.LCOW request := hcsschema.ModifySettingRequest{} request.GuestRequest = guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeNetwork, - RequestType: guestrequest.RequestTypePreAdd, + RequestType: guestrequest.RequestTypeAdd, Settings: cfg, } diff --git a/test/vendor/github.com/Microsoft/hcsshim/internal/uvm/network.go b/test/vendor/github.com/Microsoft/hcsshim/internal/uvm/network.go index eb800bc4db..dca3ad5ab9 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/internal/uvm/network.go +++ b/test/vendor/github.com/Microsoft/hcsshim/internal/uvm/network.go @@ -345,7 +345,7 @@ func (uvm *UtilityVM) AddNetNS(ctx context.Context, hcnNamespace *hcn.HostComput guestNamespace := hcsschema.ModifySettingRequest{ GuestRequest: guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeNetworkNamespace, - RequestType: guestrequest.RequestTypeRemove, + RequestType: guestrequest.RequestTypeAdd, Settings: hcnNamespace, }, } @@ -686,7 +686,7 @@ func (uvm *UtilityVM) AddNICInGuest(ctx context.Context, cfg *guestresource.LCOW request := hcsschema.ModifySettingRequest{} request.GuestRequest = guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeNetwork, - RequestType: guestrequest.RequestTypePreAdd, + RequestType: guestrequest.RequestTypeAdd, Settings: cfg, }