Statistics
| Branch: | Revision:

root / tools / make-qemu-img.in @ 3822d893

History | View | Annotate | Download (729 Bytes)

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
echo "Creating qemu-img image from $INSTANCE_NAME to ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.img"
29 2b851a1c Lance Albertson
$QEMU_IMG convert -O qcow2 $DISK_0_PATH ${IMAGE_DIR}/${IMAGE_NAME}-${ARCH}.img