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

win_partition - Fix handling of maximum partition size #58225

Merged
merged 2 commits into from
Sep 25, 2019
Merged

win_partition - Fix handling of maximum partition size #58225

merged 2 commits into from
Sep 25, 2019

Conversation

varunchopra
Copy link
Contributor

SUMMARY

Fixes #56910

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

win_partition

ADDITIONAL INFORMATION

Doesn't resize the partition if the difference is ~1MiB +/- from the original partition size according to my post here: #56910 (comment) This issue is prevalent in partitions with large disk sizes so it's still not covered by these integration tests.

I've also removed -UseMaximumSize and specified the maximum supported size directly.

@ansibot
Copy link
Contributor

ansibot commented Jun 22, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community support:community This issue/PR relates to code supported by the Ansible community. labels Jun 22, 2019
@ShachafGoldstein
Copy link
Contributor

Any way to test the 1mb issue in the ci?
and, maybe use 1MB and not the actual length in the if since powershell translates it and it will be more readable.

another question for the crowd, should the module send out a warning when this issue occurs?

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Jun 22, 2019
@varunchopra
Copy link
Contributor Author

Any way to test the 1mb issue in the ci?

I'm not sure about the free space available on the server at the time of testing. I think at the time of writing this, I kept the 1 GB partition for the sake of the CI so I'm not sure how much space is OK for us to use.

and, maybe use 1MB and not the actual length in the if since powershell translates it and it will be more readable.

I kept it in bytes to reduce conversions but I can do this is needed too.

another question for the crowd, should the module send out a warning when this issue occurs?

It would throw a warning most of the time though, making users think something is wrong with it. Not sure how to approach this either - perhaps a note in the docs?

@ShachafGoldstein
Copy link
Contributor

If you'll run Measure-Command {1MB} you can see the conversion is not an issue

@varunchopra
Copy link
Contributor Author

varunchopra commented Jun 24, 2019

I'm probably wrong but it seems like the way of doing this would be to replace:

($ansible_partition_size - $ansible_partition.Size -gt 1049000 -or $ansible_partition.Size - $ansible_partition_size -gt 1049000)

with:

([Math]::Round(($ansible_partition_size - $ansible_partition.Size)/1MB) -le 1 -or [Math]::Round(($ansible_partition.Size - $ansible_partition_size)/1MB) -le 1)

Or is there another way of doing this seeing how direct conversion to MiB isn't possible?

@ShachafGoldstein
Copy link
Contributor

ShachafGoldstein commented Jun 24, 2019 via email

@varunchopra
Copy link
Contributor Author

It must be less than 1 MiB not 1 MB though.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 2, 2019
@branic
Copy link
Contributor

branic commented Jul 5, 2019

You could simplify the if statement and math by doing:

[Math]::Abs(($ansible_partition_size - $ansible_partition.Size)/1024/1024) -gt 1

The 1024/1024 could be replaced by 1048576 (or 104900), but to me the 1024/1024 is clearer.

@varunchopra
Copy link
Contributor Author

Looking for signs of life. @jborean93 @nitzmahone Please let me know if I need to go on with this. Not sure if I'd be able to contribute later.

@jborean93
Copy link
Contributor

Sorry about that @chopraaa

rebuild_merge

@ansibot ansibot added shipit This PR is ready to be merged by Core needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. shipit This PR is ready to be merged by Core needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Sep 25, 2019
@ansibot ansibot added the shipit This PR is ready to be merged by Core label Sep 25, 2019
@ansibot ansibot merged commit 7dfd994 into ansible:devel Sep 25, 2019
@ansible ansible locked and limited conversation to collaborators Oct 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. has_issue module This issue/PR relates to a module. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. windows Windows community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The size of the extent is less than the minimum of 1MB
5 participants