diff options
author | Dan Prince <dprince@redhat.com> | 2014-08-12 11:06:46 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2014-08-12 11:51:31 -0400 |
commit | f0ae3282450c2bb1bb35f22414858768f08d2653 (patch) | |
tree | edcf2d322f4b222bd0b11034ce4e09689caf10ef /os_net_config/utils.py | |
parent | f57b67880d5c70bbc287ab56395895bb88a1b011 (diff) |
Set the MAC to the primary interface
Adds support for a new 'primary' interface option exposed via the
object model and JSON parsers which can be used to force the
MAC address on a bridge. Only one interface on a given
bridge (or bond) may be set as the primary interface.
Also, update the ifcfg and eni providers so that they use
OVS_EXTRA (or ovs_extra) to pin the mac accordingly.
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r-- | os_net_config/utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py index a2df823..cd7ee65 100644 --- a/os_net_config/utils.py +++ b/os_net_config/utils.py @@ -34,6 +34,15 @@ def get_file_data(filename): return "" +def interface_mac(name): + try: + with open('/sys/class/net/%s/address' % name, "r") as f: + return f.read().rstrip() + except IOError: + logger.error("Unable to read file: %s" % name) + raise + + def diff(filename, data): file_data = get_file_data(filename) logger.debug("Diff file data:\n%s" % file_data) |