fix bridge master:slave mapping by-name
ClosedPublic

Authored by sitter on Aug 13 2019, 1:45 PM.

Details

Summary

a slave may be mapped to a master by either the uuid of the master OR
the connection name of the master.

determine our current connection name and if it is the one referenced by
the slave we consider ourselves master of that slave.
since we do not have access to the connection name inside the bridgewidget
I'm opting to pop it out of connection list on-demand. it may be
more efficient to get it passed in by the parent widget (which I think
knows the name). I am not sure if there may be pitfalls with considering
the name static though.

also partially unpack the if condition so it's a bit easier on the eyes
with the newly added complexity

Test Plan
nmcli c add type bridge ifname br0 autoconnect yes con-name br0 stp off
nmcli c add type bridge-slave autoconnect yes con-name enp4s0 ifname enp4s0 master br0

kcm correctly shows enp4s0 as slave of br0

Diff Detail

Repository
R116 Plasma Network Management Applet
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15298
Build 15316: arc lint + arc unit
sitter created this revision.Aug 13 2019, 1:45 PM
Restricted Application added a project: Plasma. · View Herald TranscriptAug 13 2019, 1:45 PM
Restricted Application added a reviewer: jgrulich. · View Herald Transcript
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
sitter requested review of this revision.Aug 13 2019, 1:45 PM

The parent knows the connection id, if you look into ConnectionEditorBase::initialize(), then you can get the id using

"m_connection->id()"

You can add additional masterId parameter so you don't need to go through the whole connection list to get the id. Also, this same improvement can be done in BondWidget and TeamWidget, where very same code is used (if would be so kind to do so :) )

sitter retitled this revision from fix bridge master:slave mapping by-name to fix bridge/team/bond master:slave mapping by-name.Aug 19 2019, 12:38 PM
sitter edited the summary of this revision. (Show Details)
sitter updated this revision to Diff 64034.Aug 19 2019, 12:38 PM
sitter retitled this revision from fix bridge/team/bond master:slave mapping by-name to fix bridge master:slave mapping by-name.
sitter edited the summary of this revision. (Show Details)

apply change to bond and team

set id at construction time instead of looking it up at popluation time

sitter updated this revision to Diff 64035.Aug 19 2019, 12:39 PM

drop excess spaces

sitter updated this revision to Diff 64036.Aug 19 2019, 12:40 PM

drop more extra spaces -.-

jgrulich accepted this revision.Aug 22 2019, 3:11 PM
This revision is now accepted and ready to land.Aug 22 2019, 3:11 PM
This revision was automatically updated to reflect the committed changes.
This comment was removed by bcooksley.
This comment was removed by bcooksley.
bcooksley removed a subscriber: fusitter.