diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 40e0a29bd5d154c5ecd4f6ea354bca110a1085ad..7b4e9ae579f49bc2d855879551082cf97a7c945d 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -7744,9 +7744,13 @@ class LUSetInstanceParams(LogicalUnit):
       self.op.disk_template = None
     if not hasattr(self.op, "remote_node"):
       self.op.remote_node = None
+    if not hasattr(self.op, "os_name"):
+      self.op.os_name = None
+    if not hasattr(self.op, "force_variant"):
+      self.op.force_variant = False
     self.op.force = getattr(self.op, "force", False)
     if not (self.op.nics or self.op.disks or self.op.disk_template or
-            self.op.hvparams or self.op.beparams):
+            self.op.hvparams or self.op.beparams or self.op.os_name):
       raise errors.OpPrereqError("No changes submitted", errors.ECODE_INVAL)
 
     if self.op.hvparams:
@@ -8174,6 +8178,11 @@ class LUSetInstanceParams(LogicalUnit):
                                      (disk_op, len(instance.disks)),
                                      errors.ECODE_INVAL)
 
+    # OS change
+    if self.op.os_name and not self.op.force:
+      _CheckNodeHasOS(self, instance.primary_node, self.op.os_name,
+                      self.op.force_variant)
+
     return
 
   def _ConvertPlainToDrbd(self, feedback_fn):
@@ -8384,6 +8393,10 @@ class LUSetInstanceParams(LogicalUnit):
       for key, val in self.op.beparams.iteritems():
         result.append(("be/%s" % key, val))
 
+    # OS change
+    if self.op.os_name:
+      instance.os = self.op.os_name
+
     self.cfg.Update(instance, feedback_fn)
 
     return result
diff --git a/lib/opcodes.py b/lib/opcodes.py
index d7d3c55030219be46867f85b6c5c5516b1c683b7..f979ad0f3bfa1acfab68472c24a8bcc215e55af0 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -621,7 +621,7 @@ class OpSetInstanceParams(OpCode):
     "instance_name",
     "hvparams", "beparams", "force",
     "nics", "disks", "disk_template",
-    "remote_node",
+    "remote_node", "os_name", "force_variant",
     ]
 
 
diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml
index b8ed14b3a03d1c145f43c2c1faca65842168f501..0e5380271588168cdb43e0c272985964a5d1f2de 100644
--- a/man/gnt-instance.sgml
+++ b/man/gnt-instance.sgml
@@ -1403,6 +1403,8 @@ instance5: 11225
               <arg>drbd</arg>
             </group></arg>
 
+          <sbr>
+            <arg>--os-name=<replaceable>OS</replaceable> <arg>--force-variant</arg></arg>
 
           <sbr>
           <arg>--submit</arg>
@@ -1453,6 +1455,16 @@ instance5: 11225
           option will change the parameters of the Nth instance NIC.
         </para>
 
+        <para>
+          The option <option>--os-name</option> will change the OS
+          name for the instance (without reinstallation). In case an
+          OS variant is specified that is not found, then by default
+          the modification is refused,
+          unless <option>--force-variant</option> is passed. An
+          invalid OS will also be refused, unless
+          the <option>--force</option> option is given.
+        </para>
+
         <para>
           The <option>--submit</option> option is used to send the job to
           the master daemon but not wait for its completion. The job
diff --git a/scripts/gnt-instance b/scripts/gnt-instance
index 45444f11afa76dcc6ac30e018c088f229e3341a4..fb17f7c04e4571a91440c445f9560bf9746c38aa 100755
--- a/scripts/gnt-instance
+++ b/scripts/gnt-instance
@@ -1208,7 +1208,7 @@ def SetInstanceParams(opts, args):
 
   """
   if not (opts.nics or opts.disks or opts.disk_template or
-          opts.hvparams or opts.beparams):
+          opts.hvparams or opts.beparams or opts.os):
     ToStderr("Please give at least one of the parameters.")
     return 1
 
@@ -1261,6 +1261,8 @@ def SetInstanceParams(opts, args):
                                    remote_node=opts.node,
                                    hvparams=opts.hvparams,
                                    beparams=opts.beparams,
+                                   os_name=opts.os,
+                                   force_variant=opts.force_variant,
                                    force=opts.force)
 
   # even if here we process the result, we allow submit only
@@ -1417,7 +1419,7 @@ commands = {
   'modify': (
     SetInstanceParams, ARGS_ONE_INSTANCE,
     [BACKEND_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT, NET_OPT, SUBMIT_OPT,
-     DISK_TEMPLATE_OPT, SINGLE_NODE_OPT],
+     DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT],
     "<instance>", "Alters the parameters of an instance"),
   'shutdown': (
     GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],