-
Notifications
You must be signed in to change notification settings - Fork 897
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 a virtual column for supports_block_storage?
and supports_cloud_object_store_container_create?
#15600
Conversation
@imtayadeway Please review. Thanks. EDIT: Note that Once the review is done, I also need to make identical changes for |
957a751
to
a0a2a4c
Compare
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.
Looks great! Just one request!
Was this the only column that needed to be added?
app/models/ext_management_system.rb
Outdated
@@ -143,6 +143,7 @@ def hostname_uniqueness_valid? | |||
virtual_column :total_vms_never, :type => :integer | |||
virtual_column :total_vms_suspended, :type => :integer | |||
virtual_total :total_subnets, :cloud_subnets | |||
virtual_column :v_supports_block_storage, :type => :boolean |
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.
IIRC, I think we were trying to prevent adding further v_
methods, so this could be :supports_block_storage
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.
Ok, not a problem. I can make it :supports_block_storage
.
@imtayadeway You are correct, there is one more column. |
5a133dc
to
42dce7e
Compare
supports_block_storage?
supports_block_storage?
and supports_cloud_object_store_container_create?
@@ -542,6 +544,14 @@ def total_vms_never; vm_count_by_state("never"); end | |||
|
|||
def total_vms_suspended; vm_count_by_state("suspended"); end | |||
|
|||
def supports_block_storage |
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.
@durandom any idea why alias
would not work here? With alias supports_block_storage supports_block_storage?
:
ems.supports_block_storage? # => true
ems.supports_block_storage # => false
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.
maybe because you've added the alias before the block storage mixing got included?
the supports_feature_mixin defaults all features to unsupported. once it's supported it defines another method.
I tried to remove this in #11322 - but unfortunately that PR got stale
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 @AparnaKarve ! 🍰
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.
is that the case for all other features in the supports feature mixin?
I mean, should they be queryable via the REST api?
If so, I would add those virtual columns in the supports_feature_mixin
@@ -542,6 +544,14 @@ def total_vms_never; vm_count_by_state("never"); end | |||
|
|||
def total_vms_suspended; vm_count_by_state("suspended"); end | |||
|
|||
def supports_block_storage |
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.
maybe because you've added the alias before the block storage mixing got included?
the supports_feature_mixin defaults all features to unsupported. once it's supported it defines another method.
I tried to remove this in #11322 - but unfortunately that PR got stale
@@ -234,6 +234,18 @@ | |||
provider_region "us-east-1" | |||
end | |||
|
|||
factory :ems_amazon_storage_manager_ebs, |
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.
I would try not to add more provider specific factories. See below for another solution to test this
|
||
context "virtual column :supports_block_storage" do | ||
it "returns true for Amazon EBS" do | ||
ems_amz_ebs = FactoryGirl.create(:ems_amazon_storage_manager_ebs) |
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.
How about not using an amazon ems, but just a mock?
context "virtual column :supports_block_storage" do
it "returns true if block storage is supported" do
ems = FactoryGirl.build(:ems)
allow(ems).to receive(:supports_block_storage?).and.return(true)
expect(ems_amz_ebs.supports_block_storage).to eq(true)
end
end
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.
Alright, if you recommend that.
I'm OK either ways - mock or not :-)
Checked commits AparnaKarve/manageiq@91b2e0f~...35a5f2c with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@durandom That will not work. Getting this --
If I'm not mistaken, you can use |
I've created #15614 as a more generalized solution |
@miq-bot assign @blomquisg |
I'll merge this for the bug fixes. We can continue the conversation in #15614 as a possible refactoring effort. |
@AparnaKarve ManageIQ/manageiq-ui-classic#1711 depends on this PR and that's marked as |
@simaishi Yes. This needs to be |
Add a virtual column for `supports_block_storage?` and `supports_cloud_object_store_container_create?` (cherry picked from commit d7611ab) https://bugzilla.redhat.com/show_bug.cgi?id=1478571 https://bugzilla.redhat.com/show_bug.cgi?id=1479802
Fine backport details:
|
Add a virtual column for `supports_block_storage?` and `supports_cloud_object_store_container_create?` (cherry picked from commit d7611ab) https://bugzilla.redhat.com/show_bug.cgi?id=1478571 https://bugzilla.redhat.com/show_bug.cgi?id=1479802
The following API (that used to work before), returns an empty list currently since APIs do not support filtering on non-column methods anymore.
The solution is to add a new virtual column:
v_supports_block_storage
forsupports_block_storage?
.And while at it, the
?
was dropped from the original name to make it more friendly in the API-based URLshttps://bugzilla.redhat.com/show_bug.cgi?id=1471162
https://bugzilla.redhat.com/show_bug.cgi?id=1471110