Commit 79b26a7a authored by Iustin Pop's avatar Iustin Pop
Browse files

Relax the restrictions on temporary DRBD minors

Currently the restrictions are too harsh: there is a time interval
between an instance gets a new disk and before it is added to the
configuration in which the restriction is not met. We solve this by
allowing temporary DRBD minors to match existing minors (for the same
instance), such that parallel creations/minor allocations are OK.

The change is done by moving the add of temporary minors to the
minor map after the instance minors are computed, and only considering
them as duplicate if the instance name doesn't match.

Reviewed-by: ultrotter
parent 4a89c54a
......@@ -441,14 +441,14 @@ class ConfigWriter:
duplicates = []
my_dict = dict((node, {}) for node in self._config_data.nodes)
for instance in self._config_data.instances.itervalues():
for disk in instance.disks:
duplicates.extend(_AppendUsedPorts(instance.name, disk, my_dict))
for (node, minor), instance in self._temporary_drbds.iteritems():
if minor in my_dict[node]:
if minor in my_dict[node] and my_dict[node][minor] != instance:
duplicates.append((node, minor, instance, my_dict[node][minor]))
else:
my_dict[node][minor] = instance
for instance in self._config_data.instances.itervalues():
for disk in instance.disks:
duplicates.extend(_AppendUsedPorts(instance.name, disk, my_dict))
return my_dict, duplicates
@locking.ssynchronized(_config_lock)
......
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