From 49dfcf4885f37606af48453edb8abbc76dc80315 Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Mon, 20 Jan 2014 12:13:15 +0100
Subject: [PATCH] first remove lvm, then mdadm

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 cdist/conf/type/__install_reset_disk/gencode-remote | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/cdist/conf/type/__install_reset_disk/gencode-remote b/cdist/conf/type/__install_reset_disk/gencode-remote
index 42ed00c6..a16ded5a 100755
--- a/cdist/conf/type/__install_reset_disk/gencode-remote
+++ b/cdist/conf/type/__install_reset_disk/gencode-remote
@@ -31,6 +31,12 @@ if find /sys/class/block/$disk_name*/holders/ -mindepth 1 | grep -q holders/dm;
    fi
 fi
 
+if command -v pvremove >/dev/null; then
+   pvremove --force --force --yes "$disk" || true
+else
+   echo "WARNING: pvremove command not found" >&2
+fi
+
 # stop mdadm raids if any
 if [ -r /proc/mdstat ]; then
    md_name="\$(awk '/$disk_name/ {print \$1}' /proc/mdstat)"
@@ -43,12 +49,6 @@ if [ -r /proc/mdstat ]; then
       fi
    fi
 fi
-
-if command -v pvremove >/dev/null; then
-   pvremove --force --force --yes "$disk" || true
-else
-   echo "WARNING: pvremove command not found" >&2
-fi
 if command -v mdadm >/dev/null; then
    mdadm --zero-superblock --force "$disk" || true
 else