fix up admin instance list
This commit is contained in:
@@ -160,7 +160,22 @@ def index(request):
|
||||
if handled:
|
||||
return handled
|
||||
|
||||
instances = api.extras_api(request).servers.list()
|
||||
try:
|
||||
instances = api.extras_api(request).servers.list()
|
||||
def get_image_cache():
|
||||
images = api.glance_api(request).get_images_detailed()
|
||||
image_dict = {}
|
||||
for image in images:
|
||||
image_dict[image['id']] = image
|
||||
return image_dict
|
||||
|
||||
image_dict = get_image_cache()
|
||||
for instance in instances:
|
||||
# FIXME - ported this over, but it is hacky
|
||||
instance._info['attrs']['image_name'] =\
|
||||
image_dict.get(int(instance.attrs['image_id']),{}).get('name')
|
||||
except:
|
||||
messages.error(request, 'Unable to get instance list: %s' % e.message)
|
||||
|
||||
# We don't have any way of showing errors for these, so don't bother
|
||||
# trying to reuse the forms from above
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{% load parse_date %}
|
||||
<table class="wide">
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>User</th>
|
||||
<th>Node</th>
|
||||
<th>Hostname</th>
|
||||
<th>Created</th>
|
||||
<th>Image</th>
|
||||
<th>IP</th>
|
||||
<th>Public IP</th>
|
||||
<th>IP</th>
|
||||
<th>State</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
@@ -15,10 +16,12 @@
|
||||
<td>{{instance.id}}</td>
|
||||
<td>{{instance.attrs.user_id}}</td>
|
||||
<td>{{instance.attrs.hostname}}</td>
|
||||
<td>{{instance.attrs.created_at}}</td>
|
||||
<td title="bucket/image.manifest.xml">{{instance.imageId}}</td>
|
||||
<td>{{instance.public_ip}}</td>
|
||||
<td>{{instance.private_ip}}</td>
|
||||
<td>{{instance.attrs.launched_at|parse_date}}</td>
|
||||
<td>{{instance.attrs.image_name}}</td>
|
||||
|
||||
<td>{{instance.addresses.public.0.addr|default:'N/A'}}</td>
|
||||
<td>{{instance.addresses.private.0.addr|default:'networking'}}</td>
|
||||
|
||||
<td>{{instance.status}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user