Logo Search packages:      
Sourcecode: ganeti version File versions  Download package

def lib::config::ConfigWriter::SetDiskID (   self,
  disk,
  node_name 
)

Convert the unique ID to the ID needed on the target nodes.

This is used only for drbd, which needs ip/port configuration.

The routine descends down and updates its children also, because
this helps when the only the top device is passed to the remote
node.

Definition at line 185 of file config.py.

00185                                       :
    """Convert the unique ID to the ID needed on the target nodes.

    This is used only for drbd, which needs ip/port configuration.

    The routine descends down and updates its children also, because
    this helps when the only the top device is passed to the remote
    node.

    """
    if disk.children:
      for child in disk.children:
        self.SetDiskID(child, node_name)

    if disk.logical_id is None and disk.physical_id is not None:
      return
    if disk.dev_type in constants.LDS_DRBD:
      pnode, snode, port = disk.logical_id
      if node_name not in (pnode, snode):
        raise errors.ConfigurationError("DRBD device not knowing node %s" %
                                        node_name)
      pnode_info = self.GetNodeInfo(pnode)
      snode_info = self.GetNodeInfo(snode)
      if pnode_info is None or snode_info is None:
        raise errors.ConfigurationError("Can't find primary or secondary node"
                                        " for %s" % str(disk))
      if pnode == node_name:
        disk.physical_id = (pnode_info.secondary_ip, port,
                            snode_info.secondary_ip, port)
      else: # it must be secondary, we tested above
        disk.physical_id = (snode_info.secondary_ip, port,
                            pnode_info.secondary_ip, port)
    else:
      disk.physical_id = disk.logical_id
    return

  def AddTcpUdpPort(self, port):


Generated by  Doxygen 1.6.0   Back to index