-
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
Service#my_zone should only reference a VM associated to a provider. #14696
Service#my_zone should only reference a VM associated to a provider. #14696
Conversation
198242b
to
08a473d
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.
Changes look good, but naming is hard :)
spec/models/service_spec.rb
Outdated
end | ||
|
||
it 'returns the provider zone when the VM is connected to a provider' do | ||
provider = FactoryGirl.create(:ext_management_system, :zone => FactoryGirl.create(:zone)) |
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.
Can this be manager
or ems
instead since it's not a Provider
?
spec/models/service_spec.rb
Outdated
it 'returns the provider zone with one VM connected to a provider and one archived' do | ||
service.add_resource!(FactoryGirl.build(:vm_vmware)) | ||
|
||
provider = FactoryGirl.create(:ext_management_system, :zone => FactoryGirl.create(:zone)) |
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
08a473d
to
46b7f9f
Compare
Checked commit gmcculloug@46b7f9f with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
…ed_vm Service#my_zone should only reference a VM associated to a provider. (cherry picked from commit 6a23f36) https://bugzilla.redhat.com/show_bug.cgi?id=1441249
Fine backport details:
|
…ed_vm Service#my_zone should only reference a VM associated to a provider. (cherry picked from commit 6a23f36) https://bugzilla.redhat.com/show_bug.cgi?id=1441251
Euwe backport details:
|
Services do not have an inherent zone association. When one is desired, for example when running a custom button, we look at the associated VMs to select a zone. The current logic always uses the first VM from the list of
vms
. If that VM happens to be archived/orphaned (not associated with a provider) the logic raises an error. The new logic checks that the VM has a valid provider before accessing the zone name.Note: The
Vm
model contains amy_zone
method which handles anil
provider, but in that scenario it returns the current MiqServer zone name which is not the desired result.Links [Optional]
Steps for Testing/QA
Options 1: Follow step list in BZ to recreate issue.
Options 2:
Run the following steps in the rails console (before changes):
After applying the changes
s.my_zone
will returnnil
for the error case above.