Commit 32388e6d authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix adding of disks to an instance

The ConfigWriter.AllocateDRBDMinor requires the instance name, not the
instance object. The LUSetInstanceParms is passing wrongly the instance
object, which can cause breakage.

The patch also adds asserts to check for this mismatch in ConfigWriter.

Reviewed-by: ultrotter
parent 5dc626fd
......@@ -5712,7 +5712,7 @@ class LUSetInstanceParams(LogicalUnit):
disk_idx_base = len(instance.disks)
new_disk = _GenerateDiskTemplate(self,
instance.disk_template,
instance, instance.primary_node,
instance.name, instance.primary_node,
instance.secondary_nodes,
[disk_dict],
file_path,
......
......@@ -443,7 +443,13 @@ class ConfigWriter:
multiple minors. The result is the list of minors, in the same
order as the passed nodes.
@type instance: string
@param instance: the instance for which we allocate minors
"""
assert isinstance(instance, basestring), \
"Invalid argument passed to AllocateDRBDMinor"
d_map = self._UnlockedComputeDRBDMap()
result = []
for nname in nodes:
......@@ -484,6 +490,8 @@ class ConfigWriter:
released
"""
assert isinstance(instance, basestring), \
"Invalid argument passed to ReleaseDRBDMinors"
for key, name in self._temporary_drbds.items():
if name == instance:
del self._temporary_drbds[key]
......
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