-
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
fix endpoint url uniqueness validation, and disable it for cloud providers #18298
Conversation
@AlexanderZagaynov Can you describe why we can remove this? This was added in #12068 for https://bugzilla.redhat.com/show_bug.cgi?id=1382627 Would |
cc @bdunne |
@jrafanie as my BZ says, it's impossible to add two or more ems providers with the same proxy URI. However, such option can make sense, if you want to have AWS for some US region, and another one with same proxy for some EU for example. |
P.S. I see that your BZ should also be considered. So, we need to find a way to satisfy both. Any ideas? |
yeah, it's unclear if a nil URL is the only case your BZ needs to be fixed. If yes, |
@jrafanie sorry, looks like I missed a point in my BZ, that it's not about two endpoints with the same value, but about empty field values. Hovewer, there was already a condition for that validation |
@AlexanderZagaynov the bz states that the url was left empty:
I just tried this and can confirm leaving the url blank and trying to add two regions fails with that error. I tried adding allow_nil and I was able to validate credentials but was not able to save the provider. Assuming this was fixed though this doesn't help if someone actually wants to use a different endpoint url (either a proxy or a custom region) and add multiple regions. I've always struggled with preventing people from adding the same provider multiple times, just checking for the same hostname doesn't cover the case where the user wants to add the same provider with different credentials. I've always thought it'd be easier to just warn the user in case they didn't intend to add the same provider again but there's not really any way of really preventing the same provider being added multiple times (can be added multiple times with different IP addresses, dns names, etc... anyway). I don't think its possible to successfully prevent the same endpoint being added twice in some cases while also allowing it in others. |
@agrare I believe we should not prevent adding same provider multiple times, I showed example above with two regions. Even more, I have had such setup in my dev env not so long ago. And added two AWSes without any problem at that moment. Maybe something was changed recently. |
300106c
to
699b40b
Compare
I've found possible reason why that problem did arise. Probably previously empty |
@miq-bot add_label blocker |
@AlexanderZagaynov if this will be able to be backported, can you add the hammer/yes label. |
@miq-bot add_label hammer/yes |
One specific reason we had prevented people from adding the same provider multiple times was in places where we "resurrect" archived VMs. For example, in VMware, if a VM moves from one provider to another, we find it in the archived list and reattach it to the new provider (e.g. the user is migrating from one physical vSphere to another, and transfers the underlying disks to a different storage and then attaches it to the new provider). If we didn't have the uniqueness in place, then this mechanism causes the VM to jump back and forth between the systems. Now, one can argue that we shouldn't have this feature in place, and I'd be ok with discussing removal of that, but the reality at the moment is that this feature exists. EDIT: The VM won't jump back and forth, as we only pull from the same EMS or ems_id.nil? |
@Fryguy we speak about endpoints here, not about same providers |
d2bd618
to
ab9cc07
Compare
Provider uniqueness is handled by the endpoints since ext_management_system doesn't actually have a hostname/url it delegates that to the default endpoint. |
in that case we have bad design I guess. but let's stay with simple workarounds for now :) |
Checked commits AlexanderZagaynov/manageiq@f17d894~...ab9cc07 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
I blame @juliancheal since he did the endpoint stuff 😆 Seriously though multiple endpoints for a provider is a big improvement over how it used to be, and uniquely identifying a provider is a genuinely hard problem that even hostname checks can't accomplish 100% (see my comment here #18298 (comment)) and not every provider has a "uuid" like a vSphere vCenter does which would allow us to do the unique check properly. |
I tried to avoid this PR, but thanks @agrare 😂 I'm not totally caught up on this PR, but let me know if you need any help 🎩 |
We'd actually be okay here since when reconnecting we look for vms with the same ems_id or nil so an active vm on another provider won't be found (https://github.com/ManageIQ/manageiq/blob/master/app/models/ems_refresh/save_inventory.rb#L102) |
fix endpoint url uniqueness validation, and disable it for cloud providers (cherry picked from commit b8927b0) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1658207
Hammer backport details:
|
@agrare Ah yeah, I edited my comment but too late 😄 |
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1658207