Move 'ips' field from Subnet object to VIF object

'ips' field in Subnet object [1] is a legacy field from Nova networks.
This is still used in the virt Firewall, but is not used in os-vif
project. Furthemore, the VIF object used by Nova to extract the port
IPs [2] is not provided by os-vif.

The reason to move this field from Subnet to VIF is because the IP list
should belong to the VIF object, which is linked with the port. The
Subnet object contains the CIDR of the subnetwork, but shouldn't store
the IPs given to an specific port.

[1] https://github.com/openstack/os-vif/blob/1.7.0/os_vif/objects/subnet.py#L30
[2] https://github.com/openstack/nova/blob/16.0.1/nova/virt/firewall.py#L180-L181

Change-Id: I99a4df96ee8e72915bdf9fc1327b9575dfa94586
Closes-Bug: #1720175
This commit is contained in:
Rodolfo Alonso Hernandez 2017-09-29 12:19:16 +01:00
parent b5a5b45104
commit a441c08f26
3 changed files with 16 additions and 12 deletions

View File

@ -21,13 +21,13 @@ from os_vif.objects import fields as osv_fields
class Subnet(osv_base.VersionedObject):
"""Represents a subnet."""
# Version 1.0: Initial version
VERSION = '1.0'
# Version 1.1: Removed "ips" field
VERSION = '1.1'
fields = {
'cidr': fields.IPNetworkField(),
'dns': osv_fields.ListOfIPAddressField(),
'gateway': fields.IPAddressField(),
'ips': fields.ObjectField("FixedIPList"),
'routes': fields.ObjectField("RouteList"),
'dhcp_server': fields.IPAddressField(),
}

View File

@ -22,7 +22,8 @@ from os_vif.objects import fields as osv_fields
class VIFBase(osv_base.VersionedObject, base.ComparableVersionedObject):
"""Represents a virtual network interface."""
# Version 1.0: Initial version
VERSION = '1.0'
# Version 1.1: Added "fixed_ips" field
VERSION = '1.1'
fields = {
# Unique identifier of the VIF port
@ -48,7 +49,10 @@ class VIFBase(osv_base.VersionedObject, base.ComparableVersionedObject):
# The virtual port profile metadata
'port_profile': fields.ObjectField('VIFPortProfileBase',
subclasses=True)
subclasses=True),
# The list of allocated IPs for this port.
'fixed_ips': fields.ObjectField("FixedIPList")
}

View File

@ -29,14 +29,14 @@ object_data = {
'Network': '1.1-27a8a3e236d1d239121668a590130154',
'Route': '1.0-5ca049cb82c4d4ec5edb1b839c1429c7',
'RouteList': '1.0-15ecf022a68ddbb8c2a6739cfc9f8f5e',
'Subnet': '1.0-6a8c192ef7492120d1a5e0fd08e44272',
'Subnet': '1.1-0b830431402bc62c6647df6636c24cd7',
'SubnetList': '1.0-15ecf022a68ddbb8c2a6739cfc9f8f5e',
'VIFBase': '1.0-4a5a8881dc999752cb050dd443458b6a',
'VIFBridge': '1.0-e78d355f3505361fafbf0797ffad484a',
'VIFDirect': '1.0-05c939280f4025fd1f7efb921a835c57',
'VIFGeneric': '1.0-c72e637ed620f0135ea50a9409a3f389',
'VIFHostDevice': '1.0-bb090f1869c3b4df36efda216ab97a61',
'VIFOpenVSwitch': '1.0-e78d355f3505361fafbf0797ffad484a',
'VIFBase': '1.1-d2f32fb05794a298b1b173612328fc05',
'VIFBridge': '1.0-e1650ffca52389e2a15a8977c12d6dea',
'VIFDirect': '1.0-2fc5f22b84d711e25f074f46cce19485',
'VIFGeneric': '1.0-0ef6c15d1ce1c9dc7987f232ad4f4f93',
'VIFHostDevice': '1.0-6232e3972a534172d22e05b523251fd7',
'VIFOpenVSwitch': '1.0-e1650ffca52389e2a15a8977c12d6dea',
'VIFPortProfile8021Qbg': '1.0-167f305f6e982b9368cc38763815d429',
'VIFPortProfile8021Qbh': '1.0-4b945f07d2666ab00a48d1dc225669b1',
'VIFPortProfileBase': '1.0-77509ea1ea0dd750d5864b9bd87d3f9d',
@ -44,7 +44,7 @@ object_data = {
'VIFPortProfileFPOpenVSwitch': '1.1-74e77f46aa5806930df6f37a0b76ff8b',
'VIFPortProfileFPBridge': '1.0-d50872b3cddd245ffebef6053dfbe27a',
'VIFPortProfileFPTap': '1.0-11670d8dbabd772ff0da26961adadc5a',
'VIFVHostUser': '1.1-1f95b43be1f884f090ca1f4d79adfd35',
'VIFVHostUser': '1.1-3fa1fcaabf517259c6e0211c926237f8',
'VIFPortProfileOVSRepresentor': '1.1-30e555981003a109b133da5b43ded5df',
}