diff --git a/openstack-slothd.py b/openstack-slothd.py index bfdf6584fec729772bb200306dc9296d2250e4e1..006a3a18a6d2bceb9883b2f58a173c90c9f62e86 100755 --- a/openstack-slothd.py +++ b/openstack-slothd.py @@ -271,8 +271,6 @@ def fetchall(client): # Ok, collect all the statistics, grouped by VM, for the period. We # have to specify this duration # - #qm = QueryManager() - q = client.query_samples.query(limit=1) for period in PERIODS: periods[period] = {} vm_dict = dict() #count=vm_0,list=[]) @@ -292,7 +290,7 @@ def fetchall(client): for meter in DMETERS: mdict = {} statistics = client.statistics.list(meter,#period=period, - groupby='resource_id', + groupby=['resource_id'], q=q) LOG.debug("Statistics for %s during period %d (len %d): %s" % (meter,period,len(statistics),pp.pformat(statistics))) @@ -357,7 +355,7 @@ def fetchall(client): pass mdict = {} statistics = client.statistics.list(meter,#period=period, - groupby='resource_id', + groupby=['resource_id'], q=q) LOG.debug("Statistics for %s during period %d (len %d): %s" % (meter,period,len(statistics),pp.pformat(statistics))) diff --git a/setup-controller.sh b/setup-controller.sh index 32d25712b3181fdfd0253626697e10f15e500d7c..0208c4a230aa63722364160de3c4ff1cb6a6acce 100755 --- a/setup-controller.sh +++ b/setup-controller.sh @@ -2721,12 +2721,11 @@ fi # # Install and startup the slothd-for-openstack idleness detector # +cp -p $DIRNAME/openstack-slothd.py $OURDIR/ if [ $OSVERSION -ge $OSKILO ]; then - cp -p $DIRNAME/openstack-slothd.py $OURDIR/ - cat </etc/systemd/system/openstack-slothd.service [Unit] -Description=OpenStack Slothd +Description=Cloudlab OpenStack Resource Usage Collector After=network.target network-online.target local-fs.target Wants=network.target Before=rabbitmq-server.service @@ -2745,6 +2744,33 @@ EOF systemctl enable openstack-slothd.service systemctl restart openstack-slothd.service +else + cat </etc/init/openstack-slothd.conf +# openstack-slothd - Cloudlab OpenStack Resource Usage Collector +# +# openstack-slothd collects OpenStack resource usage statistics + +description "Cloudlab OpenStack slothd" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit 10 5 +umask 022 + +expect stop + +console none + +pre-start script + test -x /root/setup/openstack-slothd.py || { stop; exit 0; } +end script + +exec /root/setup/openstack-slothd.py & +EOF + service openstack-slothd enable + service openstack-slothd start fi RANDPASSSTRING=""