Revision 61cf6b5e lib/config.py
b/lib/config.py | ||
---|---|---|
478 | 478 |
nodes, result) |
479 | 479 |
return result |
480 | 480 |
|
481 |
@locking.ssynchronized(_config_lock) |
|
482 |
def ReleaseDRBDMinors(self, instance): |
|
481 |
def _UnlockedReleaseDRBDMinors(self, instance): |
|
483 | 482 |
"""Release temporary drbd minors allocated for a given instance. |
484 | 483 |
|
485 |
This should be called on both the error paths and on the success |
|
486 |
paths (after the instance has been added or updated). |
|
487 |
|
|
488 | 484 |
@type instance: string |
489 | 485 |
@param instance: the instance for which temporary minors should be |
490 | 486 |
released |
... | ... | |
496 | 492 |
if name == instance: |
497 | 493 |
del self._temporary_drbds[key] |
498 | 494 |
|
495 |
@locking.ssynchronized(_config_lock) |
|
496 |
def ReleaseDRBDMinors(self, instance): |
|
497 |
"""Release temporary drbd minors allocated for a given instance. |
|
498 |
|
|
499 |
This should be called on the error paths, on the success paths |
|
500 |
it's automatically called by the ConfigWriter add and update |
|
501 |
functions. |
|
502 |
|
|
503 |
This function is just a wrapper over L{_UnlockedReleaseDRBDMinors}. |
|
504 |
|
|
505 |
@type instance: string |
|
506 |
@param instance: the instance for which temporary minors should be |
|
507 |
released |
|
508 |
|
|
509 |
""" |
|
510 |
self._UnlockedReleaseDRBDMinors(instance) |
|
511 |
|
|
499 | 512 |
@locking.ssynchronized(_config_lock, shared=1) |
500 | 513 |
def GetConfigVersion(self): |
501 | 514 |
"""Get the configuration version. |
... | ... | |
582 | 595 |
|
583 | 596 |
instance.serial_no = 1 |
584 | 597 |
self._config_data.instances[instance.name] = instance |
598 |
self._UnlockedReleaseDRBDMinors(instance.name) |
|
585 | 599 |
self._WriteConfig() |
586 | 600 |
|
587 | 601 |
def _SetInstanceStatus(self, instance_name, status): |
... | ... | |
1118 | 1132 |
# for node updates, we need to increase the cluster serial too |
1119 | 1133 |
self._config_data.cluster.serial_no += 1 |
1120 | 1134 |
|
1135 |
if isinstance(target, objects.Instance): |
|
1136 |
self._UnlockedReleaseDRBDMinors(target.name) |
|
1137 |
|
|
1121 | 1138 |
self._WriteConfig() |
Also available in: Unified diff