Skip to content

Commit 9d0b60e

Browse files
committed
Bypass default encryption policy when expanding sandbox vhdx
This fixes the following error when running on machines with a policy to enforce bitlocker encryption on fixed drives ``` failed to create scratch layer: failed to expand sandbox vhdx size to #### bytes: FSCTL_EXTEND_VOLUME \\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}: The media is write protected. ``` Fixed: #2464 Signed-off-by: Matthew Endsley <mendsley@gmail.com>
1 parent 59e0e2f commit 9d0b60e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/wclayer/expandscratchsize.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"syscall"
1010
"unsafe"
1111

12+
"github.com/Microsoft/go-winio/vhd"
1213
"github.com/Microsoft/hcsshim/internal/hcserror"
1314
"github.com/Microsoft/hcsshim/internal/oc"
1415
"go.opencensus.io/trace"
@@ -75,7 +76,7 @@ func attachVhd(path string) (syscall.Handle, error) {
7576
if err != nil {
7677
return 0, &os.PathError{Op: "OpenVirtualDisk", Path: path, Err: err}
7778
}
78-
err = attachVirtualDisk(handle, 0, 0, 0, 0, 0)
79+
err = vhd.AttachVirtualDisk(handle, vhd.AttachVirtualDiskFlagBypassDefaultEncryptionPolicy, nil)
7980
if err != nil {
8081
syscall.Close(handle)
8182
return 0, &os.PathError{Op: "AttachVirtualDisk", Path: path, Err: err}

0 commit comments

Comments
 (0)