[node-patches] Change in ovirt-node[master]: Show the bond mode in the NIC details page
rbarry at redhat.com
rbarry at redhat.com
Wed May 7 02:39:55 UTC 2014
Ryan Barry has uploaded a new change for review.
Change subject: Show the bond mode in the NIC details page
......................................................................
Show the bond mode in the NIC details page
Add a property to get the bonding mode and add it to NIC details
Change-Id: Ic535125cf896311bcbaf3a89eafc7d3c2747e4b7
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1029405
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/core/network_page.py
M src/ovirt/node/utils/network.py
2 files changed, 27 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/36/27436/1
diff --git a/src/ovirt/node/setup/core/network_page.py b/src/ovirt/node/setup/core/network_page.py
index 9bb11d0..2dc19d3 100644
--- a/src/ovirt/node/setup/core/network_page.py
+++ b/src/ovirt/node/setup/core/network_page.py
@@ -96,7 +96,7 @@
def __init__(self, app):
super(Plugin, self).__init__(app)
- # Keys/Paths to widgets related to NIC settings
+ # Keys/Paths to widgets related to NIC settings
self._nic_details_group = self.widgets.group([
"dialog.nic.ipv4.bootproto", "dialog.nic.ipv4.address",
"dialog.nic.ipv4.netmask", "dialog.nic.ipv4.gateway",
@@ -153,7 +153,7 @@
valid_bond_name = valid.RegexValidator("^(bond[0-9]{1,2}|007)$",
"a valid bond name (bond[0-99])"
)
- # No regex, but for users ^
+ # No regex, but for users ^
return {"hostname": fqdn_ip_or_empty,
"dns[0]": ip_or_empty,
@@ -458,7 +458,7 @@
# Therefor we don't add it, to not call it twice.
# But it should be added to the ocmplete transaction when the backend
# code is more fine granular.
- #txs += ipv6model.transaction()
+ # txs += ipv6model.transaction()
return txs
@@ -495,6 +495,11 @@
"dialog.nic.link_status": link_status_txt,
"dialog.nic.hwaddress": nic.hwaddr,
})
+
+ if nic.typ == "bond":
+ self.plugin._model_extra.update({
+ "dialog.nic.bond_mode": nic.mode
+ })
bootproto = model["bootproto"]
ipaddr = model["ipaddr"]
@@ -589,21 +594,24 @@
padd(_("Gateway: "))),
ui.Label("dummy[1]", "")]),
- ui.Divider("dialog.nic._divider[2]"),
+ ui.Divider("dialog.nic._divider[2]")]
- ui.Row("dialog.nic._row[8]",
- [ui.Entry("dialog.nic.vlanid",
- padd(_("VLAN ID: "))),
- ui.Label("dummy[2]", "")]),
+ row_members = [ui.Entry("dialog.nic.vlanid",
+ padd(_("VLAN ID: ")))]
+ if nic.typ == "bond":
+ row_members.extend([ui.KeywordLabel("dialog.nic.bond_mode")])
+ else:
+ row_members.extend([ui.Label("dummy[2]", "")])
+ ws.extend([ui.Row("dialog.nic._row[8]", row_members),
+ ui.Divider("dialog.nic._divider[3]"),
- ui.Divider("dialog.nic._divider[3]"),
+ ui.Checkbox("dialog.nic.layout_bridged",
+ _("Use Bridge: ")),
- ui.Checkbox("dialog.nic.layout_bridged",
- _("Use Bridge: ")),
-
- ui.Divider("dialog.nic._divider[4]"),
- ui.Button("dialog.nic.identify", _("Flash Lights to Identify")),
- ]
+ ui.Divider("dialog.nic._divider[4]"),
+ ui.Button("dialog.nic.identify",
+ _("Flash Lights to Identify")),
+ ])
self.plugin.widgets.add(ws)
self.children = ws
diff --git a/src/ovirt/node/utils/network.py b/src/ovirt/node/utils/network.py
index d27831d..e37c7bd 100644
--- a/src/ovirt/node/utils/network.py
+++ b/src/ovirt/node/utils/network.py
@@ -494,6 +494,10 @@
for slave in self.slave_nics:
slave.identify()
+ @property
+ def mode(self):
+ return open("/sys/class/net/%s/bonding/mode").readline().split()[-1]
+
def __str__(self):
return self.build_str(["ifname", "slave_nics"])
--
To view, visit http://gerrit.ovirt.org/27436
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic535125cf896311bcbaf3a89eafc7d3c2747e4b7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list