Add error code to OpPrereqError use
authorHrvoje Ribicic <riba@google.com>
Tue, 18 Aug 2015 14:27:10 +0000 (14:27 +0000)
committerHrvoje Ribicic <riba@google.com>
Tue, 18 Aug 2015 17:25:08 +0000 (19:25 +0200)
... otherwise the error is misidentified as an unpacking error.

Signed-off-by: Hrvoje Ribicic <riba@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/cmdlib/instance_storage.py

index 5fbb593..9b3a998 100644 (file)
@@ -1136,7 +1136,8 @@ def _CheckVgCapacityForNode(node_name, node_info, vg, requested):
   lvm_vg_info = utils.storage.LookupSpaceInfoByStorageType(
       space_info, constants.ST_LVM_VG)
   if not lvm_vg_info:
-    raise errors.OpPrereqError("Can't retrieve storage information for LVM")
+    raise errors.OpPrereqError("Can't retrieve storage information for LVM",
+                               errors.ECODE_ENVIRON)
   vg_free = lvm_vg_info.get("storage_free", None)
   if not isinstance(vg_free, int):
     raise errors.OpPrereqError("Can't compute free disk space on node"