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

Improved device name collision recognition in autoinstallation #583

Merged
merged 13 commits into from
Jan 24, 2018

Conversation

mchf
Copy link
Member

@mchf mchf commented Nov 7, 2017

bsc#1056109
https://trello.com/c/A0ujYsUt
Previously on this topic: #533

This PR solves issues when ay udev rules leads to a collision in device renaming. For example when AY profile defines rule eth0 -> eth1 (-> means "rename to") and eth1 exists in the system.

@mchf mchf changed the base branch from SLE-12-SP3 to SLE-12-SP2 November 7, 2017 08:27
@@ -353,7 +353,7 @@ def keep_install_network_value(value)
before(:each) do
allow(Yast::LanItems)
.to receive(:Items)
.and_return(0 => { "ifcfg" => "eth0" })
.and_return(0 => { "ifcfg" => "eth0", "udev" => { "net" => ["ATTR{address}==\"24:be:05:ce:1e:91\"", "KERNEL==\"eth*\"", "NAME=\"eth0\""] } })
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 supposed to be a test for this PR?

What about a new test case that fails without the fix and succeeds with the fix?
What about summarizing the 62 Bugzilla comments so far so that a reviewer gets an idea of what the bug even is?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is necessary fix to keep the testsuite working after the patch. I'll add testsuite for new methods.

@mchf mchf changed the title Improved device name collision recognition in autoinstallation [WIP] Improved device name collision recognition in autoinstallation Nov 7, 2017
@mchf mchf force-pushed the bnc1056109-udevs branch 2 times, most recently from 4c685fe to 3c70075 Compare November 8, 2017 09:49
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 47.864% when pulling 3c70075 on mchf:bnc1056109-udevs into c5e518a on yast:SLE-12-SP2.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 47.85% when pulling 97837e1 on mchf:bnc1056109-udevs into ec72b69 on yast:SLE-12-SP2.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 47.895% when pulling 489dbe8 on mchf:bnc1056109-udevs into ec72b69 on yast:SLE-12-SP2.

@mchf mchf changed the title [WIP] Improved device name collision recognition in autoinstallation Improved device name collision recognition in autoinstallation Dec 11, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 47.984% when pulling 929a410 on mchf:bnc1056109-udevs into ec72b69 on yast:SLE-12-SP2.

Copy link
Member

@mvidner mvidner left a comment

Choose a reason for hiding this comment

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

Please write a test for the reported bug. I think Comment 31 is a good start.

.and_return(
0 => {
"ifcfg" => "eth0",
"renamed_to" => !renamed_to.nil? ? renamed_to : nil,
Copy link
Member

Choose a reason for hiding this comment

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

"renamed_to" => renamed_to, does work :)

Copy link
Member Author

Choose a reason for hiding this comment

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

ehm ... right.

@@ -280,20 +281,34 @@ def assign_udevs_to_devs(udev_rules)
end
next if !matching_item

name_from = LanItems.GetDeviceName(item)
name_from = item_name(item)
Copy link
Member

Choose a reason for hiding this comment

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

OK, I think I can even see that this is the bug fix: realizing that name_from may also have been renamed. Right?
So we should be able to write a test case that mimics the bug report, fails without this fix and succeeds with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes. I'd bet that I have an AY integration test for it ... but cannot find it. I'll do something with that.

@coveralls
Copy link

coveralls commented Jan 17, 2018

Coverage Status

Coverage increased (+0.4%) to 48.194% when pulling 12ff6c2 on mchf:bnc1056109-udevs into ec72b69 on yast:SLE-12-SP2.

Copy link
Member

@mvidner mvidner left a comment

Choose a reason for hiding this comment

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

I have good news:

     Failure/Error: expect(names.sort).to eql ["eth0", "eth1", "eth2"]
     
       expected: ["eth0", "eth1", "eth2"]
            got: ["eth0", "eth0", "eth2"]

This is the new test when run with the old code. So yes, it really tests the bug (and it passes with the new code.

Thanks!

@mchf
Copy link
Member Author

mchf commented Jan 24, 2018

thanks for the review

@mchf mchf merged commit ef994ef into yast:SLE-12-SP2 Jan 24, 2018
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.

3 participants