Commit a0d2a91e authored by Thomas Thrainer's avatar Thomas Thrainer
Browse files

Only serialize dynamic_params on demand



To make sure that the dynamic_params field is not serialized by accident
to the configuration file only include it in the serialization when
explicitly asked for.
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarJose A. Lopes <jabolopes@google.com>
parent 204eb58c
...@@ -743,7 +743,8 @@ class Disk(ConfigObject): ...@@ -743,7 +743,8 @@ class Disk(ConfigObject):
self.dynamic_params = dyn_disk_params self.dynamic_params = dyn_disk_params
def ToDict(self): # pylint: disable=W0221
def ToDict(self, include_dynamic_params=False):
"""Disk-specific conversion to standard python types. """Disk-specific conversion to standard python types.
This replaces the children lists of objects with lists of This replaces the children lists of objects with lists of
...@@ -751,6 +752,8 @@ class Disk(ConfigObject): ...@@ -751,6 +752,8 @@ class Disk(ConfigObject):
""" """
bo = super(Disk, self).ToDict() bo = super(Disk, self).ToDict()
if not include_dynamic_params and "dynamic_params" in bo:
del bo["dynamic_params"]
for attr in ("children",): for attr in ("children",):
alist = bo.get(attr, None) alist = bo.get(attr, None)
......
...@@ -903,7 +903,7 @@ class RpcRunner(_RpcClientBase, ...@@ -903,7 +903,7 @@ class RpcRunner(_RpcClientBase,
disk.UpdateDynamicDiskParams(node, node_ips) disk.UpdateDynamicDiskParams(node, node_ips)
ret.append(disk.ToDict()) ret.append(disk.ToDict(include_dynamic_params=True))
return ret return ret
......
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