ManageIQ / manageiq-providers-openstack

ManageIQ plugin for the OpenStack provider.
https://www.openstack.org/
Apache License 2.0
12 stars 91 forks source link

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

Open Dhamo1107 opened 1 week ago

Dhamo1107 commented 1 week ago

OpenStack Behavior:

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

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 commented 6 days ago

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 commented 1 day ago

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 commented 1 day ago

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 commented 11 hours ago

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 commented 6 hours ago

@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