Revision 0debfb35 lib/config.py

b/lib/config.py
724 724
    return self._config_data.cluster.rsahostkeypub
725 725

  
726 726
  @locking.ssynchronized(_config_lock)
727
  def AddInstance(self, instance):
727
  def AddInstance(self, instance, ec_id):
728 728
    """Add an instance to the config.
729 729

  
730 730
    This should be used after creating a new instance.
......
747 747
                                        " MAC address '%s' already in use." %
748 748
                                        (instance.name, nic.mac))
749 749

  
750
    self._EnsureUUID(instance)
750
    self._EnsureUUID(instance, ec_id)
751 751

  
752 752
    instance.serial_no = 1
753 753
    instance.ctime = instance.mtime = time.time()
......
758 758
      self._temporary_macs.discard(nic.mac)
759 759
    self._WriteConfig()
760 760

  
761
  def _EnsureUUID(self, item):
761
  def _EnsureUUID(self, item, ec_id):
762 762
    """Ensures a given object has a valid UUID.
763 763

  
764 764
    @param item: the instance or node to be checked
765
    @param ec_id: the execution context id for the uuid reservation
765 766

  
766 767
    """
767 768
    if not item.uuid:
......
907 908
    return my_dict
908 909

  
909 910
  @locking.ssynchronized(_config_lock)
910
  def AddNode(self, node):
911
  def AddNode(self, node, ec_id):
911 912
    """Add a node to the configuration.
912 913

  
913 914
    @type node: L{objects.Node}
......
916 917
    """
917 918
    logging.info("Adding node %s to configuration", node.name)
918 919

  
919
    self._EnsureUUID(node)
920
    self._EnsureUUID(node, ec_id)
920 921

  
921 922
    node.serial_no = 1
922 923
    node.ctime = node.mtime = time.time()

Also available in: Unified diff