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

Add the volume to the root disk (vda) if the selected flavor has a ro… #894

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Dhamo1107
Copy link

This Pull Request addresses the handling of root disk provisioning when using flavors with a root disk size of 0. Specifically, if a flavor has a root disk size of 0, the volume provided during provisioning will be designated as the root disk (vda). Conversely, if the flavor has a non-zero root disk size (e.g., 100GB), the specified volume will be treated as an additional volume (vdb).

Before the change:

  • Volume specified during provisioning would not be correctly set as the root disk when using a 0 root disk size flavor (10GB volume specified on the add volume page is assigned under vdb).
    image

After the change:

  • Volume specified during provisioning is correctly assigned as the root disk (vda) if the flavor's root disk size is 0 (25GB volume specified on the add volume page is assigned under vda).
    image

  • Additional volumes specified will automatically come under vdb when the flavor has a root disk size greater than 0 (With a 100GB root disk size flavor, the root disk is assigned under vda, while the 50GB volume specified on the add volume page is assigned under vdb).
    image

Fixes [#892]

…ot disk size of 0 during instance provisioning
@agrare
Copy link
Member

agrare commented Oct 24, 2024

We should have spec tests covering this new case, I'll write some up and push to your branch if that is okay with you @Dhamo1107

@agrare
Copy link
Member

agrare commented Oct 24, 2024

Specs look like they fail to start due to ManageIQ/manageiq-schema#757 this should be resolved shortly

@agrare
Copy link
Member

agrare commented Oct 24, 2024

Since I have a significant amount of (test) code in here now I'm going to assign to @Fryguy

@Fryguy I refactored the openstack volume_attachment specs to make it easier to write the following tests in a separate commit (79b51f4), then this commit adds tests (8eb0bdc)

@agrare agrare assigned Fryguy and unassigned agrare Oct 24, 2024
@agrare agrare added the bug label Oct 24, 2024
Comment on lines +8 to +9
if instance_type.root_disk_size == 0 # Handle root disk logic only when root_disk_size is 0
if index == 0 # The first volume should be the root disk, typically assigned to vda
Copy link
Member

@agrare agrare Oct 24, 2024

Choose a reason for hiding this comment

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

This might be better done up above like

     # Handle root disk logic only when root_disk_size is 0
    if instance_type.root_disk_size > 0
      volumes_attrs_list = [default_volume_attributes]
    else
      volumes_attrs_list = []
      # The first volume should be the root disk, typically assigned to vda
      requested_volumes.first&.merge!(:imageRef => source.ems_ref, :bootable => true, :boot_index => 0)
    end

NOTE do the other requested volumes have to have boot_index = -1? It doesn't appear that they did before.

Copy link
Member

Choose a reason for hiding this comment

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

I don't really like the -1, but if that we there previously, then it's fine. I would think null would be a better choice.

@agrare agrare closed this Oct 24, 2024
@agrare agrare reopened this Oct 24, 2024
allow(service).to receive_message_chain('volumes.create').and_return @volume
allow(@task.source.ext_management_system).to receive(:with_provider_connection)\
before do
allow(service).to receive_message_chain('volumes.create').and_return(volume)
Copy link
Member

Choose a reason for hiding this comment

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

I see this was here already, but I generally prefer

Suggested change
allow(service).to receive_message_chain('volumes.create').and_return(volume)
allow(service).to receive_message_chain(:volumes, :create).and_return(volume)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it was here previously, I do have a "cleanup specs" commit in here already though so I'd rather change all of them to be consistent

@Fryguy
Copy link
Member

Fryguy commented Oct 30, 2024

Overall LGTM- have one question about -1 vs null

This spec made heavy use of instance vars rather than `let()` which
makes it more difficult to override these in sub-contexts.
If a flavor has no root disk we have to set up the bootable volume
manually based on the first requested volume.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants