Revision 61cf6b5e

b/lib/cmdlib.py
4566 4566
    # Declare that we don't want to remove the instance lock anymore, as we've
4567 4567
    # added the instance to the config
4568 4568
    del self.remove_locks[locking.LEVEL_INSTANCE]
4569
    # Remove the temp. assignements for the instance's drbds
4570
    self.cfg.ReleaseDRBDMinors(instance)
4571 4569
    # Unlock all the nodes
4572 4570
    if self.op.mode == constants.INSTANCE_IMPORT:
4573 4571
      nodes_keep = [self.op.src_node]
......
5164 5162
      dev.logical_id = new_logical_id
5165 5163
      cfg.SetDiskID(dev, pri_node)
5166 5164
    cfg.Update(instance)
5167
    # we can remove now the temp minors as now the new values are
5168
    # written to the config file (and therefore stable)
5169
    self.cfg.ReleaseDRBDMinors(instance.name)
5170 5165

  
5171 5166
    # and now perform the drbd attach
5172 5167
    info("attaching primary drbds to new secondary (standalone => connected)")
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