[openstack-dev] [devstack] Restart openstack service

Guo, Ruijing ruijing.guo at intel.com
Fri Aug 14 04:01:20 UTC 2015


Yes. I like this idea to restart all services including nova, neutron, cinder, etc:)

-----Original Message-----
From: Tony Breeds [mailto:tony at bakeyournoodle.com] 
Sent: Friday, August 14, 2015 11:50 AM
To: OpenStack Development Mailing List (not for usage questions)
Subject: Re: [openstack-dev] [devstack] Restart openstack service

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.


More information about the OpenStack-dev mailing list