Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 296098f..29cecfd 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -633,7 +633,7 @@
# nodes no longer direclty connected to deployments
#suit_form_tabs =(('sites','Deployment Details'),('nodes','Nodes'),('deploymentprivileges','Privileges'),('tags','Tags'),('imagedeployments','Images'))
- suit_form_tabs =(('sites','Deployment Details'),('deploymentprivileges','Privileges'),('tags','Tags'),('imagedeployments','Images'))
+ suit_form_tabs =(('sites','Deployment Details'),('deploymentprivileges','Privileges'),,('imagedeployments','Images'))
def get_form(self, request, obj=None, **kwargs):
if request.user.isReadOnlyUser():
@@ -788,7 +788,6 @@
('deployments','Deployments'),
('slices','Slices'),
#('nodes','Nodes'),
- ('tags','Tags'),
]
request=getattr(_thread_locals, "request", None)
@@ -922,7 +921,6 @@
('slicenetworks','Networks'),
('sliceprivileges','Privileges'),
('slivers','Slivers'),
- ('tags','Tags'),
('reservations','Reservations'),
]
@@ -1065,7 +1063,7 @@
user_readonly_fields = ['name','site_deployment']
user_readonly_inlines = [TagInline,SliverInline]
- suit_form_tabs =(('details','Node Details'),('slivers','Slivers'),('tags','Tags'))
+ suit_form_tabs =(('details','Node Details'),('slivers','Slivers'))
class SliverForm(forms.ModelForm):
@@ -1097,9 +1095,7 @@
list_display = ['backend_status_icon', 'ip', 'instance_name', 'slice', 'flavor', 'image', 'node', 'deployment']
list_display_links = ('backend_status_icon', 'ip',)
- suit_form_tabs =(('general', 'Sliver Details'),
- ('tags','Tags'),
- )
+ suit_form_tabs =(('general', 'Sliver Details'))
inlines = [TagInline]
diff --git a/planetstack/core/views/stats.py b/planetstack/core/views/stats.py
index 421fbfe..58f33e5 100644
--- a/planetstack/core/views/stats.py
+++ b/planetstack/core/views/stats.py
@@ -1,5 +1,6 @@
from django.http import HttpResponse
from monitor import driver
+from core.models import *
import json
def Stats(request):
@@ -8,5 +9,11 @@
meter = request.GET['meter']
controller_name = request.GET['controller_name']
- meters = driver.get_meter(meter, model, pk)
+ controller = Controller.objects.filter(name=controller_name)[0]
+ keystone = {'username':controller.admin_user, 'password':controller.admin_password, 'tenant_name':controller.admin_tenant, 'auth_url':controller.auth_url, 'cacert':'/etc/ssl/certs/ca-certificates.crt'}
+
+ for k,v in keystone.items():
+ keystone['os_'+k] = v
+
+ meters = driver.get_meter(meter, model, pk, keystone)
return HttpResponse(json.dumps(meters))
diff --git a/planetstack/openstack_observer/ceilometer.py b/planetstack/openstack_observer/ceilometer.py
index 00c1238..e34b000 100644
--- a/planetstack/openstack_observer/ceilometer.py
+++ b/planetstack/openstack_observer/ceilometer.py
@@ -13,9 +13,9 @@
def object_to_filter(model_name, pk):
from core.models import *
filter_dict = {
- 'Slice':[Slice, 'tenant_id', 'project_id'],
+ 'ControllerSlice':[ControllerSlice, 'tenant_id', 'project_id'],
'Sliver':[Sliver, 'instance_id', 'resource_id'],
- 'Site':[Site, 'tenant_id', 'project_id']
+ 'ControllerSite':[ControllerSite, 'tenant_id', 'project_id']
}
mod,field,tag = filter_dict[model_name]
@@ -86,20 +86,21 @@
class CeilometerDriver(MonitorDriver):
def get_meter(self, meter, obj, pk, keystone=None):
- keystone = {}
- keystone['os_username']=env['OS_USERNAME']
- keystone['os_password']=env['OS_PASSWORD']
- keystone['os_auth_url']=env['OS_AUTH_URL']
- keystone['os_tenant_name']=env['OS_TENANT_NAME']
- keystone['os_cacert']=env['OS_CACERT']
- keystone['os_region_name']=env['OS_REGION_NAME']
+ if (not keystone):
+ keystone={}
+ keystone['os_username']=env['OS_USERNAME']
+ keystone['os_password']=env['OS_PASSWORD']
+ keystone['os_auth_url']=env['OS_AUTH_URL']
+ keystone['os_tenant_name']=env['OS_TENANT_NAME']
+ keystone['os_cacert']=env['OS_CACERT']
+ keystone['os_region_name']=env['OS_REGION_NAME']
- keystone['username']=env['OS_USERNAME']
- keystone['password']=env['OS_PASSWORD']
- keystone['auth_url']=env['OS_AUTH_URL']
- keystone['tenant_name']=env['OS_TENANT_NAME']
- keystone['cacert']=env['OS_CACERT']
- keystone['region_name']=env['OS_REGION_NAME']
+ keystone['username']=env['OS_USERNAME']
+ keystone['password']=env['OS_PASSWORD']
+ keystone['auth_url']=env['OS_AUTH_URL']
+ keystone['tenant_name']=env['OS_TENANT_NAME']
+ keystone['cacert']=env['OS_CACERT']
+ keystone['region_name']=env['OS_REGION_NAME']
keystone['auth_plugin']=client.AuthPlugin(**keystone)