Commit 59bfb95c authored by David Johnson's avatar David Johnson

Make openstack-slothd work for Kilo.

parent 6d8d114e
...@@ -151,7 +151,16 @@ def get_hypervisor_hostname(client,resource): ...@@ -151,7 +151,16 @@ def get_hypervisor_hostname(client,resource):
pass pass
pass pass
#LOG.debug("resource: " + pp.pformat(resource)) #LOG.debug("resource: " + pp.pformat(resource))
hh = None
try:
hh = resource.metadata['host'] hh = resource.metadata['host']
except:
if 'instance_id' in resource.metadata:
LOG.info("no hostname info for resource %s; trying instance_id" % (str(resource),))
return get_hypervisor_hostname(client,get_resource(client,resource.metadata['instance_id']))
else:
LOG.exception("no 'host' field in metadata for resource %s" % (str(resource,)))
pass
if not hh in r_hostnames.keys(): if not hh in r_hostnames.keys():
LOG.error("hostname hash %s doesn't map to a known hypervisor hostname!" % (hh,)) LOG.error("hostname hash %s doesn't map to a known hypervisor hostname!" % (hh,))
return None return None
...@@ -236,7 +245,8 @@ def fetchall(client): ...@@ -236,7 +245,8 @@ def fetchall(client):
if not hostname in vm_dict: if not hostname in vm_dict:
vm_dict[hostname] = {} vm_dict[hostname] = {}
pass pass
if not vmrid in vm_dict[hostname]: if not vmrid in vm_dict[hostname] and 'display_name' in resource.metadata \
and 'image.name' in resource.metadata and 'status' in resource.metadata:
vm_dict[hostname][vmrid] = dict(name=resource.metadata['display_name'], vm_dict[hostname][vmrid] = dict(name=resource.metadata['display_name'],
image=resource.metadata['image.name'], image=resource.metadata['image.name'],
status=resource.metadata['status']) status=resource.metadata['status'])
......
...@@ -2721,7 +2721,7 @@ fi ...@@ -2721,7 +2721,7 @@ fi
# #
# Install and startup the slothd-for-openstack idleness detector # Install and startup the slothd-for-openstack idleness detector
# #
if [ $OSVERSION -ge $OSLIBERTY ]; then if [ $OSVERSION -ge $OSKILO ]; then
cp -p $DIRNAME/openstack-slothd.py $OURDIR/ cp -p $DIRNAME/openstack-slothd.py $OURDIR/
cat <<EOF >/etc/systemd/system/openstack-slothd.service cat <<EOF >/etc/systemd/system/openstack-slothd.service
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment