Skip to content
Snippets Groups Projects
Commit 5b4cd1b0 authored by Guido Trotter's avatar Guido Trotter
Browse files

ConfigWriter: remove _ReleaseLock

Remove empty function _ReleaseLock and all its calls. Since we only
have one configwriter per cluster the locking needs to cover all the
data in the object, and not just the file contents. Locking in
ConfigWriter will be handled using the ganeti locking library.

Reviewed-by: iustinp
parent 26517d45
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,6 @@ class ConfigWriter: ...@@ -93,7 +93,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
prefix = self._config_data.cluster.mac_prefix prefix = self._config_data.cluster.mac_prefix
all_macs = self._AllMACs() all_macs = self._AllMACs()
retries = 64 retries = 64
...@@ -117,7 +116,6 @@ class ConfigWriter: ...@@ -117,7 +116,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
all_macs = self._AllMACs() all_macs = self._AllMACs()
return mac in all_macs return mac in all_macs
...@@ -126,7 +124,6 @@ class ConfigWriter: ...@@ -126,7 +124,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
lvnames = set() lvnames = set()
for instance in self._config_data.instances.values(): for instance in self._config_data.instances.values():
node_data = instance.MapLVsByNode() node_data = instance.MapLVsByNode()
...@@ -172,7 +169,6 @@ class ConfigWriter: ...@@ -172,7 +169,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
result = [] result = []
for instance in self._config_data.instances.values(): for instance in self._config_data.instances.values():
...@@ -185,7 +181,6 @@ class ConfigWriter: ...@@ -185,7 +181,6 @@ class ConfigWriter:
"""Stub verify function. """Stub verify function.
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
result = [] result = []
seen_macs = [] seen_macs = []
...@@ -259,7 +254,6 @@ class ConfigWriter: ...@@ -259,7 +254,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster.tcpudp_port_pool.copy() return self._config_data.cluster.tcpudp_port_pool.copy()
def AllocatePort(self): def AllocatePort(self):
...@@ -294,7 +288,6 @@ class ConfigWriter: ...@@ -294,7 +288,6 @@ class ConfigWriter:
Returns: rsa hostkey Returns: rsa hostkey
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster.rsahostkeypub return self._config_data.cluster.rsahostkeypub
def AddInstance(self, instance): def AddInstance(self, instance):
...@@ -393,7 +386,6 @@ class ConfigWriter: ...@@ -393,7 +386,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.instances.keys() return self._config_data.instances.keys()
...@@ -402,7 +394,6 @@ class ConfigWriter: ...@@ -402,7 +394,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return utils.MatchNameComponent(short_name, return utils.MatchNameComponent(short_name,
self._config_data.instances.keys()) self._config_data.instances.keys())
...@@ -421,7 +412,6 @@ class ConfigWriter: ...@@ -421,7 +412,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
if instance_name not in self._config_data.instances: if instance_name not in self._config_data.instances:
return None return None
...@@ -455,7 +445,6 @@ class ConfigWriter: ...@@ -455,7 +445,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return utils.MatchNameComponent(short_name, return utils.MatchNameComponent(short_name,
self._config_data.nodes.keys()) self._config_data.nodes.keys())
...@@ -469,7 +458,6 @@ class ConfigWriter: ...@@ -469,7 +458,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
if node_name not in self._config_data.nodes: if node_name not in self._config_data.nodes:
return None return None
...@@ -481,14 +469,12 @@ class ConfigWriter: ...@@ -481,14 +469,12 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.nodes.keys() return self._config_data.nodes.keys()
def DumpConfig(self): def DumpConfig(self):
"""Return the entire configuration of the cluster. """Return the entire configuration of the cluster.
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data return self._config_data
def _BumpSerialNo(self): def _BumpSerialNo(self):
...@@ -537,10 +523,6 @@ class ConfigWriter: ...@@ -537,10 +523,6 @@ class ConfigWriter:
self._config_size = st.st_size self._config_size = st.st_size
self._config_inode = st.st_ino self._config_inode = st.st_ino
def _ReleaseLock(self):
"""xxxx
"""
def _DistributeConfig(self): def _DistributeConfig(self):
"""Distribute the configuration to the other nodes. """Distribute the configuration to the other nodes.
...@@ -634,7 +616,6 @@ class ConfigWriter: ...@@ -634,7 +616,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster.volume_group_name return self._config_data.cluster.volume_group_name
def SetVGName(self, vg_name): def SetVGName(self, vg_name):
...@@ -650,7 +631,6 @@ class ConfigWriter: ...@@ -650,7 +631,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster.default_bridge return self._config_data.cluster.default_bridge
def GetMACPrefix(self): def GetMACPrefix(self):
...@@ -658,7 +638,6 @@ class ConfigWriter: ...@@ -658,7 +638,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster.mac_prefix return self._config_data.cluster.mac_prefix
def GetClusterInfo(self): def GetClusterInfo(self):
...@@ -669,7 +648,6 @@ class ConfigWriter: ...@@ -669,7 +648,6 @@ class ConfigWriter:
""" """
self._OpenConfig() self._OpenConfig()
self._ReleaseLock()
return self._config_data.cluster return self._config_data.cluster
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment