diff options
author | Brent Eagles <beagles@redhat.com> | 2016-11-07 17:57:02 -0330 |
---|---|---|
committer | Brent Eagles <beagles@redhat.com> | 2016-11-18 14:38:45 -0330 |
commit | 433a0f3cbe59fd5da183245bf7e6dcd4af4b8c88 (patch) | |
tree | a70bd0e53a3b73bb5c350982459b048d2dbc8c79 /os_net_config/objects.py | |
parent | 9971eb3af988b1f7c003048af161489ab79b1b0c (diff) |
Add support for enabling hotplug on interfaces
This patch adds support for enabling hotplugging on interfaces (disabled
by default). This is useful for configuring SR-IOV root devices so that
they "return" to the system when no longer used by a VM.
Note: also updates an invalid value in the interface and ib_interface
sample files.
Partial-Bug: #1639901
Change-Id: Idfc17d6f20bb306271838895bc53f4b109dd664d
Diffstat (limited to 'os_net_config/objects.py')
-rw-r--r-- | os_net_config/objects.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/os_net_config/objects.py b/os_net_config/objects.py index 8d52e73..741f304 100644 --- a/os_net_config/objects.py +++ b/os_net_config/objects.py @@ -287,7 +287,7 @@ class Interface(_BaseOpts): def __init__(self, name, use_dhcp=False, use_dhcpv6=False, addresses=None, routes=None, mtu=None, primary=False, nic_mapping=None, persist_mapping=False, defroute=True, dhclient_args=None, - dns_servers=None, ethtool_opts=None): + dns_servers=None, ethtool_opts=None, hotplug=False): addresses = addresses or [] routes = routes or [] dns_servers = dns_servers or [] @@ -296,13 +296,16 @@ class Interface(_BaseOpts): persist_mapping, defroute, dhclient_args, dns_servers) self.ethtool_opts = ethtool_opts + self.hotplug = hotplug @staticmethod def from_json(json): name = _get_required_field(json, 'name', 'Interface') + hotplug = strutils.bool_from_string(str(json.get('hotplug', False))) opts = _BaseOpts.base_opts_from_json(json) ethtool_opts = json.get('ethtool_opts', None) - return Interface(name, *opts, ethtool_opts=ethtool_opts) + return Interface(name, *opts, ethtool_opts=ethtool_opts, + hotplug=hotplug) class Vlan(_BaseOpts): |