-
Notifications
You must be signed in to change notification settings - Fork 92
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
Enable provisioning from Volumes and Volume Snapshots via a proxy type #104
Enable provisioning from Volumes and Volume Snapshots via a proxy type #104
Conversation
b214242
to
7d8cdb3
Compare
@agrare Can you review or assign someone. Thanks |
|
||
belongs_to :cloud_tenant | ||
|
||
def volume_snapshot_template? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used? Better to just use .kind_of?(klass)
I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are in line with image?
and snapshot?
which are present on the parent class and used for differentiating type in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks
|
||
belongs_to :cloud_tenant | ||
|
||
def volume_template? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
So I'm not a huge fan of creating a dummy miq_template record in refresh so that we can provision from it instead of changing the provision workflow to be able to use the volume as the source, @Fryguy thoughts? |
@@ -296,9 +309,17 @@ def assert_ems | |||
expect(@ems.key_pairs.size).to eq compute_data.key_pairs.count | |||
security_groups_count = @ems.security_groups.count { |x| x.name != 'default' } | |||
expect(security_groups_count).to eq security_groups_count | |||
expect(@ems.vms_and_templates.size).to eq vms_count + images_count | |||
if ::Settings.ems.ems_openstack.try(:refresh).try(:inventory_object_refresh) || ::Settings.ems.ems_refresh.try(:openstack).try(:inventory_object_refresh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternately, fetch_path is usable on Settings as well, so this could be
Settings.ems.fetch_path(:ems_openstack, :refresh, :inventory_object_refresh) || Settings.ems.fetch_path(:ems_refresh, :openstack, :inventory_object_refresh)
On that note, why are there even 2 ways to configure things? Pick whichever one you want to be the "official" one (I suggest the former, so you can own the setting in your repo), and create a data migration to convert the other one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know fetch_path is available on Settings. There are two ways to configure things because the latter (incorrect) option was put in first and merged into a release. I put together a PR to support the correct way and the old way to avoid breaking anyone's deployment since I wasn't aware I could use a migration to change things over. Since the PR that implements the new openstack-owned approach wasn't merged yet, I should be able to implement a migration and get this all cleaned up. :)
end | ||
|
||
def volumes_by_id | ||
@volumes_by_id ||= Hash[volume_templates.collect { |f| [f.id, f] }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternately, you can use the index_by method.
@volumes_by_id ||= volume_templates.index_by(&:id)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that shortcut!
@agrare I don't see it creating dummy data, unless I'm mistaken about how the collector works? |
@Fryguy there already are |
This pull request is not mergeable. Please rebase and repush. |
Given the requirements for provisioning I'm good with this, ideally we would be able to provision from things other than a template but I understand that would be a large undertaking. @mansam if this is ready can you take it out of |
@agrare rebase in progress :) |
Refresh will now populate VolumeTemplates, which are a subclass of MiqTemplate that allows for provisioning from Openstack volumes until a more general purpose refactoring of the provisioning workflow can be implemented.
07f7164
to
4f82edd
Compare
Some comments on commits mansam/manageiq-providers-openstack@4220abd~...4f82edd spec/models/manageiq/providers/openstack/cloud_manager/stubbed_refresher_spec.rb
|
Checked commits mansam/manageiq-providers-openstack@4220abd~...4f82edd with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0 spec/models/manageiq/providers/openstack/cloud_manager/refresh_spec_common.rb
|
This pull request implements proxies for Volumes and Volume Snapshots as subclasses of MiqTemplate, allowing them to be selected during the ManageIQ provisioning workflow. Openstack will automatically create a volume of the appropriate size if a Snapshot is chosen as the boot source.
See also:
ManageIQ/manageiq#16066
ManageIQ/manageiq-ui-classic#2253