root / tools / umount-disks @ 0507e825
History | View | Annotate | Download (816 Bytes)
1 |
#!/bin/bash |
---|---|
2 |
set -e |
3 |
|
4 |
INSTANCE_NAME="$1" |
5 |
|
6 |
if [ -z "$INSTANCE_NAME" ] ; then |
7 |
echo "Must provide a node name!" |
8 |
exit 1 |
9 |
fi |
10 |
|
11 |
info=($(gnt-instance list -o os,hypervisor,disk.count --no-headers --separator=' ' $INSTANCE_NAME)) |
12 |
OS_VARIANT="${info[0]/*+/}" |
13 |
HYPERVISOR="${info[1]}" |
14 |
DISK_COUNT="${info[2]}" |
15 |
OS_API_VERSION="15" |
16 |
|
17 |
# do stuff |
18 |
output="$(gnt-instance activate-disks $INSTANCE_NAME)" |
19 |
|
20 |
DISK_0_PATH="${output/*disk\/0\:/}" |
21 |
filesystem_dev="${DISK_0_PATH/\/dev\//}" |
22 |
|
23 |
. /usr/share/ganeti/os/image/common.sh |
24 |
|
25 |
target="/tmp/${INSTANCE_NAME}_root" |
26 |
|
27 |
root_dev=$(map_partition $filesystem_dev root) |
28 |
boot_dev=$(map_partition $filesystem_dev boot) |
29 |
|
30 |
if [ -n "${boot_dev}" ] ; then |
31 |
umount $target/boot |
32 |
fi |
33 |
|
34 |
umount $target |
35 |
rmdir $target |
36 |
$KPARTX -d -p- $DISK_0_PATH |
37 |
gnt-instance deactivate-disks $INSTANCE_NAME |
38 |
|
39 |
CLEANUP=( ) |