On Tue, Sep 23, 2014 at 12:00:17PM +0200, 'Klaus Aehlig' via ganeti-devel wrote:
....they are mandatory for OpPrereqError exceptions.

Signed-off-by: Klaus Aehlig <[email protected]>
---
lib/cmdlib/cluster.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/cmdlib/cluster.py b/lib/cmdlib/cluster.py
index 95f7c7f..c8fb8b2 100644
--- a/lib/cmdlib/cluster.py
+++ b/lib/cmdlib/cluster.py
@@ -745,7 +745,8 @@ def CheckFileBasedStoragePathVsEnabledDiskTemplates(
        raise errors.OpPrereqError(
            "Unsetting the '%s' storage directory while having '%s' storage"
            " enabled is not permitted." %
-            (file_disk_template, file_disk_template))
+            (file_disk_template, file_disk_template),
+            errors.ECODE_INVAL)
    else:
      if not file_storage_enabled:
        logging_warn_fn(
@@ -905,12 +906,14 @@ class LUClusterSetParams(LogicalUnit):
    if self.op.vg_name == '':
      if lvm_is_enabled:
        raise errors.OpPrereqError("Cannot unset volume group if lvm-based"
-                                   " disk templates are or get enabled.")
+                                   " disk templates are or get enabled.",
+                                   errors.ECODE_INVAL)

    if self.op.vg_name is None:
      if current_vg_name is None and lvm_is_enabled:
        raise errors.OpPrereqError("Please specify a volume group when"
-                                   " enabling lvm-based disk-templates.")
+                                   " enabling lvm-based disk-templates.",
+                                   errors.ECODE_INVAL)

    if self.op.vg_name is not None and not self.op.vg_name:
      if self.cfg.HasAnyDiskOfType(constants.DT_PLAIN):
--
2.1.0.rc2.206.gedb03e5


LGTM

Reply via email to