From: Michael Hanselmann Date: Tue, 11 Jan 2011 15:29:51 +0000 (+0100) Subject: objects: Fix off-by-one in error message X-Git-Tag: v2.4.0beta1~20 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/daa55b04b5b4c976b76fe218b29b5e14dfddf82a objects: Fix off-by-one in error message For an instance with a single disk the message should be “… disks 0 to 0”, not “… 0 to 1”. Signed-off-by: Michael Hanselmann Reviewed-by: René Nussbaumer --- diff --git a/lib/objects.py b/lib/objects.py index fdda582..274c756 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -808,7 +808,7 @@ class Instance(TaggableObject): errors.ECODE_INVAL) except IndexError: raise errors.OpPrereqError("Invalid disk index: %d (instace has disks" - " 0 to %d" % (idx, len(self.disks)), + " 0 to %d" % (idx, len(self.disks) - 1), errors.ECODE_INVAL) def ToDict(self):