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

Issue in provisioning instance with zero root disk flavor in OpenStack #892

Closed
Dhamo1107 opened this issue Oct 9, 2024 · 16 comments · Fixed by #894
Closed

Issue in provisioning instance with zero root disk flavor in OpenStack #892

Dhamo1107 opened this issue Oct 9, 2024 · 16 comments · Fixed by #894
Assignees
Labels

Comments

@Dhamo1107
Copy link
Contributor

OpenStack Behavior:

In OpenStack, while launching an instance with a zero root disk flavor, the following options are available under the "Source" tab:

  • Select Boot Source:

    • Options: Image, Instance Snapshot, Volume, Volume Snapshot
  • Create New Volume: Yes/No

    • If "Yes" is selected, additional fields appear:

      • Volume Size (GB): (Field to input volume size in GB)

      • Delete Volume on Instance Delete: Yes/No

For example, if "Create New Volume" is selected as "Yes" and a volume size of 1GB is specified, this volume is treated as the root disk.
image
image

Issue in ManageIQ:

In ManageIQ, there seems to be no option to specify a root disk size while provisioning an instance with a zero root disk flavor. If we try to add a volume using the "Add Volume" option in the instance provisioning page, the volume is attached as an additional volume instead of being treated as the root disk.
image
image

Request:
Could you guide us on how to add root disk space while provisioning an instance with a zero root disk flavor type in ManageIQ? If this feature does not exist, would it be possible to implement a way to handle root disk size in this scenario?

Steps to Reproduce:
Provision an instance with a zero root disk flavor in OpenStack via ManageIQ.
Attempt to add a root disk volume during provisioning.

Expected Behavior:
The ability to specify and add root disk size during instance provisioning with zero root disk flavor in ManageIQ, similar to the OpenStack behavior.

Actual Behavior:
The "Add Volume" option adds an additional volume but does not handle root disk size.

ManageIQ version: Petrosian

@Dhamo1107 Dhamo1107 added the bug label Oct 9, 2024
@agrare agrare self-assigned this Oct 9, 2024
@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

I would like to know if there are any updates on this issue. Please let me know if further information is needed from my side.

Thank you!

@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

By using OpenStack's "Create New Volume" option, the volume is added under /vda.

However, when trying to add a volume using ManageIQ while provisioning an instance, the volume is added under /vdb.

We need to ensure that the volume is added under /vda while provisioning instance from ManageIQ as well. Please guide us on how to do that. Refer to the attached images where the volume is added using both OpenStack and ManageIQ.

  1. Openstack (10GB is added under /vda):
    image

  2. ManageIQ (10GB is added under /vdb):
    image

Hi @Fryguy and @GilbertCherrie, Do you have any insights on this?

@agrare
Copy link
Member

agrare commented Oct 15, 2024

Hey @Dhamo1107 sorry no I haven't gotten a chance to look at this yet.
So when we create a new volume that is done here https://github.com/ManageIQ/manageiq-providers-openstack/blob/master/app/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment.rb

I'm not as well versed with the openstack API as you likely are, if you can post what properties would have to be provided to make a disk a "root" volume we can update our volume_attachment code to check for that attribute and set it appropriately.

@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

Thank you for your insights.

This is the OpenStack documentation on how to Create volume from image and boot instance. From the document, I believe the parameters likely to be sent from ManageIQ to OpenStack to create that volume in vda are --block-device and boot_index: 0. I added new_volume_attrs[:boot_index] = 0 this in volume_attachment.rb file. However, I received the error message: Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid.

image

image

@agrare
Copy link
Member

agrare commented Oct 16, 2024

@Dhamo1107 I think the issue is that we have a "default" first volume.

https://github.com/ManageIQ/manageiq-providers-openstack/blob/master/app/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment.rb#L3 that is the "first" disk and you can see the default volume has :boot_index => 0 https://github.com/ManageIQ/manageiq-providers-openstack/blob/master/app/models/manageiq/providers/openstack/cloud_manager/provision/volume_attachment.rb#L39-L49 so I think the issue that you're hitting is you have two volumes with boot_index=0

What I think we need is to check if the source has a root_disk (maybe root_disk_size == 0 ? Can you check that?) and if it doesn't then we shouldn't have a default_volume.

volumes_attrs_list = []
volumes_attrs_list << default_volume_attributes if instance_type.root_disk_size > 0

Then in your requested_volumes the first volume that you want to create as a boot disk you would set :boot_index => 0

@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

Thank you for your insights; they helped us successfully create a volume under vda.

I have updated my volume_attachment.rb file as shown below:

volumes_attrs_list = []
volumes_attrs_list << default_volume_attributes if instance_type.root_disk_size > 0
image

The volume is now attached under vda successfully:
image
image

However, when I check the console of the provisioned instance, I still encounter the No bootable device error:
image

I tried setting new_volume_attrs[:bootable] = true inside the requested_volumes.each do |volume_attrs| block, but it did not resolve the issue. The bootable spec in the volume section of the created volume still shows "NO."
image

Could you share your thoughts on how to make the volume bootable? Thank you!

@Dhamo1107
Copy link
Contributor Author

Dhamo1107 commented Oct 17, 2024

Hi @agrare, we are encountering an issue where the volume is created under vda, but there is no bootable device. The issue seems to be because the volume is created without an OS image, which is likely causing the error. In the attached image of the volume_attachment.rb file:

image

in the requested_volumes block, I initially set the uuid as new_volume_id, the source_type as volume, and the destination_type as volume. However, I think the correct source_type should be the image, along with its UUID as source.ems_ref, and the destination_type should be volume. I’ve now made that change.

image

However, I’m now getting this error: Images with destination_type volume need to have a non-zero size specified.

image

I also added size attribute in the rquested_volume block, but could not able to fix this issue
Do you have any suggestions on how to resolve this? Thanks.

@agrare
Copy link
Member

agrare commented Oct 17, 2024

However, I’m now getting this error: Images with destination_type volume need to have a non-zero size specified.

This error is coming from Openstack, I wonder if you need to set the size in volume_attrs before the service.volumes.create(volume_attrs) call? Can you tell if the service.volumes.create() call is successful and it fails later on?

@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

This is the code now i have after adding debug statements:
image

This is the log generated for that:
image

The volume is created in opnstack, but not attached to instance:
image

@agrare
Copy link
Member

agrare commented Oct 17, 2024

So I definitely see a disk with :name=>"root" and :size=>0 in that "Checking volume with attributes" log line. Can you track down where that is coming from?

@Dhamo1107
Copy link
Contributor Author

Yes @agrare that is coming from default_volume_attributes

@agrare
Copy link
Member

agrare commented Oct 17, 2024

Okay I thought if the flavor didn't have a root disk you were skipping the default_volume_attributes, can you tell how it is getting in there?

@Dhamo1107
Copy link
Contributor Author

Hi @agrare,

We have fixed the issue and created a PR for it. Please take a look at it:

PR#894

Thank you for your valuable insights.

@agrare
Copy link
Member

agrare commented Oct 24, 2024

That's great @Dhamo1107 ! I do wonder how the default_volume_attributes values got in there if you skipped them via volumes_attrs_list = instance_type.root_disk_size > 0 ? [default_volume_attributes] : []. That's my only hesitation on merging what you have there as-is

@Dhamo1107
Copy link
Contributor Author

Dhamo1107 commented Oct 24, 2024

Hi @agrare, the log indicates that the default_volume_attributes values showing name: root and size: 0 are associated with task ID 118, which I ran before changing the condition volumes_attrs_list = instance_type.root_disk_size > 0 ? [default_volume_attributes] : []. After modifying the condition, task ID 119 indicates skipping default volume attributes, which seems to be the misunderstanding. Task ID 119 correctly shows name: vol-test
image

Thank You

@agrare
Copy link
Member

agrare commented Dec 10, 2024

Fixed by #894

@agrare agrare closed this as completed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment