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

Fix for Issue 447 #450

Merged
merged 18 commits into from
Aug 30, 2020
Merged

Fix for Issue 447 #450

merged 18 commits into from
Aug 30, 2020

Conversation

timdeluxe
Copy link
Contributor

Pull Request (PR) description

Fixes the issue (#447), that resource_discovery parameter on cs_location is never set, when using provider crm. The provider did not set the feature "discovery" and also had no method for it. Just simply setting the feature would not be good, since it is first available since pacemaker 1.1.13, so i included a version check.

This Pull Request (PR) fixes the following issues

Fixes #447

timdeluxe and others added 2 commits September 18, 2018 17:31
The crm provider for cs_location did never set that. A version check
ensures that parameter is only set when running pacemakerd >= 1.1.13

Fixes voxpupuli#447
@bastelfreak
Copy link
Member

Hi @timdeluxe. thanks for the patch. Can you take a look at the failing travis tests?

@timdeluxe
Copy link
Contributor Author

@bastelfreak I have no clue yet about the other failures, only about the 2nd one: It expects the resource discovery parameter on RedHat systems (obviously because those use the pcs provider) and do not expect it on non RedHat systems (because those usually use the crm provider).
Code here:

if fact('osfamily') != 'RedHat'
it 'creates a location without resource-discovery=exclusive on non-RH systems' do
shell('cibadmin --query | grep duncan_vip_there') do |r|
expect(r.stdout).not_to match(%r{resource-discovery="exclusive"})
end
end
end

However that resource-discovery feature is not bound to the provider (crm or pcs), but more to the pacemaker version, where my fix is for. That said i am still unsure how to rewrite the acceptance test. Either the pacemakerd version is also gathered in the acceptance test similar to the patch i provided or we find out which OS families and versions provide pacemakerd >= 1.1.13. What do you think?

@bastelfreak
Copy link
Member

@timdeluxe I don't have a preference here. A fact would probably be nice, as it could be used in other places as well.

    (my fault).
    Adding rescue to prevent issues when command is
    not yet found on fresh systems, where pacemaker
    is not yet installed.

    Still fixes voxpupuli#447
@timdeluxe
Copy link
Contributor Author

@timdeluxe I don't have a preference here. A fact would probably be nice, as it could be used in other places as well.

Okay, i will try to do that in the next days, sorry for the constantly failing builds so far... :-/

timdeluxe and others added 4 commits May 7, 2019 16:40
@timdeluxe
Copy link
Contributor Author

@bastelfreak Sorry for doing nothing for so long.

As you can see i introduced a fact for the pacemaker version, but now there is a racing condition in the beaker tests. The facts are gathered at the beginning and since no pacemaker is installed there yet, no pacemakerd_version is given. This leads to a failing test for the resource-discovery stuff.

Maybe the tests may be fixable, but i think this could also raise a problem in the real world, because the resource-discovery feature would require two puppet runs to successfully get applied (first run: pacemakerd_version fact empty because no pacemaker is installed yet -> location would be created without resource-discovery parameter; second run: pacemakerd_version now filled and location gets resource-discovery parameter added, if pacemakerd_version is >= 1.1.13).
I would suggest to revert the idea with the pacemakerd_version fact and trying to let the previous implementation (gathering the pacemakerd version within the provider) passing the tests.

However i don't know how to fix the acceptance tests then. As said previously redhat vs. non-redhat is definitly wrong. Would it be feasible to check the OS and the major version there and see, which one has pacemaker version >= 1.1.13 and which < 1.1.13, rather than trying to check the version itself directly? Would that be a valid way to do it?

@vox-pupuli-tasks
Copy link

Dear @timdeluxe, thanks for the PR!

This is Vox Pupuli Tasks, your friendly Vox Pupuli Github Bot. I noticed that your pull request has CI failures. Can you please have a look at the failing CI jobs?
If you need any help, you can reach out to us on our IRC channel voxpupuli on Freenode or our Slack channel voxpupuli at slack.puppet.com.
You can find my sourcecode at voxpupuli/vox-pupuli-tasks

@dploeger
Copy link

dploeger commented Jul 6, 2020

@bastelfreak Can you help @timdeluxe here? We're still running on this branch and would like to use the official module.

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

my suggested change isn't great, but it's better than being stuck with this pr staying open forever

lib/puppet/provider/cs_location/crm.rb Show resolved Hide resolved
@timdeluxe
Copy link
Contributor Author

Yes, failing tests i know. Sorry. :-/
I executed the beaker tests locally, but as it now turns out wrongly. Now i found out how to do them correctly and can test it locally. Will troubleshoot it.

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

🙋🏻‍♀️

lib/puppet/provider/cs_location/crm.rb Outdated Show resolved Hide resolved
lib/puppet/provider/cs_location/crm.rb Outdated Show resolved Hide resolved
@timdeluxe
Copy link
Contributor Author

Finally 😌
Tests are green now. Needed to fix other stuff on cs_order, which was not related to this issue at all. Also i needed to implement the proposed workaround of #455, since centos tests were failing on travis as well on my local machine because of that. I made single commits for all of that, so that it is cleanly separated.

I hope the PR can be merged now, if not please highlight what is missing. Thanks!

Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

more 👀

lib/puppet/provider/cs_location/crm.rb Show resolved Hide resolved
lib/puppet/provider/cs_order/crm.rb Outdated Show resolved Hide resolved
lib/puppet/provider/cs_order/crm.rb Outdated Show resolved Hide resolved
lib/puppet/type/cs_order.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@igalic igalic left a comment

Choose a reason for hiding this comment

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

👍

# we need to check if we run at least pacemakerd version 1.1.13 before enabling feature discovery
# see http://blog.clusterlabs.org/blog/2014/feature-spotlight-controllable-resource-discovery
begin
pacemakerd_version_string = pacemakerd('--version')
Copy link
Member

Choose a reason for hiding this comment

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

Is this executed on the agent or during catalog compilation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is executed on the agent.
(We are already using this code in our environment. If it would be executed during compilation it would be done on the puppetserver, where there is no pacemakerd installed and we then wouldn't have the discovery feature, which we have.)

@igalic
Copy link
Contributor

igalic commented Jul 24, 2020

an we merge this?

@bastelfreak
Copy link
Member

@igalic looks good to me, but I am far from being an expert for this.

@timdeluxe
Copy link
Contributor Author

@igalic @bastelfreak @ekohl Is anything holding back from merging this? If not, please do so. If yes, please tell me, so i can work on it.

@igalic igalic merged commit 802dd4b into voxpupuli:master Aug 30, 2020
@igalic
Copy link
Contributor

igalic commented Aug 30, 2020

let's see what happens if we do merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provider crm for cs_location type does not set feature resource_discovery
5 participants