Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module

This commit is contained in:
Brian Behlendorf 2009-10-27 15:02:46 -07:00
commit 33618ea044
3 changed files with 47 additions and 30 deletions

View File

@ -15,10 +15,21 @@ LVCREATE=${LVCREATE:-/sbin/lvcreate}
LVREMOVE=${LVREMOVE:-/sbin/lvremove}
LVNAME=${LVNAME:-"lv_tank"}
LVSTRIPES=${LVSTRIPES:-4}
LVSIZE=${LVSIZE:-4G}
LVSIZE=${LVSIZE:-32G}
DEVICES="/dev/${VGNAME}/${LVNAME}"
zpool_dm_destroy() {
msg ${LVREMOVE} -f ${VGNAME}/${LVNAME}
${LVREMOVE} -f ${VGNAME}/${LVNAME} >/dev/null
msg ${VGREMOVE} -f ${VGNAME}
${VGREMOVE} -f ${VGNAME} >/dev/null
msg ${PVREMOVE} ${PVDEVICES}
${PVREMOVE} ${PVDEVICES} >/dev/null
}
zpool_create() {
# Remove EFI labels which cause pvcreate failure
for DEVICE in ${PVDEVICES}; do
@ -26,30 +37,24 @@ zpool_create() {
done
msg ${PVCREATE} -f ${PVDEVICES}
${PVCREATE} -f ${PVDEVICES} || exit 1
${PVCREATE} -f ${PVDEVICES} >/dev/null || exit 1
msg ${VGCREATE} ${VGNAME} ${PVDEVICES}
${VGCREATE} ${VGNAME} ${PVDEVICES} || exit 2
${VGCREATE} ${VGNAME} ${PVDEVICES} >/dev/null || exit 2
msg ${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \
--name=${LVNAME} ${VGNAME}
${LVCREATE} --size=${LVSIZE} --stripes=${LVSTRIPES} \
--name=${LVNAME} ${VGNAME} || exit 3
--name=${LVNAME} ${VGNAME} >/dev/null || exit 3
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 4
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \
${DEVICES} || (zpool_dm_destroy && exit 4)
}
zpool_destroy() {
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
${ZPOOL} destroy ${ZPOOL_NAME}
msg ${LVREMOVE} -f ${VGNAME}/${LVNAME}
${LVREMOVE} -f ${VGNAME}/${LVNAME} || exit 2
msg ${VGREMOVE} -f ${VGNAME}
${VGREMOVE} -f ${VGNAME} || exit 3
msg ${PVREMOVE} ${PVDEVICES}
${PVREMOVE} ${PVDEVICES} || exit 4
zpool_dm_destroy
}

View File

@ -10,23 +10,29 @@ MDRAID=${MDRAID:-10}
DEVICES="/dev/md0"
zpool_md_destroy() {
msg ${MDADM} --manage --stop ${DEVICES}
${MDADM} --manage --stop ${DEVICES} &>/dev/null
msg ${MDADM} --zero-superblock ${MDDEVICES}
${MDADM} --zero-superblock ${MDDEVICES} >/dev/null
}
zpool_create() {
msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES}
${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES} || exit 1
--raid-devices=${MDCOUNT} ${MDDEVICES} \
&>/dev/null || (zpool_md_destroy && exit 1)
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 2
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \
${DEVICES} || (zpool_md_destroy && exit 2)
}
zpool_destroy() {
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
${ZPOOL} destroy ${ZPOOL_NAME}
msg ${MDADM} --manage --stop ${DEVICES}
${MDADM} --manage --stop ${DEVICES} || exit 2
msg ${MDADM} --zero-superblock ${MDDEVICES}
${MDADM} --zero-superblock ${MDDEVICES} || exit 3
zpool_md_destroy
}

View File

@ -10,23 +10,29 @@ MDRAID=${MDRAID:-5}
DEVICES="/dev/md0"
zpool_md_destroy() {
msg ${MDADM} --manage --stop ${DEVICES}
${MDADM} --manage --stop ${DEVICES} &>/dev/null
msg ${MDADM} --zero-superblock ${MDDEVICES}
${MDADM} --zero-superblock ${MDDEVICES} >/dev/null
}
zpool_create() {
msg ${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES}
${MDADM} --create ${DEVICES} --level=${MDRAID} \
--raid-devices=${MDCOUNT} ${MDDEVICES} || exit 1
--raid-devices=${MDCOUNT} ${MDDEVICES} \
&>/dev/null || (zpool_md_destroy && exit 1)
msg ${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES}
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} ${DEVICES} || exit 2
${ZPOOL} create ${FORCE_FLAG} ${ZPOOL_NAME} \
${DEVICES} || (zpool_md_destroy && exit 2)
}
zpool_destroy() {
msg ${ZPOOL} destroy ${ZPOOL_NAME}
${ZPOOL} destroy ${ZPOOL_NAME} || exit 1
${ZPOOL} destroy ${ZPOOL_NAME}
msg ${MDADM} --manage --stop ${DEVICES}
${MDADM} --manage --stop ${DEVICES} || exit 2
msg ${MDADM} --zero-superblock ${MDDEVICES}
${MDADM} --zero-superblock ${MDDEVICES} || exit 3
zpool_md_destroy
}