merge r1538 from branches/ganeti/ganeti-1.2
authorAlexander Schreiber <als@google.com>
Mon, 1 Sep 2008 14:12:54 +0000 (14:12 +0000)
committerAlexander Schreiber <als@google.com>
Mon, 1 Sep 2008 14:12:54 +0000 (14:12 +0000)
Check HVM device type on instance modify as well.

Reviewed-by: imsnah

lib/cmdlib.py

index 02de1be..f46fb2a 100644 (file)
@@ -4340,6 +4340,17 @@ class LUSetInstanceParams(LogicalUnit):
           self.warn.append("Not enough memory to failover instance to secondary"
                            " node %s" % node)
 
+    # Xen HVM device type checks
+    if self.sstore.GetHypervisorType() == constants.HT_XEN_HVM31:
+      if self.op.hvm_nic_type is not None:
+        if self.op.hvm_nic_type not in constants.HT_HVM_VALID_NIC_TYPES:
+          raise errors.OpPrereqError("Invalid NIC type %s specified for Xen"
+                                     " HVM  hypervisor" % self.op.hvm_nic_type)
+      if self.op.hvm_disk_type is not None:
+        if self.op.hvm_disk_type not in constants.HT_HVM_VALID_DISK_TYPES:
+          raise errors.OpPrereqError("Invalid disk type %s specified for Xen"
+                                     " HVM hypervisor" % self.op.hvm_disk_type)
+
     return
 
   def Exec(self, feedback_fn):