Skip to content

Commit

Permalink
Document breaking change in HcsFormatWritableLayerVhd
Browse files Browse the repository at this point in the history
Add a comment on our wrapper of HcsFormatWritableLayerVhd to describe that
it expects a different handle on anything above ws2019. Additionally add
a comment above SetupBaseOSVolume stating what build it's supported on.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
  • Loading branch information
dcantah committed Aug 3, 2022
1 parent a177a5a commit 7007547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions computestorage/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (
// FormatWritableLayerVhd formats a virtual disk for use as a writable container layer.
//
// If the VHD is not mounted it will be temporarily mounted.
//
// NOTE: This API had a breaking change in the operating system after Windows Server 2019.
// On ws2019 the API expects to get passed a file handle from CreateFile for the vhd that
// the caller wants to format. On > ws2019, its expected that the caller passes a vhd handle
// that can be obtained from the virtdisk APIs.
func FormatWritableLayerVhd(ctx context.Context, vhdHandle windows.Handle) (err error) {
title := "hcsshim::FormatWritableLayerVhd"
ctx, span := oc.StartSpan(ctx, title) //nolint:ineffassign,staticcheck
Expand Down
3 changes: 3 additions & 0 deletions computestorage/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func SetupBaseOSLayer(ctx context.Context, layerPath string, vhdHandle windows.H
// `volumePath` is the path to the volume to be used for setup.
//
// `options` are the options applied while processing the layer.
//
// NOTE: This API is only available on builds of Windows greater than 19645. The client
// will need to handle if this is safe to call.
func SetupBaseOSVolume(ctx context.Context, layerPath, volumePath string, options OsLayerOptions) (err error) {
if osversion.Build() < 19645 {
return errors.New("SetupBaseOSVolume is not present on builds older than 19645")
Expand Down

0 comments on commit 7007547

Please sign in to comment.