Raise PrereqError when exporting file-based instance
authorManuel Franceschini <manuel.franceschini@gmail.com>
Mon, 28 Apr 2008 15:24:50 +0000 (15:24 +0000)
committerManuel Franceschini <manuel.franceschini@gmail.com>
Mon, 28 Apr 2008 15:24:50 +0000 (15:24 +0000)
This patch adds a check to LUExportInstance.CheckPrereq to raise an
error when an instance with file disks is exported.

Reviewed-by: ultrotter

lib/cmdlib.py

index 27ac7df..033080d 100644 (file)
@@ -4490,6 +4490,12 @@ class LUExportInstance(LogicalUnit):
                                  self.op.target_node)
     self.op.target_node = self.dst_node.name
 
+    # instance disk type verification
+    for disk in self.instance.disks:
+      if disk.dev_type == constants.LD_FILE:
+        raise errors.OpPrereqError("Export not supported for instances with"
+                                   " file-based disks")
+
   def Exec(self, feedback_fn):
     """Export an instance to an image in the cluster.