This website requires JavaScript.
2f48d2ab1cccfc68516e89f58cf5033032da70f5
nova /tools /nova-debug
93 lines
2.3 KiB
Plaintext
2010年10月25日 13:51:09 -07:00
#!/usr/bin/env bash
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
INSTANCES_PATH=${INSTANCES_PATH:-/var/lib/nova/instances}
if [ -z "1ドル" ]; then echo "specify an instance id to debug"; exit; fi
if [ -n "3ドル" ]; then DEVICE=3ドル; fi
if [ -n "2ドル" ]; then CMD=2ドル; fi
if [ $CMD != "umount" ] && [ $CMD != "launch" ]; then
DEVICE=`losetup --show -f disk`
mount /dev/mapper/${DEVICE:4}p1 t
if [ $CMD != "mount" ] && [ $CMD != "umount" ]; then
# make serial console listen on ttyS0
cat >t/etc/init/ttyS0.conf <<TTY_EOF
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
exec /sbin/getty -L 115200 ttyS0 xterm
# set debug root password
# TODO(vish): automate this with expect
tr -d '\n' < libvirt.xml > debug.xml
sed -i "s/<serial type=\"file\">.*<\/serial>/<serial type=\"pty\"><source path=\"\/dev\/pts\/1\"\/><target port=\"0\"\/><\/serial>/g" debug.xml
mount /dev/mapper/${DEVICE:4}p1 t
# clear debug root password
# remove the serial console conf
rm -f t/etc/init/ttyS0.conf
if [ $CMD != "mount" ] && [ $CMD != "launch" ]; then