From 4300c4b6104a883b0a3f4bc86c13ee3819880934 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Mon, 1 Sep 2008 11:37:06 +0000
Subject: [PATCH] Pass the force param to SetInstanceParms

It was already allowed in gnt-instance modify, but ignored.
It will be used to force skipping parameter checks.

This is a forward-port from branches/ganeti-1.2

Original-Reviewed-by: imsnah
Reviewed-by: iustinp
---
 lib/cmdlib.py        | 1 +
 lib/opcodes.py       | 2 +-
 scripts/gnt-instance | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 3fca09fbe..bf8718547 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4220,6 +4220,7 @@ class LUSetInstanceParams(LogicalUnit):
     self.hvm_disk_type = getattr(self.op, "hvm_disk_type", None)
     self.hvm_cdrom_image_path = getattr(self.op, "hvm_cdrom_image_path", None)
     self.vnc_bind_address = getattr(self.op, "vnc_bind_address", None)
+    self.force = getattr(self.op, "force", None)
     all_parms = [self.mem, self.vcpus, self.ip, self.bridge, self.mac,
                  self.kernel_path, self.initrd_path, self.hvm_boot_order,
                  self.hvm_acpi, self.hvm_pae, self.hvm_cdrom_image_path,
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 3137b8e4b..2984185a8 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -400,7 +400,7 @@ class OpSetInstanceParams(OpCode):
     "instance_name", "mem", "vcpus", "ip", "bridge", "mac",
     "kernel_path", "initrd_path", "hvm_boot_order", "hvm_acpi",
     "hvm_pae", "hvm_cdrom_image_path", "vnc_bind_address",
-    "hvm_nic_type", "hvm_disk_type"
+    "hvm_nic_type", "hvm_disk_type", "force"
     ]
 
 
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 1f0dcb10c..418f8cc61 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -764,7 +764,8 @@ def SetInstanceParams(opts, args):
                                    opts.hvm_cdrom_image_path,
                                    vnc_bind_address=opts.vnc_bind_address,
                                    hvm_nic_type=hvm_nic_type,
-                                   hvm_disk_type=hvm_disk_type)
+                                   hvm_disk_type=hvm_disk_type,
+                                   force=opts.force)
 
   result = SubmitOpCode(op)
 
-- 
GitLab