def _LookupDiskIndex(self, idx):
    try:
      return int(idx)
    except ValueError:
      pass
    for i, d in enumerate(self.cfg.GetInstanceDisks(self.instance.uuid)):
      if d.name == idx or d.uuid == idx:
        return i
    raise errors.OpPrereqError("Lookup of disk %r failed" % idx)
Looks up uuid or name of disk if necessary.
dataset/ETHPy150Open ganeti/ganeti/lib/cmdlib/instance_set_params.py/LUInstanceSetParams._LookupDiskIndex