Statistics
| Branch: | Revision:

root / tools / make-dump.in @ 3822d893

History | View | Annotate | Download (1.1 kB)

1 2b851a1c Lance Albertson
#!/bin/bash
2 2b851a1c Lance Albertson
set -e
3 2b851a1c Lance Albertson
INSTANCE_NAME="$1"
4 2b851a1c Lance Albertson
5 2b851a1c Lance Albertson
if [ -z "$INSTANCE_NAME" ] ; then
6 2b851a1c Lance Albertson
    echo "Must provide a node name!"
7 2b851a1c Lance Albertson
    exit 1
8 2b851a1c Lance Albertson
fi
9 2b851a1c Lance Albertson
10 2b851a1c Lance Albertson
info=($(gnt-instance list -o os,hypervisor,disk.count --no-headers --separator=' ' $INSTANCE_NAME))
11 2b851a1c Lance Albertson
OS_VARIANT="${info[0]/*+/}"
12 2b851a1c Lance Albertson
HYPERVISOR="${info[1]}"
13 2b851a1c Lance Albertson
DISK_COUNT="${info[2]}"
14 2b851a1c Lance Albertson
OS_API_VERSION="15"
15 2b851a1c Lance Albertson
16 2b851a1c Lance Albertson
# do stuff
17 2b851a1c Lance Albertson
output="$(gnt-instance activate-disks $INSTANCE_NAME)"
18 2b851a1c Lance Albertson
CLEANUP+=("gnt-instance deactivate-disks $INSTANCE_NAME")
19 2b851a1c Lance Albertson
20 2b851a1c Lance Albertson
DISK_0_PATH="${output/*disk\/0\:/}"
21 2b851a1c Lance Albertson
22 3822d893 Nikos Skalkotos
. @osdir@/@osname@/common.sh
23 2b851a1c Lance Albertson
24 2b851a1c Lance Albertson
if [ -n "$2" ] ; then
25 2b851a1c Lance Albertson
    IMAGE_DIR=$2
26 2b851a1c Lance Albertson
fi
27 2b851a1c Lance Albertson
28 2b851a1c Lance Albertson
filesystem_dev=$(map_disk0 $blockdev)
29 7ff088a6 Lance Albertson
CLEANUP+=("unmap_disk0 $blockdev")
30 2b851a1c Lance Albertson
root_dev=$(map_partition $filesystem_dev root)
31 2b851a1c Lance Albertson
boot_dev=$(map_partition $filesystem_dev boot)
32 2b851a1c Lance Albertson
33 2b851a1c Lance Albertson
if [ -n "$boot_dev" ] ; then
34 2b851a1c Lance Albertson
    echo "Creating dump from $INSTANCE_NAME for boot at ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-boot.dump"
35 2b851a1c Lance Albertson
    dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-boot.dump $boot_dev
36 2b851a1c Lance Albertson
fi
37 2b851a1c Lance Albertson
38 2b851a1c Lance Albertson
echo "Creating dump from $INSTANCE_NAME for root at ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-root.dump"
39 2b851a1c Lance Albertson
dump -0 -q -z9 -f ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}-root.dump $root_dev