Revision 0507e825

b/tools/mount-disks
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=( )
b/tools/umount-disks
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=( )

Also available in: Unified diff