Revision a7f5dc98

b/lib/cmdlib.py
392 392
      wanted.append(instance)
393 393

  
394 394
  else:
395
    wanted = lu.cfg.GetInstanceList()
396
  return utils.NiceSort(wanted)
395
    wanted = utils.NiceSort(lu.cfg.GetInstanceList())
396
  return wanted
397 397

  
398 398

  
399 399
def _CheckOutputFields(static, dynamic, selected):
......
3114 3114

  
3115 3115
    """
3116 3116
    all_info = self.cfg.GetAllInstancesInfo()
3117
    if self.do_locking:
3118
      instance_names = self.acquired_locks[locking.LEVEL_INSTANCE]
3119
    elif self.wanted != locking.ALL_SET:
3120
      instance_names = self.wanted
3121
      missing = set(instance_names).difference(all_info.keys())
3122
      if missing:
3123
        raise errors.OpExecError(
3124
          "Some instances were removed before retrieving their data: %s"
3125
          % missing)
3117
    if self.wanted == locking.ALL_SET:
3118
      # caller didn't specify instance names, so ordering is not important
3119
      if self.do_locking:
3120
        instance_names = self.acquired_locks[locking.LEVEL_INSTANCE]
3121
      else:
3122
        instance_names = all_info.keys()
3123
      instance_names = utils.NiceSort(instance_names)
3126 3124
    else:
3127
      instance_names = all_info.keys()
3125
      # caller did specify names, so we must keep the ordering
3126
      if self.do_locking:
3127
        tgt_set = self.acquired_locks[locking.LEVEL_INSTANCE]
3128
      else:
3129
        tgt_set = all_info.keys()
3130
      missing = set(self.wanted).difference(tgt_set)
3131
      if missing:
3132
        raise errors.OpExecError("Some instances were removed before"
3133
                                 " retrieving their data: %s" % missing)
3134
      instance_names = self.wanted
3128 3135

  
3129
    instance_names = utils.NiceSort(instance_names)
3130 3136
    instance_list = [all_info[iname] for iname in instance_names]
3131 3137

  
3132 3138
    # begin data gathering

Also available in: Unified diff