Commit 51e9eef6 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

Improve error handling when looking up instances



When looking up configuration data of instances which don't
exist, the code so far fails with a cryptic error messages
about NoneType not having an attribute. Although actually
this situation should not happen, let's at least throw an
exception with a proper description.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent c1ff2832
......@@ -2892,7 +2892,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
if test:
nimg.hyp_fail = True
else:
nimg.instances = [inst.uuid for (_, inst) in
nimg.instances = [uuid for (uuid, _) in
self.cfg.GetMultiInstanceInfoByName(idata)]
def _UpdateNodeInfo(self, ninfo, nresult, nimg, vg_name):
......
......@@ -1782,7 +1782,11 @@ class ConfigWriter(object):
result = []
for name in inst_names:
instance = self._UnlockedGetInstanceInfoByName(name)
result.append((instance.uuid, instance))
if instance:
result.append((instance.uuid, instance))
else:
raise errors.ConfigurationError("Instance data of instance '%s'"
" not found." % name)
return result
@locking.ssynchronized(_config_lock, shared=1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment