Ryan Barry has uploaded a new change for review. Change subject: Don't show bonds without slaves ......................................................................
Don't show bonds without slaves Add a property to BondedNics() to query slaves, and filter the results if it doesn't have any. Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1094878 Change-Id: Ia2a718a9733a8e0981b68b706787a10768bd8d82 Signed-off-by: Ryan Barry <[email protected]> --- A ovirt-node.nja M src/ovirt/node/utils/network.py 2 files changed, 16 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/34/27434/1 diff --git a/ovirt-node.nja b/ovirt-node.nja new file mode 100644 index 0000000..149338a --- /dev/null +++ b/ovirt-node.nja @@ -0,0 +1,7 @@ +{ + "venv": "", + "project-type": "Import from sources", + "name": "ovirt-node", + "license": "GNU General Public License v3", + "description": "" +} \ No newline at end of file diff --git a/src/ovirt/node/utils/network.py b/src/ovirt/node/utils/network.py index d27831d..b9f202d 100644 --- a/src/ovirt/node/utils/network.py +++ b/src/ovirt/node/utils/network.py @@ -494,6 +494,11 @@ for slave in self.slave_nics: slave.identify() + @property + def slaves(self): + return open("/sys/class/net/%s/bonding/slaves" % self.ifname + ).readline().split() + def __str__(self): return self.build_str(["ifname", "slave_nics"]) @@ -576,6 +581,7 @@ if ifname == bond_name: self.logger.debug(" Is bond master") nic = BondedNIC(nic, bond_slaves) + nic = nic if nic.slaves else None if ifname == bootif: self.logger.debug(" Is bootif") @@ -791,7 +797,7 @@ continue vdev, vid, hdev = [field.strip() for field in line.split("|")] - if not hdev in vlans: + if hdev not in vlans: vlans[hdev] = [] vlans[hdev].append((vdev, vid)) except IOError as e: @@ -885,6 +891,6 @@ if not self.is_bond(mifname): raise RuntimeError("Can no delete '%s', it is no bond master" % mifname) - #process.call(["ip", "link", "set", "dev", mifname, "down"]) - #process.call(["ip", "link", "delete", mifname, "type", "bond"]) + # process.call(["ip", "link", "set", "dev", mifname, "down"]) + # process.call(["ip", "link", "delete", mifname, "type", "bond"]) fs.File(self.bonding_masters_filename).write("-%s" % mifname) -- To view, visit http://gerrit.ovirt.org/27434 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia2a718a9733a8e0981b68b706787a10768bd8d82 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Ryan Barry <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
