Ondřej Svoboda has uploaded a new change for review.

Change subject: netinfo: Make bootproto4 a boolean and rename it while it is 
still unused
......................................................................

netinfo: Make bootproto4 a boolean and rename it while it is still unused

No other protocol (BOOTP) is supported and the future 'dhcp6' flag will
be a boolean as well (related to the already existing 'dhcpv6' flag
in setupNetworks).

Change-Id: I29abc8db77f2ab12188d6007f072e16ccfd4b223
Signed-off-by: Ondřej Svoboda <[email protected]>
---
M lib/vdsm/netinfo.py
M vdsm/rpc/vdsmapi-schema.json
2 files changed, 16 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/35984/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index bc6edbf..26dbae5 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -437,8 +437,7 @@
         ipv4addr, ipv4netmask, ipv4addrs, ipv6addrs = getIpInfo(iface, ipaddrs)
         data.update({'iface': iface, 'bridged': bridged,
                      'addr': ipv4addr, 'netmask': ipv4netmask,
-                     'bootproto4': ('dhcp' if ipv4addr and iface in dhcp4
-                                    else 'none'),
+                     'dhcp4': bool(ipv4addr) and iface in dhcp4,
                      'ipv4addrs': ipv4addrs,
                      'ipv6addrs': ipv6addrs,
                      'gateway': _get_gateway(routes, iface),
@@ -490,12 +489,11 @@
             'ipv6addrs': ipv6addrs,
             'gateway': _get_gateway(routes, link.name),
             'ipv6gateway': _get_gateway(routes, link.name, family=6),
-            'bootproto4': ('dhcp' if ipv4addr and link.name in dhcp4
-                           else 'none'),
+            'dhcp4': bool(ipv4addr) and link.name in dhcp4,
             'mtu': str(link.mtu),
             'netmask': ipv4netmask}
     if 'BOOTPROTO' not in info['cfg']:
-        info['cfg']['BOOTPROTO'] = info['bootproto4']
+        info['cfg']['BOOTPROTO'] = info['dhcp4']
     return info
 
 
@@ -630,7 +628,7 @@
     """Set network 'cfg' 'BOOTPROTO' for backwards engine compatibility."""
     for netAttrs in networks.itervalues():
         if netAttrs['bridged'] and 'BOOTPROTO' not in netAttrs['cfg']:
-            netAttrs['cfg']['BOOTPROTO'] = netAttrs['bootproto4']
+            netAttrs['cfg']['BOOTPROTO'] = netAttrs['dhcp4']
 
 
 def get(vdsmnets=None):
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index edca1a9..b5a05da 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -658,9 +658,8 @@
 # @stp:         Whether Spanning Tree Protocol status for the bridge device
 #               should be turned on
 #
-# @bootproto4:  The protocol used to set up the network. Reported values are
-#               "dhcp" if a DHCPv4 client was used, 'none' if set up manually.
-#               (Added in version 4.15.0.)
+# @dhcp4:       Whether DHCPv4 was used to set up the network.
+#               (Renamed and changed to boolean in version 4.17.0.)
 #
 # @addr:        The primary IPv4 address assigned to the bridge device
 #
@@ -694,7 +693,7 @@
 # XXX: Add types for IP Address?
 ##
 {'type': 'NetInfoBridgedNetwork',
- 'data': {'ports': ['str'], 'stp': 'bool', 'bootproto4': 'str', 'addr': 'str',
+ 'data': {'ports': ['str'], 'stp': 'bool', 'dhcp4': 'bool', 'addr': 'str',
           'netmask': 'str', 'gateway': 'str', 'ipv4addrs': ['str'],
           'ipv6addrs': ['str'], 'ipv6gateway': 'str', 'mtu': 'uint',
           'cfg': 'StringMap', 'bridged': 'bool', '*hostQos': 'HostQoSParams',
@@ -735,9 +734,8 @@
 #
 # @speed:       The reported speed of the nic
 #
-# @bootproto4:  The protocol used to set up the network. Reported values are
-#               "dhcp" if a DHCPv4 client was used, 'none' if set up manually.
-#               (Added in version 4.16.0.)
+# @dhcp4:       Whether DHCPv4 was used to set up the nic.
+#               (Renamed and changed to boolean in version 4.17.0.)
 #
 # @addr:        The primary IPv4 address assigned to the nic device
 #
@@ -759,7 +757,7 @@
 # Since: 4.10.0
 ##
 {'type': 'NetInfoNic',
- 'data': {'speed': 'int', 'bootproto4': 'str', 'addr': 'str', 'netmask': 'str',
+ 'data': {'speed': 'int', 'dhcp4': 'bool', 'addr': 'str', 'netmask': 'str',
           'ipv4addrs': ['str'], 'ipv6addrs': ['str'], 'hwaddr': 'str',
           'mtu': 'uint', '*permhwaddr': 'str'}}
 
@@ -772,9 +770,8 @@
 #
 # @active_slave:Active slave of the bond if exists, '' otherwise
 #
-# @bootproto4:  The protocol used to set up the network. Reported values are
-#               "dhcp" if a DHCPv4 client was used, 'none' if set up manually.
-#               (Added in version 4.16.0.)
+# @dhcp4:       Whether DHCPv4 was used to set up the bond.
+#               (Renamed and changed to boolean in version 4.17.0.)
 #
 # @addr:        The primary IPv4 address assigned to the bond device
 #
@@ -798,7 +795,7 @@
 # Since: 4.10.0
 ##
 {'type': 'NetInfoBond',
- 'data': {'slaves': ['str'], 'active_slave': 'str','bootproto4': 'str',
+ 'data': {'slaves': ['str'], 'active_slave': 'str','dhcp4': 'bool',
           'addr': 'str', 'netmask': 'str', 'ipv4addrs': ['str'],
           'ipv6addrs': ['str'], 'hwaddr': 'str', 'cfg': 'StringMap',
           'mtu': 'uint', 'opts': 'StringMap'}}
@@ -810,9 +807,8 @@
 #
 # @iface:       The network device associated with the vlan
 #
-# @bootproto4:  The protocol used to set up the network. Reported values are
-#               "dhcp" if a DHCPv4 client was used, 'none' if set up manually.
-#               (Added in version 4.16.0.)
+# @dhcp4:       Whether DHCPv4 was used to set up the vlan.
+#               (Renamed and changed to boolean in version 4.17.0.)
 #
 # @addr:        The primary IPv4 address assigned to the vlan device
 #
@@ -831,7 +827,7 @@
 # Since: 4.10.0
 ##
 {'type': 'NetInfoVlan',
- 'data': {'iface': 'str', 'bootproto4': 'str', 'addr': 'str', 'netmask': 'str',
+ 'data': {'iface': 'str', 'dhcp4': 'bool', 'addr': 'str', 'netmask': 'str',
           'ipv4addrs': ['str'], 'ipv6addrs': ['str'], 'mtu': 'uint',
           'vlanid': 'uint'}}
 


-- 
To view, visit http://gerrit.ovirt.org/35984
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29abc8db77f2ab12188d6007f072e16ccfd4b223
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to