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

Native disk update #697

Merged
merged 2 commits into from
Sep 5, 2024
Merged

Conversation

s4heid
Copy link
Contributor

@s4heid s4heid commented Aug 27, 2024

Summary

This change introduces a new cloud method called update_disk, which can be used to update disk parameters on an existing Azure Disk. Disk size and storage account type can be changed on any data disk. For storage account types PremiumV2_LRS and Ultra Disks, iops and throughput (mbps) can also be changed.

Relates to: cloudfoundry/bosh#2496

Checklist:

Please check each of the boxes below for which you have completed the corresponding task:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • All unit tests pass locally (after my changes)
  • Rubocop reports zero offenses (after my changes) -- there is a complexity violation in the disk manager. either we disable the check for the method or we can discuss if you prefer a different solution.

Please include below the summary portions of the output from the following 2 scripts:

pushd src/bosh_azure_cpi
  ./bin/test-unit
  ./bin/rubocop_check
popd

NOTE: Please see how to setup dev environment and run unit tests in docs/development.md.

Unit Test output:

Finished in 6.62 seconds (files took 0.73321 seconds to load)
1044 examples, 0 failures

Integration Test output:

$ bundle exec rspec ./spec/integration
...
Finished in 1 minute 17.39 seconds (files took 0.43431 seconds to load)
3 examples, 0 failures

Rubocop output:

Inspecting 190 files
.......C........................................C.............................................................................................................................................

Offenses:

lib/cloud/azure/disk/disk_manager2.rb:48:5: C: Metrics/ParameterLists: Method has too many optional parameters. [4/3]
    def update_disk(disk_id, size = nil, storage_account_type = nil, iops = nil, mbps = nil) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/cloud/azure/vms/vm_manager.rb:21:5: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<87, 178, 53> 205.1/192]
    def create(bosh_vm_meta, location, vm_props, disk_cids, network_configurator, env, agent_settings, network_spec, config) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/cloud/azure/vms/vm_manager.rb:21:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for create is too high. [45/39]
    def create(bosh_vm_meta, location, vm_props, disk_cids, network_configurator, env, agent_settings, network_spec, config) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/cloud/azure/vms/vm_manager.rb:21:5: C: Metrics/MethodLength: Method has too many lines. [189/184]
    def create(bosh_vm_meta, location, vm_props, disk_cids, network_configurator, env, agent_settings, network_spec, config) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/cloud/azure/vms/vm_manager.rb:21:5: C: Metrics/PerceivedComplexity: Perceived complexity for create is too high. [50/45]
    def create(bosh_vm_meta, location, vm_props, disk_cids, network_configurator, env, agent_settings, network_spec, config) ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

190 files inspected, 5 offenses detected

Changelog

  • The update_disk cloud method has been introduced, allowing updates to disk parameters for Azure Disks, including disk size and storage account type. For PremiumV2_LRS and Ultra Disks, IOPS and throughput (mbps) adjustments are now possible.

s4heid added 2 commits August 27, 2024 16:26
This change introduces a new cloud method called `update_disk`, which can be
used to update disk parameters on an existing Azure Disk. Disk size and storage
account type can be changed on any data disk. For storage account types
PremiumV2_LRS and Ultra Disks, iops and throughput (mbps) can also be changed.
@jpalermo jpalermo requested review from a team, aramprice and ramonskie and removed request for a team August 29, 2024 15:17
Copy link
Member

@aramprice aramprice left a comment

Choose a reason for hiding this comment

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

This seems good from a structural perspective. I don't have much context on the Azure internals so it may be helpful to have input from others who have more Azure experience.

Copy link
Contributor

@MSSedusch MSSedusch left a comment

Choose a reason for hiding this comment

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

lgtm

@rkoster rkoster merged commit 6f80cb1 into cloudfoundry:master Sep 5, 2024
1 check passed
@rkoster
Copy link
Contributor

rkoster commented Sep 5, 2024

Thanks! @s4heid

@s4heid s4heid deleted the native-disk-update branch September 9, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants