Commit 48616625 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Guido Trotter
Browse files

Remove family and size from network objects



This info is not used by Ganeti and therefore is removed.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 5cfa6c37
......@@ -286,7 +286,7 @@ INSTANCE_NAME, INSTANCE_PRIMARY, INSTANCE_SECONDARY,
INSTANCE_OS_TYPE, INSTANCE_DISK_TEMPLATE, INSTANCE_MEMORY,
INSTANCE_DISK_SIZES, INSTANCE_VCPUS, INSTANCE_NIC_COUNT,
INSTANCE_NICn_IP, INSTANCE_NICn_BRIDGE, INSTANCE_NICn_MAC,
INSTANCE_NICn_NETWORK, INSTANCE_NICn_NETWORK_FAMILY,
INSTANCE_NICn_NETWORK,
INSTANCE_NICn_NETWORK_UUID, INSTANCE_NICn_NETWORK_SUBNET,
INSTANCE_NICn_NETWORK_GATEWAY, INSTANCE_NICn_NETWORK_SUBNET6,
INSTANCE_NICn_NETWORK_GATEWAY6, INSTANCE_NICn_NETWORK_MAC_PREFIX,
......
......@@ -16242,8 +16242,7 @@ class LUNetworkAdd(LogicalUnit):
network6=self.op.network6,
gateway6=self.op.gateway6,
mac_prefix=self.op.mac_prefix,
uuid=self.network_uuid,
family=constants.IP4_VERSION)
uuid=self.network_uuid)
# Initialize the associated address pool
try:
pool = network.AddressPool.InitializeNetwork(nobj)
......
......@@ -123,14 +123,12 @@ class AddressPool(object):
return (self.reservations | self.ext_reservations)
def Validate(self):
assert self.net.family == 4
assert len(self.reservations) == self._GetSize()
assert len(self.ext_reservations) == self._GetSize()
all_res = self.reservations & self.ext_reservations
assert not all_res.any()
if self.gateway is not None:
assert self.net.family == self.gateway.version
assert self.gateway in self.network
if self.network6 and self.gateway6:
......
......@@ -2035,12 +2035,10 @@ class Network(TaggableObject):
"name",
"serial_no",
"mac_prefix",
"family",
"network",
"network6",
"gateway",
"gateway6",
"size",
"reservations",
"ext_reservations",
] + _TIMESTAMPS + _UUID
......@@ -2055,7 +2053,6 @@ class Network(TaggableObject):
result = {
"%sNETWORK" % prefix: self.name,
"%sNETWORK_UUID" % prefix: self.uuid,
"%sNETWORK_FAMILY" % prefix: str(self.family),
"%sNETWORK_TAGS" % prefix: " ".join(self.tags),
}
if self.network:
......@@ -2075,11 +2072,13 @@ class Network(TaggableObject):
def FromDict(cls, val):
"""Custom function for networks.
Remove deprecated network_type. Still this info can be passed via tags.
Remove deprecated network_type and family.
"""
if "network_type" in val:
del val["network_type"]
if "family" in val:
del val["family"]
obj = super(Network, cls).FromDict(val)
return obj
......
......@@ -174,8 +174,6 @@ $(buildObject "Network" "network" $
[ simpleField "name" [t| NonEmptyString |]
, optionalField $
simpleField "mac_prefix" [t| String |]
, optionalField $
simpleField "family" [t| Int |]
, simpleField "network" [t| NonEmptyString |]
, optionalField $
simpleField "network6" [t| String |]
......@@ -183,8 +181,6 @@ $(buildObject "Network" "network" $
simpleField "gateway" [t| String |]
, optionalField $
simpleField "gateway6" [t| String |]
, optionalField $
simpleField "size" [t| J.JSValue |]
, optionalField $
simpleField "reservations" [t| String |]
, optionalField $
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment