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

fix: resize is required after snapshot restore/volume clone on Windows #2733

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

andyzhangx
Copy link
Member

@andyzhangx andyzhangx commented Dec 13, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
fix: resize is required after snapshot restore/volume clone on Windows

we use Get-Volume -UniqueId \"$Env:volumeID\" | Get-partition | Get-PartitionSupportedSize | Select SizeMax
to get the targetVolumeSize, and we use following command to get the currentVolumeSize

(Get-Volume -UniqueId \"$Env:volumeID\\" | Get-partition).Size

if targetVolumeSize > currentVolumeSize, then we should resize.

But as following example, you could see for a 29.98 GB disk, just right after it's formatted, targetVolumeSize is always bigger than currentVolumeSize (just 1MB bigger), so resize operation would always happen. I think this is a bug, only if targetVolumeSize > currentVolumeSize + 1GB, then we should perform resize operation, in that case, NodeStageVolume should succeed.

(Get-Disk -Number 3 | Get-Partition | Get-Volume).UniqueId
PS C:\> Get-Volume -UniqueId "\\?\Volume{ccfda246-2790-4cf3-9fbf-37a62e1f9f6d}\" | Get-partition
   DiskPath: \\?\scsi#disk&ven_msft&prod_virtual_disk#6&23db5f40&0&000001#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}

PartitionNumber  DriveLetter Offset                                                           Size Type
---------------  ----------- ------                                                           ---- ----
2                G           16777216                                                     29.98 GB Basic

PS C:\> (Get-Volume -UniqueId "\\?\Volume{ccfda246-2790-4cf3-9fbf-37a62e1f9f6d}\" | Get-partition).Size
32194428928
PS C:\> Get-Volume -UniqueId "\\?\Volume{ccfda246-2790-4cf3-9fbf-37a62e1f9f6d}\" | Get-partition | Get-PartitionSupportedSize | Select SizeMax

    SizeMax
    -------
32195460608

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 13, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 13, 2024
@andyzhangx andyzhangx merged commit 4d7d7bb into kubernetes-sigs:master Dec 14, 2024
22 of 23 checks passed
@andyzhangx
Copy link
Member Author

/cherrypick release-1.31

@k8s-infra-cherrypick-robot

@andyzhangx: #2733 failed to apply on top of branch "release-1.31":

Applying: fix: resize is required after snapshot restore/volume clone on Windows
Using index info to reconstruct a base tree...
M	pkg/os/volume/volume.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/os/volume/volume.go
CONFLICT (content): Merge conflict in pkg/os/volume/volume.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 fix: resize is required after snapshot restore/volume clone on Windows

In response to this:

/cherrypick release-1.31

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@andyzhangx
Copy link
Member Author

/cherrypick release-1.31

@k8s-infra-cherrypick-robot

@andyzhangx: new pull request created: #2734

In response to this:

/cherrypick release-1.31

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@andyzhangx
Copy link
Member Author

/cherrypick release-1.30

@k8s-infra-cherrypick-robot

@andyzhangx: new pull request created: #2754

In response to this:

/cherrypick release-1.30

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants