Introduce --hotplug-if-possible option
[ganeti-local] / lib / cmdlib / instance.py
index 8229fb5..a340bc0 100644 (file)
@@ -2665,14 +2665,19 @@ class LUInstanceSetParams(LogicalUnit):
     # dictionary with instance information after the modification
     ispec = {}
 
-    if self.op.hotplug:
+    if self.op.hotplug or self.op.hotplug_if_possible:
       result = self.rpc.call_hotplug_supported(self.instance.primary_node,
                                                self.instance)
-      # result.Raise("Hotplug is not supported.")
       if result.fail_msg:
-        self.LogWarning(result.fail_msg)
-        self.op.hotplug = False
-        self.LogInfo("Continuing execution..")
+        if self.op.hotplug:
+          result.Raise("Hotplug is not possible: %s" % result.fail_msg,
+                       prereq=True)
+        else:
+          self.LogWarning(result.fail_msg)
+          self.op.hotplug = False
+          self.LogInfo("Modification will take place without hotplugging.")
+      else:
+        self.op.hotplug = True
 
     # Check disk modifications. This is done here and not in CheckArguments
     # (as with NICs), because we need to know the instance's disk template