From b6023d6c3b9700b145c6b88dd9a207a52697472f Mon Sep 17 00:00:00 2001
From: Manuel Franceschini <manuel.franceschini@gmail.com>
Date: Mon, 28 Apr 2008 15:24:50 +0000
Subject: [PATCH] Raise PrereqError when exporting file-based instance

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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 27ac7df76..033080da3 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -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.
 
-- 
GitLab