[openstack-dev] [devstack] Restart openstack service

Tony Breeds tony at bakeyournoodle.com
Fri Aug 14 03:50:24 UTC 2015


On Fri, Aug 14, 2015 at 11:31:07AM +0800, Rui Chen wrote:
> I use *screen* in devstack, Ctrl+c kill services, then restart it in
> console.
> 
> Please try the following cmd in your devstack environment, and read some
> docs.
> 
> *screen -r stack*
> 
> http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

It's not baked into devstack but I have a script called 'stack-smash.sh' which I run like

HOST=devstack.domain ./stack-smash.sh nova

to restart all the nova services in a running devstack.

---
#!/opt/local/bin/bash

if [ -z "$1" ] ; then
    set -- nova
fi

if [ -z $HOST ] ; then
    echo "HOST= $0 $@" >&2
    exit 1
fi

for service in "$@" ; do
    pattern=''

    case "$service" in
    nova)       pattern=^n-         ;;
    glance)     pattern=^g-         ;;
    cinder)     pattern=^c-         ;;
    keystone)   pattern=^key        ;;
    *)          pattern=$service    ;;
    esac

    for win in  key key-access g-reg g-api n-api n-cond n-crt n-net \
                n-sch n-novnc n-cauth n-sproxy n-cpu c-api c-sch c-vol ; do

        [ -z "$pattern" ] && continue

        if [[ $win =~ $pattern ]] ; then
            echo -n "Killing window=$win for service=$service"
            ssh $HOST -qt screen -S stack -p $win -X stuff '' # this is a literal control-C
            sleep 1s
            ssh $HOST -qt screen -S stack -p $win -X stuff '!!\\n'
            sleep 1s
            echo " ... done."

        fi
    done
done
---

Yours Tony.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150814/5d281fed/attachment-0001.pgp>


More information about the OpenStack-dev mailing list