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

Check provisioning status with the correct tenant scoping #97

Merged
merged 2 commits into from
Sep 19, 2017

Conversation

mansam
Copy link
Contributor

@mansam mansam commented Sep 13, 2017

If a volume or VM is provisioned in a tenant other than the default, then using <collection>.get() may fail to find them during the provisioning status check because the request is scoped to the wrong tenant. This PR scopes the request to use the tenant name from the provisioning request if it is a available.

This also fixes a performance problem with the cloning check, where in order to work around the scoping problem it was listing every server from every tenant. If the tenant name is available, then it will use servers.get() instead.

(Also some minor co-located lint fixes)

@mansam
Copy link
Contributor Author

mansam commented Sep 13, 2017

@petrblaho @aufi it would be great if you could check whether this makes sense to you. :)

@miq-bot
Copy link
Member

miq-bot commented Sep 13, 2017

Checked commits mansam/manageiq-providers-openstack@be0c3bb~...c5b6338 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@mansam
Copy link
Contributor Author

mansam commented Sep 13, 2017

This is a possible fix for #66

@petrblaho
Copy link

LGTM +1

else
openstack.handled_list(:servers).detect { |s| s.id == clone_task_ref }
end
status = instance.state.downcase.to_sym if instance.present?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I think we should initialize status local variable always to avoid undefined variable error since it is part of condition on line 12.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status = instance.state.downcase.to_sym if instance.present? results in status being defined as nil if the condition is false, so an additional initialization shouldn't be necessary.

irb(main):001:0> x = 3 if true
=> 3
irb(main):002:0> x
=> 3
irb(main):003:0> y = 3 if false
=> nil
irb(main):004:0> y
=> nil
irb(main):005:0> z
NameError: undefined local variable or method `z' for main:Object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks!

@aufi aufi merged commit 1633acf into ManageIQ:master Sep 19, 2017
@aufi aufi added the bug label Sep 19, 2017
@aufi aufi added this to the Sprint 70 Ending Oct 2, 2017 milestone Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants