summaryrefslogtreecommitdiffstats
path: root/tools/nova-debug
diff options
context:
space:
mode:
authorBrian Waldon <brian.waldon@rackspace.com>2011-07-13 14:05:38 -0400
committerBrian Waldon <brian.waldon@rackspace.com>2011-07-13 14:05:38 -0400
commitbf7db726c3b26c8e13226cf5c1446befee6a6f2d (patch)
treee1559038d7220dd692ac4c8f6b1103d5d08d55f9 /tools/nova-debug
parent132a47611b2fdbbb1e6c70a33bfd092854ea6e98 (diff)
parentb58e853038e9c322be765600e225568689e5c479 (diff)
downloadnova-bf7db726c3b26c8e13226cf5c1446befee6a6f2d.tar.gz
nova-bf7db726c3b26c8e13226cf5c1446befee6a6f2d.tar.xz
nova-bf7db726c3b26c8e13226cf5c1446befee6a6f2d.zip
merging trunk
Diffstat (limited to 'tools/nova-debug')
-rwxr-xr-xtools/nova-debug21
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/nova-debug b/tools/nova-debug
index 3ff68ca35..0a78af16a 100755
--- a/tools/nova-debug
+++ b/tools/nova-debug
@@ -30,13 +30,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 +68,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 +87,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
+