Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass disk handle for computestorage.FormatWritableLayerVhd on RS5 #1204

Merged
merged 2 commits into from
Nov 6, 2021

Conversation

dcantah
Copy link
Contributor

@dcantah dcantah commented Oct 21, 2021

On RS5 the HcsFormatWritableLayerVhd call expects to receive a disk handle.
On 19h1+ you can pass a vhd handle and internally they will do the same
work we're doing in this change to grab a disk handle to perform the format.

Signed-off-by: Daniel Canter dcanter@microsoft.com

@dcantah dcantah requested a review from a team as a code owner October 21, 2021 17:00
@dcantah dcantah force-pushed the computestorage-diskhandle branch 2 times, most recently from 378d627 to 8b76d52 Compare October 21, 2021 17:08
On RS5 the HcsFormatWritableLayerVhd call expects to receive a disk handle.
On 19h1+ you can pass a vhd handle and internally they will do the same
work we're doing in this change to grab a disk handle to perform the format.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
computestorage/format.go Outdated Show resolved Hide resolved
@dcantah
Copy link
Contributor Author

dcantah commented Oct 21, 2021

@helsaawy Wanna take a look at this one? :)

Fix DetachVHD error check and assignment.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
@helsaawy helsaawy self-requested a review October 22, 2021 22:26
@helsaawy
Copy link
Contributor

lgtm 👍

if err != nil {
return err
}
defer windows.CloseHandle(diskHandle) // nolint: errcheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to close this handle but we don't close the handle that's created if this section of code doesn't run?

Copy link
Contributor Author

@dcantah dcantah Nov 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't handle closing the vhd handle passed in as it's expected the caller will close it. This function owns this new disk handle essentially so we need to close it ourselves if we hit this path.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay, makes sense

@dcantah dcantah merged commit aaf5db9 into microsoft:master Nov 6, 2021
dcantah added a commit to dcantah/hcsshim that referenced this pull request Aug 1, 2022
… RS5 (microsoft#1204)"

This reverts commit aaf5db9.

We'd added a change to FormatWritableLayerVhd to help the caller work around
a breaking change in the OS, but this would actually cause a breaking change
in our wrapper of it if the caller was already working around the issue
themselves. To avoid this scenario, revert the commit that added the
"friendly" behavior.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
dcantah added a commit to dcantah/hcsshim that referenced this pull request Aug 3, 2022
… RS5 (microsoft#1204)"

This reverts commit aaf5db9.

We'd added a change to FormatWritableLayerVhd to help the caller work around
a breaking change in the OS, but this would actually cause a breaking change
in our wrapper of it if the caller was already working around the issue
themselves. To avoid this scenario, revert the commit that added the
"friendly" behavior.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants