summaryrefslogtreecommitdiffstats
path: root/tools/nova-debug
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-06-27 09:05:05 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2011-06-27 09:05:05 -0700
commit7230c384d1373e8718bc7fd2fd86b1e805a0573e (patch)
tree4a609676ab45ed3e1c67d718085addf2fb279918 /tools/nova-debug
parent6d1ce4a46a9684ac718bfc19dc8a362fbc9a9641 (diff)
downloadnova-7230c384d1373e8718bc7fd2fd86b1e805a0573e.tar.gz
nova-7230c384d1373e8718bc7fd2fd86b1e805a0573e.tar.xz
nova-7230c384d1373e8718bc7fd2fd86b1e805a0573e.zip
make nova-debug work with new style instances
Diffstat (limited to 'tools/nova-debug')
-rwxr-xr-xtools/nova-debug22
1 files changed, 13 insertions, 9 deletions
diff --git a/tools/nova-debug b/tools/nova-debug
index 3ff68ca35..fd9cb054a 100755
--- a/tools/nova-debug
+++ b/tools/nova-debug
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
@@ -30,13 +29,15 @@ cd $INSTANCES_PATH/$1
if [ $CMD != "umount" ] && [ $CMD != "launch" ]; then
# destroy the instance
virsh destroy $1
+virsh undefine $1
# mount the filesystem
mkdir t
-DEVICE=`losetup --show -f disk`
+DEVICE=/dev/nbd0
echo $DEVICE
-kpartx -a $DEVICE
-mount /dev/mapper/${DEVICE:4}p1 t
+qemu-nbd -c $DEVICE disk
+sleep 3
+mount $DEVICE t
fi
if [ $CMD != "mount" ] && [ $CMD != "umount" ]; then
@@ -66,11 +67,13 @@ sed -i "s/<serial type=\"file\">.*<\/serial>/<serial type=\"pty\"><source path=\
umount t
-virsh create debug.xml
+virsh define debug.xml
+virsh start $1
virsh console $1
virsh destroy $1
+virsh undefine $1
-mount /dev/mapper/${DEVICE:4}p1 t
+mount $DEVICE t
# clear debug root password
chroot t passwd -l root
@@ -83,10 +86,11 @@ if [ $CMD != "mount" ] && [ $CMD != "launch" ]; then
# unmount the filesystem
umount t
-kpartx -d $DEVICE
-losetup -d $DEVICE
+qemu-nbd -d $DEVICE
rmdir t
# recreate the instance
-virsh create libvirt.xml
+virsh define libvirt.xml
+virsh start $1
fi
+