Skip to content

Commit f040705

Browse files
authored
uvm: omit default WCIFS FilterType for older GCS compatibility (#2739)
CombinedLayers.FilterType was added in HCS schema 2.9. Inbox GCS on older Windows hosts (e.g. WS2022) uses a strict JSON unmarshaller that rejects the unknown field with HCS_E_INVALID_JSON. Since WCIFS is the GCS default when the field is absent, clear it so `omitempty` drops it from the wire format. Refs: #2714 Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
1 parent 1873501 commit f040705

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

internal/uvm/combine_layers.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ func (uvm *UtilityVM) CombineLayersWCOW(ctx context.Context, layerPaths []hcssch
1919
return errNotSupported
2020
}
2121

22+
// FilterType was added to the CombinedLayers HCS schema in version 2.9.
23+
// Inbox GCS (vmcomputeagent.exe) on older Windows hosts (e.g. Windows
24+
// Server 2022) ships a pre-2.9 schema and uses a strict JSON unmarshaller
25+
// that rejects unknown fields with HCS_E_INVALID_JSON ("$.FilterType").
26+
// Since WCIFS is the default behavior on the GCS side when the field is
27+
// absent, drop the value here so the `omitempty` JSON tag removes it from
28+
// the wire format. This preserves behavior on newer GCS (which also defaults
29+
// to WCIFS) while remaining compatible with older inbox GCS.
30+
// See: https://github.com/microsoft/hcsshim/issues/2714
31+
if filterType == hcsschema.WCIFS {
32+
filterType = ""
33+
}
34+
2235
var modifyRequest *hcsschema.ModifySettingRequest
2336
if uvm.HasConfidentialPolicy() {
2437
modifyRequest = &hcsschema.ModifySettingRequest{

0 commit comments

Comments
 (0)