...

Source file src/github.com/Microsoft/hcsshim/osversion/platform_compat_windows.go

Documentation: github.com/Microsoft/hcsshim/osversion

     1  package osversion
     2  
     3  // List of stable ABI compliant ltsc releases
     4  // Note: List must be sorted in ascending order
     5  var compatLTSCReleases = []uint16{
     6  	V21H2Server,
     7  }
     8  
     9  // CheckHostAndContainerCompat checks if given host and container
    10  // OS versions are compatible.
    11  // It includes support for stable ABI compliant versions as well.
    12  // Every release after WS 2022 will support the previous ltsc
    13  // container image. Stable ABI is in preview mode for windows 11 client.
    14  // Refer: https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-10#windows-server-host-os-compatibility
    15  func CheckHostAndContainerCompat(host, ctr OSVersion) bool {
    16  	// check major minor versions of host and guest
    17  	if host.MajorVersion != ctr.MajorVersion ||
    18  		host.MinorVersion != ctr.MinorVersion {
    19  		return false
    20  	}
    21  
    22  	// If host is < WS 2022, exact version match is required
    23  	if host.Build < V21H2Server {
    24  		return host.Build == ctr.Build
    25  	}
    26  
    27  	var supportedLtscRelease uint16
    28  	for i := len(compatLTSCReleases) - 1; i >= 0; i-- {
    29  		if host.Build >= compatLTSCReleases[i] {
    30  			supportedLtscRelease = compatLTSCReleases[i]
    31  			break
    32  		}
    33  	}
    34  	return ctr.Build >= supportedLtscRelease && ctr.Build <= host.Build
    35  }
    36  

View as plain text