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