Merge branch 'master' of github.com:open-cloud/xos
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..774220d
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,94 @@
+FROM ubuntu:14.04.1
+MAINTAINER Andy Bavier <acb@cs.princeton.edu>
+
+# Install.
+RUN apt-get update
+RUN apt-get install -y git
+RUN apt-get install -y postgresql
+RUN apt-get install -y python-psycopg2
+RUN apt-get install -y graphviz graphviz-dev
+RUN apt-get install -y libxslt1.1 libxslt1-dev
+RUN apt-get install -y python-pip
+RUN apt-get install -y tar
+RUN apt-get install -y gcc
+RUN apt-get install -y python-httplib2
+RUN apt-get install -y geoip-database libgeoip1
+RUN apt-get install -y wget
+RUN apt-get install -y python-dev
+
+RUN pip install django==1.7
+RUN pip install djangorestframework==2.4.4
+RUN pip install markdown # Markdown support for the browseable API.
+RUN pip install pyyaml # YAML content-type support.
+RUN pip install django-filter # Filtering support
+RUN pip install lxml # XML manipulation library
+RUN pip install netaddr # IP Addr library
+RUN pip install pytz
+RUN pip install django-timezones
+RUN pip install requests
+RUN pip install django-crispy-forms
+RUN pip install django-geoposition
+RUN pip install django-extensions
+RUN pip install django-suit
+RUN pip install django-evolution
+RUN pip install django-bitfield
+RUN pip install django-ipware
+RUN pip install django-encrypted-fields
+RUN pip install python-keyczar
+
+RUN apt-get install -y python-keystoneclient
+RUN apt-get install -y python-novaclient
+RUN apt-get install -y python-neutronclient
+RUN apt-get install -y python-glanceclient
+RUN apt-get install -y python-ceilometerclient
+
+RUN pip install django_rest_swagger
+
+RUN apt-get install -y python-setuptools
+RUN easy_install django_evolution
+RUN easy_install python_gflags
+RUN easy_install google_api_python_client
+
+# Set up latest Ansible
+# Need to add our patches too
+RUN apt-get install -y ansible
+# RUN git clone --recursive git://github.com/ansible/ansible.git /opt/ansible
+ADD ansible-hosts /etc/ansible/hosts
+
+ADD http://code.jquery.com/jquery-1.9.1.min.js /usr/local/lib/python2.7/dist-packages/suit/static/suit/js/
+
+# Get XOS
+ADD planetstack /opt/xos
+
+ADD observer-initscript /etc/init.d/plstackobserver
+
+RUN chmod +x /opt/xos/scripts/opencloud
+RUN /opt/xos/scripts/opencloud genkeys
+
+# Set postgres password to match default value in settings.py
+RUN service postgresql start; sudo -u postgres psql -c "alter user postgres with password 'password';"
+
+# Turn DEBUG on so that devel server will serve static files
+RUN sed -i 's/DEBUG = False/DEBUG = True/' /opt/xos/planetstack/settings.py
+
+# Cruft to workaround problems with migrations, should go away...
+RUN /opt/xos/scripts/opencloud dropdb
+RUN rm -rf /opt/xos/*/migrations
+RUN cd /opt/xos; python ./manage.py makemigrations core
+RUN cd /opt/xos; python ./manage.py makemigrations hpc
+RUN cd /opt/xos; python ./manage.py makemigrations requestrouter
+RUN cd /opt/xos; python ./manage.py makemigrations syndicate_storage
+RUN cd /opt/xos; python ./manage.py makemigrations servcomp
+
+RUN /opt/xos/scripts/opencloud initdb
+
+EXPOSE 8000
+
+# Set environment variables.
+ENV HOME /root
+
+# Define working directory.
+WORKDIR /root
+
+# Define default command.
+CMD ["/bin/bash"]
diff --git a/Makefile b/Makefile
index f6573ca..2b55526 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-NAME = opencloud
+NAME = xos
SPECFILE = $(NAME).spec
VERSION = $(shell rpm -q --specfile $(SPECFILE) --qf '%{VERSION}\n' | head -n 1)
RELEASE = $(shell rpm -q --specfile $(SPECFILE) --qf '%{RELEASE}\n' | head -n 1)
diff --git a/README.Docker b/README.Docker
new file mode 100644
index 0000000..5ce5806
--- /dev/null
+++ b/README.Docker
@@ -0,0 +1,25 @@
+The Dockerfile in this directory will build a Docker image for running
+XOS using the Django development server. It copies whatever files are
+in the local repository into the image. Here's how to do it:
+
+1. Currently planetstack/core/fixtures/initial_data.json is broken!
+ Overwrite this file with a working fixture, e.g., by dumping
+ portal.opencloud.us's database:
+
+ $ sudo /opt/xos/scripts/opencloud dumpdata
+
+2. $ docker build -t xos .
+
+3. $ docker run -t -i -p 8000:8000 xos
+
+4. Now you will have a bash prompt as root inside the XOS container.
+ Start up XOS:
+
+ # /opt/xos/scripts/opencloud runserver
+
+You can access the XOS login at http:<server>:8000, where <server> is
+the name of the server running Docker.
+
+STILL TO DO
+-----------
+* Test Observer
diff --git a/ansible-hosts b/ansible-hosts
new file mode 100644
index 0000000..0dd74f1
--- /dev/null
+++ b/ansible-hosts
@@ -0,0 +1,2 @@
+[localhost]
+127.0.0.1
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index a379302..e03098e 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -636,7 +636,7 @@
suit_form_tabs =(('sites','Deployment Details'),('deploymentprivileges','Privileges'), ('sitedeployments', 'Site Deployments'))
def get_form(self, request, obj=None, **kwargs):
- if request.user.isReadOnlyUser():
+ if request.user.isReadOnlyUser() or not request.user.is_admin:
kwargs["form"] = DeploymentAdminROForm
else:
kwargs["form"] = DeploymentAdminForm
diff --git a/planetstack/core/dashboard/sites.py b/planetstack/core/dashboard/sites.py
index 3284dae..4a2e742 100644
--- a/planetstack/core/dashboard/sites.py
+++ b/planetstack/core/dashboard/sites.py
@@ -12,7 +12,7 @@
def get_urls(self):
"""Add our dashboard view to the admin urlconf. Deleted the default index."""
from django.conf.urls import patterns, url
- from views import DashboardCustomize, DashboardDynamicView, DashboardWelcomeView, SimulatorView, \
+ from views import DashboardCustomize, DashboardDynamicView, SimulatorView, \
DashboardUserSiteView, \
TenantViewData, TenantCreateSlice, TenantAddUser,TenantAddOrRemoveSliverView, TenantPickSitesView, TenantDeleteSliceView, \
TenantUpdateSlice, DashboardSliceInteractions, RequestAccessView
@@ -40,7 +40,7 @@
name="customize"),
url(r'^hpcdashuserslices/', self.admin_view(DashboardUserSiteView.as_view()),
name="hpcdashuserslices"),
- url(r'^welcome/$', self.admin_view(DashboardWelcomeView.as_view()),
+ url(r'^welcome/$', self.admin_view(DashboardDynamicView.as_view()),
name="welcome"),
url(r'^simulator/', self.admin_view(SimulatorView.as_view()),
name="simulator"),
diff --git a/planetstack/core/dashboard/views/home.py b/planetstack/core/dashboard/views/home.py
index 3084c0e..4270d6d 100644
--- a/planetstack/core/dashboard/views/home.py
+++ b/planetstack/core/dashboard/views/home.py
@@ -1,13 +1,5 @@
from view_common import *
-class DashboardWelcomeView(TemplateView):
- template_name = 'admin/dashboard/welcome.html'
-
- def get(self, request, *args, **kwargs):
- context = self.get_context_data(**kwargs)
- context = getDashboardContext(request.user, context)
- return self.render_to_response(context=context)
-
class DashboardDynamicView(TemplateView):
head_template = r"""{% extends "admin/dashboard/dashboard_base.html" %}
{% load admin_static %}
@@ -33,8 +25,8 @@
return self.singleDashboardView(request, name, context)
def readTemplate(self, fn):
- TEMPLATE_DIRS = ["/opt/planetstack/templates/admin/dashboard/",
- "/opt/planetstack/core/xoslib/dashboards/"]
+ TEMPLATE_DIRS = [XOS_DIR + "/templates/admin/dashboard/",
+ XOS_DIR + "/core/xoslib/dashboards/"]
for template_dir in TEMPLATE_DIRS:
pathname = os.path.join(template_dir, fn) + ".html"
diff --git a/planetstack/core/dashboard/views/shell.py b/planetstack/core/dashboard/views/shell.py
index 5efe239..e852b16 100644
--- a/planetstack/core/dashboard/views/shell.py
+++ b/planetstack/core/dashboard/views/shell.py
@@ -1,4 +1,3 @@
-# /opt/planetstack/core/dashboard/views/helloworld.py
import datetime
import os
import sys
diff --git a/planetstack/core/dashboard/views/view_common.py b/planetstack/core/dashboard/views/view_common.py
index 060775d..deb8210 100644
--- a/planetstack/core/dashboard/views/view_common.py
+++ b/planetstack/core/dashboard/views/view_common.py
@@ -18,6 +18,7 @@
from operator import itemgetter, attrgetter
import traceback
import math
+from planetstack.config import Config, XOS_DIR
def getDashboardContext(user, context={}, tableFormat = False):
context = {}
diff --git a/planetstack/core/middleware.py b/planetstack/core/middleware.py
index 1401cd6..54267e3 100644
--- a/planetstack/core/middleware.py
+++ b/planetstack/core/middleware.py
@@ -4,7 +4,7 @@
def get_request():
if not hasattr(_active, "request"):
- raise Exception("Please add 'core.middleware.GlobalRequestMiddleware' to /opt/planetstack/planetstack/settings.py:MIDDLEWARE_CLASSES")
+ raise Exception("Please add 'core.middleware.GlobalRequestMiddleware' to <XOS_DIR>/planetstack/settings.py:MIDDLEWARE_CLASSES")
return _active.request
class GlobalRequestMiddleware(object):
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index d7787c4..6fcc8fd 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -15,13 +15,13 @@
from .slice import Slice, ControllerSlice
from .controlleruser import ControllerUser, ControllerSitePrivilege, ControllerSlicePrivilege
from .image import ImageDeployments, ControllerImages
-from .node import Node
from .serviceresource import ServiceResource
from .slice import SliceRole
from .slice import SlicePrivilege
from .credential import UserCredential,SiteCredential,SliceCredential
from .site import SiteRole
from .site import SitePrivilege
+from .node import Node
from .planetstackspecific import PlanetStack,PlanetStackRole,PlanetStackPrivilege
from .slicetag import SliceTag
from .sliver import Sliver
diff --git a/planetstack/core/models/node.py b/planetstack/core/models/node.py
index 94f93a5..1cd0e40 100644
--- a/planetstack/core/models/node.py
+++ b/planetstack/core/models/node.py
@@ -1,7 +1,7 @@
import os
from django.db import models
from core.models import PlCoreBase
-from core.models import Site, SiteDeployment
+from core.models import Site, SiteDeployment, SitePrivilege
from core.models import Tag
from django.contrib.contenttypes import generic
@@ -20,3 +20,14 @@
self.site = self.site_deployment.site
super(Node, self).save(*args, **kwds)
+
+ def can_update(self, user):
+ if user.is_readonly:
+ return False
+ if user.is_admin:
+ return True
+ if SitePrivilege.objects.filter(
+ user=user, site=self.site, role__role__in=['admin','tech']):
+ return True
+
+ return False
diff --git a/planetstack/core/models/plcorebase.py b/planetstack/core/models/plcorebase.py
index 5217667..c86d675 100644
--- a/planetstack/core/models/plcorebase.py
+++ b/planetstack/core/models/plcorebase.py
@@ -177,7 +177,7 @@
backend_register = models.CharField(max_length=140,
default="{}", null=True)
- backend_status = models.CharField(max_length=140,
+ backend_status = models.CharField(max_length=1024,
default="0 - Provisioning in progress")
deleted = models.BooleanField(default=False)
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index cc2ad03..f368bbe 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -214,6 +214,17 @@
return Deployment.objects.filter(id__in=ids)
+ def can_update(self, user):
+ if user.is_readonly:
+ return False
+ if user.is_admin:
+ return True
+
+ if self.deploymentprivileges.filter(user=user, role__role='admin'):
+ return True
+
+ return False
+
def __unicode__(self): return u'%s' % (self.name)
class DeploymentRole(PlCoreBase):
diff --git a/planetstack/core/models/slice.py b/planetstack/core/models/slice.py
index 8dfde4c..476cf8e 100644
--- a/planetstack/core/models/slice.py
+++ b/planetstack/core/models/slice.py
@@ -85,16 +85,16 @@
return False
if user.is_admin:
return True
+ if user == self.creator:
+ return True
# slice admins can update
- slice_privs = SlicePrivilege.objects.filter(user=user, slice=self)
- for slice_priv in slice_privs:
- if slice_priv.role.role == 'admin':
- return True
+ if SlicePrivilege.objects.filter(
+ user=user, slice=self, role__role='admin'):
+ return True
# site pis can update
- site_privs = SitePrivilege.objects.filter(user=user, site=self.site)
- for site_priv in site_privs:
- if site_priv.role.role == 'pi':
- return True
+ if SitePrivilege.objects.filter(
+ user=user, site=self.site, role__role__in=['admin', 'pi']):
+ return True
return False
diff --git a/planetstack/core/models/user.py b/planetstack/core/models/user.py
index 26a77f2..60fd290 100644
--- a/planetstack/core/models/user.py
+++ b/planetstack/core/models/user.py
@@ -171,7 +171,7 @@
updated = models.DateTimeField(auto_now=True)
enacted = models.DateTimeField(null=True, default=None)
policed = models.DateTimeField(null=True, default=None)
- backend_status = models.CharField(max_length=140,
+ backend_status = models.CharField(max_length=1024,
default="Provisioning in progress")
deleted = models.BooleanField(default=False)
diff --git a/planetstack/core/tests.py b/planetstack/core/tests.py
index 1c490c8..d07069a 100644
--- a/planetstack/core/tests.py
+++ b/planetstack/core/tests.py
@@ -69,7 +69,7 @@
def create(self, model, mplural, record):
- request = self.client.put('/plstackapi/%s/'%mplural,record['fields'])
+ request = self.client.put('/xos/%s/'%mplural,record['fields'])
#if (len2==len1):
# raise Exception('Could not delete %s/%d'%(model,pk))
@@ -81,7 +81,7 @@
record_to_update = src_record['fields']
now = datetime.now()
record_to_update['enacted']=now
- response = self.client.put('/plstackapi/%s/%d/'%(mplural,pk),record_to_update)
+ response = self.client.put('/xos/%s/%d/'%(mplural,pk),record_to_update)
self.assertEqual(response.data['enacted'],now)
return
@@ -89,14 +89,14 @@
def delete(self, model, mplural, pk):
mclass = globals()[model]
len1 = len(mclass.objects.all())
- response = self.client.delete('/plstackapi/%s/%d/'%(mplural,pk))
+ response = self.client.delete('/xos/%s/%d/'%(mplural,pk))
len2 = len(mclass.objects.all())
self.assertNotEqual(len1,len2)
return
def retrieve(self, m, mplural, mlower):
- response = self.client.get('/plstackapi/%s/'%mplural)
+ response = self.client.get('/xos/%s/'%mplural)
#force_authenticate(request,user=self.calling_user)
self.check_items(response.data,self.data_dict[mlower])
diff --git a/planetstack/core/views/legacyapi.py b/planetstack/core/views/legacyapi.py
index 31471ad..978fd21 100644
--- a/planetstack/core/views/legacyapi.py
+++ b/planetstack/core/views/legacyapi.py
@@ -6,10 +6,6 @@
import traceback
import xmlrpclib
-# XXX for testing
-#sys.path.append("/opt/planetstack")
-#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
-
from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
from django.http import HttpResponse
diff --git a/planetstack/core/views/observer.py b/planetstack/core/views/observer.py
index 67b2fde..2912db9 100644
--- a/planetstack/core/views/observer.py
+++ b/planetstack/core/views/observer.py
@@ -2,11 +2,15 @@
from monitor import driver
from core.models import *
import json
+import os
import time
def Observer(request):
+ if not os.path.exists('/tmp/observer_last_run'):
+ return HttpResponse(json.dumps({"health": ":-X", "time": time.time(), "comp": 0}))
+
t = time.time()
- status_str = open('/tmp/observer_last_run','r').read()
+ status_str = open('/tmp/observer_last_run','r').read()
d = json.loads(status_str)
comp = d['last_run'] + d['last_duration']*2 + 300
if comp>t:
diff --git a/planetstack/core/xoslib/README b/planetstack/core/xoslib/README
index a5af121..6d69629 100644
--- a/planetstack/core/xoslib/README
+++ b/planetstack/core/xoslib/README
@@ -1,7 +1,7 @@
Add to the following in settings.py
STATICFILES_DIRS=
- "/opt/planetstack/core/xoslib/static/",
+ XOS_DIR + "/core/xoslib/static/",
TEMPLATE_DIRS=
- "/opt/planetstack/xoslib/templates",
\ No newline at end of file
+ XOS_DIR + "/xoslib/templates",
\ No newline at end of file
diff --git a/planetstack/core/xoslib/dashboards/helloworld.html b/planetstack/core/xoslib/dashboards/helloworld.html
index 48badb6..91dde39 100644
--- a/planetstack/core/xoslib/dashboards/helloworld.html
+++ b/planetstack/core/xoslib/dashboards/helloworld.html
@@ -1,4 +1,4 @@
-<!-- /opt/planetstack/templates/admin/dashboard/helloworld.html -->
+<!-- /opt/xos/templates/admin/dashboard/helloworld.html -->
<div>Hello, {{ user.firstname }} {{ user.lastname }}.</div>
<div>This is the hello world view. The value of foobar is {{ foobar }}.</div>
<div id="dynamicTableOfInterestingThings"></div>
diff --git a/planetstack/core/xoslib/tools/make_defaults.py b/planetstack/core/xoslib/tools/make_defaults.py
index ad5377c..04fccc0 100644
--- a/planetstack/core/xoslib/tools/make_defaults.py
+++ b/planetstack/core/xoslib/tools/make_defaults.py
@@ -1,7 +1,8 @@
import os
import sys
-os.chdir("/opt/planetstack")
-sys.path.append("/opt/planetstack")
+XOS_DIR="/opt/xos"
+os.chdir(XOS_DIR)
+sys.path.append(XOS_DIR)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
import django
import core.models
diff --git a/planetstack/core/xoslib/tools/make_validators.py b/planetstack/core/xoslib/tools/make_validators.py
index 0fca367..f627457 100644
--- a/planetstack/core/xoslib/tools/make_validators.py
+++ b/planetstack/core/xoslib/tools/make_validators.py
@@ -1,7 +1,8 @@
import os
import sys
-os.chdir("/opt/planetstack")
-sys.path.append("/opt/planetstack")
+XOS_DIR="/opt/xos"
+os.chdir(XOS_DIR)
+sys.path.append(XOS_DIR)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
import django
import core.models
diff --git a/planetstack/dependency_walker.py b/planetstack/dependency_walker.py
index 8b15a85..6120d7d 100644
--- a/planetstack/dependency_walker.py
+++ b/planetstack/dependency_walker.py
@@ -2,7 +2,7 @@
import os
import imp
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
import inspect
import time
import traceback
@@ -13,14 +13,14 @@
from core.models import *
from util.logger import Logger, logging
-logger = Logger(level=logging.INFO)
+logger = Logger(level=logging.INFO)
missing_links={}
try:
dep_data = open(Config().dependency_graph).read()
except:
- dep_data = open('/opt/planetstack/model-deps').read()
+ dep_data = open(XOS_DIR + '/model-deps').read()
dependencies = json.loads(dep_data)
diff --git a/planetstack/ec2_observer/event_loop.py b/planetstack/ec2_observer/event_loop.py
index 1319fec..fb5f973 100644
--- a/planetstack/ec2_observer/event_loop.py
+++ b/planetstack/ec2_observer/event_loop.py
@@ -16,7 +16,7 @@
from openstack.driver import OpenStackDriver
from util.logger import Logger, logging, logger
#from timeout import timeout
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
from observer.steps import *
from syncstep import SyncStep
from toposort import toposort
@@ -82,7 +82,7 @@
if hasattr(Config(), "observer_steps_dir"):
step_dir = Config().observer_steps_dir
else:
- step_dir = "/opt/planetstack/observer/steps"
+ step_dir = XOS_DIR + "/observer/steps"
for fn in os.listdir(step_dir):
pathname = os.path.join(step_dir,fn)
@@ -336,7 +336,7 @@
while True:
try:
- error_map_file = getattr(Config(), "error_map_path", "/opt/planetstack/error_map.txt")
+ error_map_file = getattr(Config(), "error_map_path", XOS_DIR + "/error_map.txt")
self.error_mapper = ErrorMapper(error_map_file)
# Set of whole steps that failed
diff --git a/planetstack/ec2_observer/event_manager.py b/planetstack/ec2_observer/event_manager.py
index 97454ec..190d4eb 100644
--- a/planetstack/ec2_observer/event_manager.py
+++ b/planetstack/ec2_observer/event_manager.py
@@ -1,7 +1,7 @@
import threading
import requests, json
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
import uuid
import os
@@ -16,13 +16,13 @@
def get_random_client_id():
global random_client_id
- if (random_client_id is None) and os.path.exists("/opt/planetstack/random_client_id"):
+ if (random_client_id is None) and os.path.exists(XOS_DIR + "/random_client_id"):
# try to use the last one we used, if we saved it
try:
- random_client_id = open("/opt/planetstack/random_client_id","r").readline().strip()
+ random_client_id = open(XOS_DIR+"/random_client_id","r").readline().strip()
print "get_random_client_id: loaded %s" % random_client_id
except:
- print "get_random_client_id: failed to read /opt/planetstack/random_client_id"
+ print "get_random_client_id: failed to read " + XOS_DIR + "/random_client_id"
if random_client_id is None:
random_client_id = base64.urlsafe_b64encode(os.urandom(12))
@@ -30,9 +30,9 @@
# try to save it for later (XXX: could race with another client here)
try:
- open("/opt/planetstack/random_client_id","w").write("%s\n" % random_client_id)
+ open(XOS_DIR + "/random_client_id","w").write("%s\n" % random_client_id)
except:
- print "get_random_client_id: failed to write /opt/planetstack/random_client_id"
+ print "get_random_client_id: failed to write " + XOS_DIR + "/random_client_id"
return random_client_id
diff --git a/planetstack/ec2_observer/steps/sync_images.py b/planetstack/ec2_observer/steps/sync_images.py
index 903b73b..b494c06 100644
--- a/planetstack/ec2_observer/steps/sync_images.py
+++ b/planetstack/ec2_observer/steps/sync_images.py
@@ -1,7 +1,7 @@
import os
import base64
from django.db.models import F, Q
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
from ec2_observer.syncstep import SyncStep
from core.models.image import Image
from ec2_observer.awslib import *
@@ -21,10 +21,10 @@
new_images = []
try:
- aws_images = json.loads(open('/opt/planetstack/aws-images').read())
+ aws_images = json.loads(open(XOS_DIR + '/aws-images').read())
except:
aws_images = aws_run('ec2 describe-images --owner 099720109477')
- open('/opt/planetstack/aws-images','w').write(json.dumps(aws_images))
+ open(XOS_DIR + '/aws-images','w').write(json.dumps(aws_images))
diff --git a/planetstack/hpc_observer/hpc_observer_config b/planetstack/hpc_observer/hpc_observer_config
index 0b010cd..3878336 100644
--- a/planetstack/hpc_observer/hpc_observer_config
+++ b/planetstack/hpc_observer/hpc_observer_config
@@ -22,9 +22,9 @@
nova_enabled=True
[observer]
-dependency_graph=/opt/planetstack/hpc_observer/model-deps
-steps_dir=/opt/planetstack/hpc_observer/steps
-deleters_dir=/opt/planetstack/hpc_observer/deleters
+dependency_graph=/opt/xos/hpc_observer/model-deps
+steps_dir=/opt/xos/hpc_observer/steps
+deleters_dir=/opt/xos/hpc_observer/deleters
log_file=console
#/var/log/hpc.log
driver=None
diff --git a/planetstack/hpc_wizard/bigquery_analytics.py b/planetstack/hpc_wizard/bigquery_analytics.py
index 4a90c2b..cb3038a 100644
--- a/planetstack/hpc_wizard/bigquery_analytics.py
+++ b/planetstack/hpc_wizard/bigquery_analytics.py
@@ -18,6 +18,8 @@
from oauth2client.file import Storage
from oauth2client.tools import run_flow,run
+from bigquery_config import BIGQUERY_SECRETS_FN, BIGQUERY_CREDENTIALS_FN
+
"""
yum -y install python-httplib2
easy_install python_gflags
@@ -27,7 +29,7 @@
PROJECT_NUMBER = '549187599759'
try:
- FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json',
+ FLOW = flow_from_clientsecrets(BIGQUERY_SECRETS_FN,
scope='https://www.googleapis.com/auth/bigquery')
BIGQUERY_AVAILABLE = True
except:
@@ -92,7 +94,7 @@
except:
pass
- storage = Storage('/opt/planetstack/hpc_wizard/bigquery_credentials.dat')
+ storage = Storage(BIGQUERY_CREDENTIALS_FN)
credentials = storage.get()
if credentials is None or credentials.invalid:
diff --git a/planetstack/hpc_wizard/bigquery_config.py b/planetstack/hpc_wizard/bigquery_config.py
new file mode 100644
index 0000000..345acf2
--- /dev/null
+++ b/planetstack/hpc_wizard/bigquery_config.py
@@ -0,0 +1,3 @@
+BIGQUERY_DIR = "/opt/xos"
+BIGQUERY_SECRETS_FN = os.path.join(BIGQUERY_DIR, "hpc_wizard/client_secrets.json")
+BIGQUERY_CREDENTIALS_FN = os.path.join(BIGQUERY_DIR, "hpc_wizard/bigquery_credentials.dat")
diff --git a/planetstack/hpc_wizard/planetstack_analytics.py b/planetstack/hpc_wizard/planetstack_analytics.py
index 75462d4..06a083b 100644
--- a/planetstack/hpc_wizard/planetstack_analytics.py
+++ b/planetstack/hpc_wizard/planetstack_analytics.py
@@ -8,10 +8,8 @@
import traceback
import urllib2
-if os.path.exists("/home/smbaker/projects/vicci/plstackapi/planetstack"):
- sys.path.append("/home/smbaker/projects/vicci/plstackapi/planetstack")
-else:
- sys.path.append("/opt/planetstack")
+# XXX hardcoded path
+sys.path.append("/opt/xos")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
from django.conf import settings
diff --git a/planetstack/hpc_wizard/query.py b/planetstack/hpc_wizard/query.py
index 4ddf4f6..874022e 100644
--- a/planetstack/hpc_wizard/query.py
+++ b/planetstack/hpc_wizard/query.py
@@ -17,6 +17,8 @@
from oauth2client.file import Storage
from oauth2client.tools import run_flow,run
+from bigquery_config import BIGQUERY_SECRETS_FN, BIGQUERY_CREDENTIALS_FN
+
"""
yum -y install python-httplib2
easy_install python_gflags
@@ -27,7 +29,7 @@
PROJECT_NUMBER = '549187599759'
try:
- FLOW = flow_from_clientsecrets('/opt/planetstack/hpc_wizard/client_secrets.json',
+ FLOW = flow_from_clientsecrets(BIGQUERY_SECRETS_FN,
scope='https://www.googleapis.com/auth/bigquery')
except:
print "exception while initializing bigquery flow"
@@ -60,7 +62,7 @@
return resp
def run_query(self, query):
- storage = Storage('/opt/planetstack/hpc_wizard/bigquery_credentials.dat')
+ storage = Storage(BIGQUERY_CREDENTIALS_FN)
credentials = storage.get()
if credentials is None or credentials.invalid:
diff --git a/planetstack/openstack_observer/ansible.py b/planetstack/openstack_observer/ansible.py
index 41dc6f0..e5ce780 100644
--- a/planetstack/openstack_observer/ansible.py
+++ b/planetstack/openstack_observer/ansible.py
@@ -8,11 +8,15 @@
import random
import re
+# XXX hardcoded path
+# is there any reason why we aren't importing planetstack.config ?
+XOS_DIR="/opt/xos"
+
try:
step_dir = Config().observer_steps_dir
sys_dir = Config().observer_sys_dir
except:
- step_dir = '/opt/planetstack/observer/steps'
+ step_dir = XOS_DIR + '/observer/steps'
sys_dir = '/opt/opencloud'
os_template_loader = jinja2.FileSystemLoader( searchpath=step_dir)
@@ -63,7 +67,7 @@
f.write(buffer)
f.flush()
- run = os.popen('/opt/planetstack/observer/run_ansible %s'%shellquote(fqp))
+ run = os.popen(XOS_DIR + '/observer/run_ansible %s'%shellquote(fqp))
#run = os.popen('ansible-playbook -v %s'%shellquote(fqp))
msg = run.read()
status = run.close()
diff --git a/planetstack/openstack_observer/event_loop.py b/planetstack/openstack_observer/event_loop.py
index bc0b226..ce0ab5e 100644
--- a/planetstack/openstack_observer/event_loop.py
+++ b/planetstack/openstack_observer/event_loop.py
@@ -20,7 +20,7 @@
from openstack.driver import OpenStackDriver
from util.logger import Logger, logging, logger
#from timeout import timeout
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
from observer.steps import *
from syncstep import SyncStep
from toposort import toposort
@@ -98,7 +98,7 @@
if hasattr(Config(), "observer_steps_dir"):
step_dir = Config().observer_steps_dir
else:
- step_dir = "/opt/planetstack/observer/steps"
+ step_dir = XOS_DIR + "/observer/steps"
for fn in os.listdir(step_dir):
pathname = os.path.join(step_dir,fn)
@@ -380,7 +380,7 @@
while True:
try:
loop_start = time.time()
- error_map_file = getattr(Config(), "error_map_path", "/opt/planetstack/error_map.txt")
+ error_map_file = getattr(Config(), "error_map_path", XOS_DIR + "/error_map.txt")
self.error_mapper = ErrorMapper(error_map_file)
# Set of whole steps that failed
diff --git a/planetstack/openstack_observer/event_manager.py b/planetstack/openstack_observer/event_manager.py
index 97454ec..190d4eb 100644
--- a/planetstack/openstack_observer/event_manager.py
+++ b/planetstack/openstack_observer/event_manager.py
@@ -1,7 +1,7 @@
import threading
import requests, json
-from planetstack.config import Config
+from planetstack.config import Config, XOS_DIR
import uuid
import os
@@ -16,13 +16,13 @@
def get_random_client_id():
global random_client_id
- if (random_client_id is None) and os.path.exists("/opt/planetstack/random_client_id"):
+ if (random_client_id is None) and os.path.exists(XOS_DIR + "/random_client_id"):
# try to use the last one we used, if we saved it
try:
- random_client_id = open("/opt/planetstack/random_client_id","r").readline().strip()
+ random_client_id = open(XOS_DIR+"/random_client_id","r").readline().strip()
print "get_random_client_id: loaded %s" % random_client_id
except:
- print "get_random_client_id: failed to read /opt/planetstack/random_client_id"
+ print "get_random_client_id: failed to read " + XOS_DIR + "/random_client_id"
if random_client_id is None:
random_client_id = base64.urlsafe_b64encode(os.urandom(12))
@@ -30,9 +30,9 @@
# try to save it for later (XXX: could race with another client here)
try:
- open("/opt/planetstack/random_client_id","w").write("%s\n" % random_client_id)
+ open(XOS_DIR + "/random_client_id","w").write("%s\n" % random_client_id)
except:
- print "get_random_client_id: failed to write /opt/planetstack/random_client_id"
+ print "get_random_client_id: failed to write " + XOS_DIR + "/random_client_id"
return random_client_id
diff --git a/planetstack/planetstack/config.py b/planetstack/planetstack/config.py
index 923964d..cb2e33f 100644
--- a/planetstack/planetstack/config.py
+++ b/planetstack/planetstack/config.py
@@ -12,8 +12,8 @@
"""
"""
-XOS_ROOT = "/opt/planetstack"
-DEFAULT_CONFIG_FN = os.path.join(XOS_ROOT, "xos_config")
+XOS_DIR = "/opt/xos"
+DEFAULT_CONFIG_FN = os.path.join(XOS_DIR, "xos_config")
# warning for now, remove once we're sure everyone has made the change
if (os.path.exists("/opt/planetstack/plstackapi_config") and (not os.path.exists(DEFAULT_CONFIG_FN))):
diff --git a/planetstack/planetstack/settings.py b/planetstack/planetstack/settings.py
index 19bf9e8..cae61aa 100644
--- a/planetstack/planetstack/settings.py
+++ b/planetstack/planetstack/settings.py
@@ -6,8 +6,9 @@
config = Config()
GEOIP_PATH = "/usr/share/GeoIP"
+XOS_DIR = "/opt/xos"
-DEBUG = True
+DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
@@ -35,7 +36,7 @@
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ["*"]
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
@@ -80,11 +81,8 @@
STATIC_URL = '/static/'
# Additional locations of static files
-STATICFILES_DIRS = ( "/opt/planetstack/core/static/",
- "/opt/planetstack/core/xoslib/static/",
- # Put strings here, like "/home/html/static" or "C:/www/django/static".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
+STATICFILES_DIRS = ( XOS_DIR + "/core/static/",
+ XOS_DIR + "/core/xoslib/static/",
)
# List of finder classes that know how to find static files in
@@ -125,8 +123,8 @@
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- "/opt/planetstack/templates",
- "/opt/planetstack/core/xoslib/templates",
+ XOS_DIR + "/templates",
+ XOS_DIR + "/core/xoslib/templates",
)
INSTALLED_APPS = (
@@ -261,7 +259,7 @@
BIGQUERY_TABLE = getattr(config, "bigquery_table", "demoevents")
DISABLE_MINIDASHBOARD = getattr(config, "gui_disable_minidashboard", False)
-ENCRYPTED_FIELDS_KEYDIR = '/opt/planetstack/private_keys'
+ENCRYPTED_FIELDS_KEYDIR = XOS_DIR + '/private_keys'
ENCRYPTED_FIELD_MODE = 'ENCRYPT'
STATISTICS_DRIVER = getattr(config, "statistics_driver", "ceilometer")
diff --git a/planetstack/redhat/planetstack-backend.service b/planetstack/redhat/planetstack-backend.service
index 90d3c7c..43734f1 100644
--- a/planetstack/redhat/planetstack-backend.service
+++ b/planetstack/redhat/planetstack-backend.service
@@ -1,13 +1,13 @@
[Unit]
-Description=PlanetStack Observer
+Description=XOS Observer
After=syslog.target network.target
[Service]
Type=forking
User=root
-PIDFile=/var/run/planetstack-backend.pid
-ExecStart=/usr/sbin/daemonize -c /opt/planetstack -p /var/run/planetstack-backend.pid /opt/planetstack/planetstack-backend.py
-ExecStop=kill $(cat /var/run/planetstack-backend.pid)
+PIDFile=/var/run/xos-observer.pid
+ExecStart=/usr/sbin/daemonize -c /opt/xos -p /var/run/xos-observer.pid /opt/xos/xos-observer.py
+ExecStop=kill $(cat /var/run/xos-observer.pid)
[Install]
WantedBy=multi-user.target
diff --git a/planetstack/rr_observer/rr_observer_config b/planetstack/rr_observer/rr_observer_config
index 1fb52d0..af4ed1a 100644
--- a/planetstack/rr_observer/rr_observer_config
+++ b/planetstack/rr_observer/rr_observer_config
@@ -24,9 +24,9 @@
nova_enabled=True
[observer]
-dependency_graph=/opt/planetstack/rr_observer/model-deps
-steps_dir=/opt/planetstack/rr_observer/steps
-deleters_dir=/opt/planetstack/rr_observer/deleters
+dependency_graph=/opt/xos/rr_observer/model-deps
+steps_dir=/opt/xos/rr_observer/steps
+deleters_dir=/opt/xos/rr_observer/deleters
log_file=console
#/var/log/hpc.log
driver=None
diff --git a/planetstack/scripts/opencloud b/planetstack/scripts/opencloud
old mode 100644
new mode 100755
index 54852b9..d460312
--- a/planetstack/scripts/opencloud
+++ b/planetstack/scripts/opencloud
@@ -1,15 +1,17 @@
-#!/bin/sh
+#!/bin/bash
if [ -z "$1" ]; then
echo usage: $0 "[initdb | createdb | dropdb | syncdb | runserver | resetdb | dumpdata]"
exit
fi
-BACKUP_DIR=/opt/planetstack_backups
+XOS_DIR=/opt/xos
+BACKUP_DIR=/opt/xos_backups
+DBNAME=planetstack
DJANGO_17=`python -c "import django; from distutils.version import StrictVersion; print int(StrictVersion(django.get_version()) >= StrictVersion('1.7'))"`
-cd /opt/planetstack
+cd $XOS_DIR
function ensure_postgres_running {
# "sudo -u postgres pg_ctl -D /var/lib/postgres/data status" doesn't work
@@ -22,9 +24,8 @@
return
fi
- /sbin/service postgresql initdb
- /sbin/service postgresql start
- /sbin/chkconfig postgresql on
+ service postgresql initdb
+ service postgresql start
netstat -nl | grep -i ":5432 "
if [[ $? != 0 ]]; then
@@ -36,37 +37,38 @@
}
function createdb {
- echo "Creating OpenCloud database..."
- sudo -u postgres createdb planetstack
+ echo "Creating XOS database..."
+ sudo -u postgres createdb $DBNAME
}
function dropdb {
- echo "Dropping OpenCloud database..."
- sudo -u postgres dropdb planetstack
+ echo "Dropping XOS database..."
+ sudo -u postgres dropdb $DBNAME
}
function syncdb {
- echo "Syncing OpenCloud services..."
- python /opt/planetstack/manage.py syncdb --noinput
+ echo "Syncing XOS services..."
+ python $XOS_DIR/manage.py syncdb --noinput
if [[ $DJANGO_17 ]]; then
echo "Loading initial data from fixture..."
- python /opt/planetstack/manage.py --noobserver --nomodelpolicy loaddata /opt/planetstack/core/fixtures/initial_data.json
+ python $XOS_DIR/manage.py --noobserver --nomodelpolicy loaddata $XOS_DIR/core/fixtures/initial_data.json
fi
}
function evolvedb {
- echo "Evolving OpenCloud services..."
- python /opt/planetstack/manage.py evolve --hint --execute --noinput
+ echo "Evolving XOS services..."
+ python $XOS_DIR/manage.py evolve --hint --execute --noinput
}
function migratedb {
- echo "Migrating OpenCloud services..."
- python /opt/planetstack/manage.py migrate
+ echo "Migrating XOS services..."
+ python $XOS_DIR/manage.py migrate
}
function stopserver {
- echo "Stopping any running OpenCloud Service(s)"
+ echo "Stopping any running XOS Service(s)"
pkill -f "python.*runserver"
}
function runserver {
- PUBLIC_HOSTNAME=`/opt/planetstack/planetstack-config.py get server_hostname $HOSTNAME`
- echo "Starting OpenCloud Service on $PUBLIC_HOSTNAME:8000"
- python manage.py runserver $PUBLIC_HOSTNAME:8000&
+ ensure_postgres_running
+ PUBLIC_HOSTNAME=`$XOS_DIR/xos-config.py get server_hostname $HOSTNAME`
+ echo "Starting XOS Service on $PUBLIC_HOSTNAME:8000"
+ python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure&
}
function dumpdata {
@@ -115,8 +117,8 @@
dumpdata
# TODO: This is where we could run migration scripts to upgrade the
# dumped data to the new models.
- mv /opt/planetstack/core/fixtures/initial_data.json /opt/planetstack/core/fixtures/initial_data.json-old
- cp $BACKUP_DIR/dumpdata-latest.json /opt/planetstack/core/fixtures/initial_data.json
+ mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
+ cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
dropdb
createdb
syncdb
@@ -128,8 +130,8 @@
fi
stopserver
ensure_postgres_running
- mv /opt/planetstack/core/fixtures/initial_data.json /opt/planetstack/core/fixtures/initial_data.json-old
- cp $BACKUP_DIR/dumpdata-latest.json /opt/planetstack/core/fixtures/initial_data.json
+ mv $XOS_DIR/core/fixtures/initial_data.json $XOS_DIR/core/fixtures/initial_data.json-old
+ cp $BACKUP_DIR/dumpdata-latest.json $XOS_DIR/core/fixtures/initial_data.json
dropdb
createdb
syncdb
diff --git a/planetstack/syndicate_observer/syndicate_observer_config b/planetstack/syndicate_observer/syndicate_observer_config
index 6da1aa0..b83fa89 100644
--- a/planetstack/syndicate_observer/syndicate_observer_config
+++ b/planetstack/syndicate_observer/syndicate_observer_config
@@ -24,9 +24,9 @@
nova_enabled=True
[observer]
-dependency_graph=/opt/planetstack/syndicate_observer/model-deps
-steps_dir=/opt/planetstack/syndicate_observer/steps
-deleters_dir=/opt/planetstack/syndicate_observer/deleters
+dependency_graph=/opt/xos/syndicate_observer/model-deps
+steps_dir=/opt/xos/syndicate_observer/steps
+deleters_dir=/opt/xos/syndicate_observer/deleters
log_file=console
driver=None
diff --git a/planetstack/templates/admin/base.html b/planetstack/templates/admin/base.html
index 2d00343..29823a5 100644
--- a/planetstack/templates/admin/base.html
+++ b/planetstack/templates/admin/base.html
@@ -117,7 +117,7 @@
{% if not is_popup %}
<div id=openCloudTopPage>
- {% include "/opt/planetstack/templates/admin/newminidashboard.html" %}
+ {% include "admin/newminidashboard.html" %}
</div>
{% block breadcrumbs %}
diff --git a/planetstack/templates/admin/dashboard/welcome.html b/planetstack/templates/admin/dashboard/welcome.html
deleted file mode 100644
index 0f616e5..0000000
--- a/planetstack/templates/admin/dashboard/welcome.html
+++ /dev/null
@@ -1,31 +0,0 @@
-{% extends "admin/dashboard/dashboard_base.html" %}
-{% load admin_static %}
-
-{% block content %}
-<!-- <div id="hometabs" class="inner-center-column ui-tabs ui-widget ui-widget-content ui-corner-all"> -->
-<div id="hometabs" >
- <ul id="suit_form_tabs" class="nav nav-tabs nav-tabs-suit" data-tab-prefix="suit-tab">
- <li><a href="#tabs-1">Developer View</a></li>
- <li><a href="#tabs-2">CDN Operations </a></li>
- <li><a href="#tabs-3">Historical</a></li>
- <li><a href="#tabs-4">Slice Interactions</a></li>
- <li><a href="#tabs-5">Tenant</a></li>
- </ul>
-<div id="tabs-1">
-{% include "/opt/planetstack/templates/admin/dashboard/developer.html" %}
-</div>
-<div id="tabs-2">
-{% include "/opt/planetstack/templates/admin/dashboard/cdnoperations.html" %}
-</div>
-<div id="tabs-3">
-{% include "/opt/planetstack/templates/admin/dashboard/hpc_historical.html" %}
-</div>
-<div id="tabs-4">
-{% include "/opt/planetstack/templates/admin/dashboard/slice_interactions.html" %}
-</div>
-<div id="tabs-5">
-{% include "/opt/planetstack/templates/admin/dashboard/tenant.html" %}
-</div>
-</div>
-
-{% endblock %}
diff --git a/planetstack/tests/generate_billing_sample.py b/planetstack/tests/generate_billing_sample.py
index b1413e3..fd6d1ea 100644
--- a/planetstack/tests/generate_billing_sample.py
+++ b/planetstack/tests/generate_billing_sample.py
@@ -20,9 +20,8 @@
DAY_SECONDS = HOUR_SECONDS * 24
MONTH_SECONDS = DAY_SECONDS * 30
-
+# XXX hardcoded path
sys.path.append("/opt/planetstack")
-#sys.path.append("/home/smbaker/projects/vicci/plstackapi/planetstack")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
#from openstack.manager import OpenStackManager
diff --git a/planetstack/tests/useraccesstest.py b/planetstack/tests/useraccesstest.py
index 290d7cf..9a32612 100644
--- a/planetstack/tests/useraccesstest.py
+++ b/planetstack/tests/useraccesstest.py
@@ -16,7 +16,7 @@
from operator import itemgetter, attrgetter
-REST_API="http://node43.princeton.vicci.org:8000/plstackapi/"
+REST_API="http://node43.princeton.vicci.org:8000/xos/"
USERS_API = REST_API + "users/"
SLICES_API = REST_API + "slices/"
SITES_API = REST_API + "sites/"
diff --git a/planetstack/tests/usertest.py b/planetstack/tests/usertest.py
index 1b5c41b..d096683 100644
--- a/planetstack/tests/usertest.py
+++ b/planetstack/tests/usertest.py
@@ -5,7 +5,7 @@
from operator import itemgetter, attrgetter
-REST_API="http://node43.princeton.vicci.org:8000/plstackapi/"
+REST_API="http://node43.princeton.vicci.org:8000/xos/"
USERS_API = REST_API + "users/"
username = sys.argv[1]
diff --git a/planetstack/tools/init-xos.py b/planetstack/tools/init-xos.py
new file mode 100644
index 0000000..47f5529
--- /dev/null
+++ b/planetstack/tools/init-xos.py
@@ -0,0 +1,57 @@
+import os
+import sys
+sys.path.append("/opt/xos")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
+import django
+from core.models import *
+django.setup()
+
+# python ./manage.py sqlflush | python ./manage.py dbshell
+
+os.system("python /opt/xos/manage.py sqlflush | python /opt/xos/manage.py dbshell")
+
+ADMIN_USERNAME = "padmin@vicci.org"
+ADMIN_PASSWORD = "letmein"
+FLAVORS = ["m1.small", "m1.medium", "m1.large"]
+SITE_ROLES = ["admin", "pi", "tech"]
+SLICE_ROLES = ["admin", "access"]
+DEPLOYMENT_ROLES = ["admin"]
+
+d = Deployment(name="Enterprise")
+d.save()
+
+s = Site(name="MySite", enabled=True, login_base="mysite", is_public=True, abbreviated_name="mysite")
+s.save()
+
+sd = SiteDeployment(site=s, deployment=d)
+sd.save();
+
+u = User(email = "padmin@vicci.org", password="letmein", is_admin=True, is_active=True, site=s, firstname="XOS",
+ lastname="admin")
+u.save()
+
+for flavor_name in FLAVORS:
+ f = Flavor(name=flavor_name, flavor=flavor_name)
+ f.save()
+ f.deployments.add(d)
+ f.save()
+
+for site_role_name in SITE_ROLES:
+ sr = SiteRole(role=site_role_name)
+ sr.save()
+
+for slice_role_name in SLICE_ROLES:
+ sr = SliceRole(role=slice_role_name)
+ sr.save()
+
+for deployment_role_name in DEPLOYMENT_ROLES:
+ dr = DeploymentRole(role=deployment_role_name)
+ dr.save()
+
+DashboardView(name="xsh", url="template:xsh", enabled=True).save()
+DashboardView(name="Customize", url="template:customize", enabled=True).save()
+DashboardView(name="Tenant", url="template:xosTenant", enabled=True).save()
+DashboardView(name="Developer", url="template:xosDeveloper_datatables", enabled=True).save()
+
+ServiceClass(name="Best Effort", description="Best Effort").save()
+
diff --git a/planetstack/tools/openstack-db-cleanup.sh b/planetstack/tools/openstack-db-cleanup.sh
index 9baca6e..851d326 100644
--- a/planetstack/tools/openstack-db-cleanup.sh
+++ b/planetstack/tools/openstack-db-cleanup.sh
@@ -1,11 +1,13 @@
#! /bin/bash
# to install
-# chmod 0755 /opt/planetstack/openstack/openstack-db-cleanup.sh
-# ln -s /opt/planetstack/openstack/openstack-db-cleanup.sh /etc/cron.daily/openstack-db-cleanup.cron
+# chmod 0755 /opt/xos/openstack/openstack-db-cleanup.sh
+# ln -s /opt/xos/openstack/openstack-db-cleanup.sh /etc/cron.daily/openstack-db-cleanup.cron
-mkdir -p /opt/planetstack/ovs-backups
-BACKUP_NAME=/opt/planetstack/ovs-backups/backup-`date "+%Y-%M-%d"`.sql
+XOS_DIR="/opt/xos"
+
+mkdir -p $XOS_DIR/ovs-backups
+BACKUP_NAME=$XOS_DIR/ovs-backups/backup-`date "+%Y-%M-%d"`.sql
mysqldump --create-options --routines --triggers --databases keystone ovs_quantum nova glance cinder > $BACKUP_NAME
gzip $BACKUP_NAME
diff --git a/planetstack/uwsgi/planetstack.ini b/planetstack/uwsgi/planetstack.ini
index 1d84d99..625dafe 100644
--- a/planetstack/uwsgi/planetstack.ini
+++ b/planetstack/uwsgi/planetstack.ini
@@ -1,5 +1,5 @@
[uwsgi]
-chdir = /opt/planetstack
+chdir = /opt/xos
module = planetstack.wsgi:application
env = DJANGO_SETTINGS_MODULE=planetstack.settings
socket = /var/run/uwsgi/planetstack.sock
diff --git a/planetstack/planetstack-config.py b/planetstack/xos-config.py
old mode 100644
new mode 100755
similarity index 100%
rename from planetstack/planetstack-config.py
rename to planetstack/xos-config.py
diff --git a/planetstack/planetstack-backend.py b/planetstack/xos-observer.py
similarity index 100%
rename from planetstack/planetstack-backend.py
rename to planetstack/xos-observer.py
diff --git a/planetstack/xos_config b/planetstack/xos_config
index fb846b3..86864cc 100644
--- a/planetstack/xos_config
+++ b/planetstack/xos_config
@@ -19,7 +19,7 @@
omf_enabled=0
mail_support_address=support@localhost
nova_enabled=True
-logfile=/var/log/planetstack.log
+logfile=/var/log/xos.log
[nova]
admin_user=admin@domain.com
@@ -32,6 +32,6 @@
ca_ssl_cert=/etc/ssl/certs/ca-certificates.crt
[observer]
-images_directory=/opt/planetstack/images
-dependency_graph=/opt/planetstack/model-deps
-logfile=/var/log/planetstack_backend.log
+images_directory=/opt/xos/images
+dependency_graph=/opt/xos/model-deps
+logfile=/var/log/xos_backend.log
diff --git a/setup.py b/setup.py
index a250b29..bc486e5 100644
--- a/setup.py
+++ b/setup.py
@@ -23,4 +23,4 @@
('/lib/systemd/system/', ['planetstack/redhat/planetstack-backend.service']),
])
-copytree('planetstack/', '/opt/planetstack')
+copytree('planetstack/', '/opt/xos')
diff --git a/opencloud.spec b/xos.spec
similarity index 95%
rename from opencloud.spec
rename to xos.spec
index 611750d..5896250 100644
--- a/opencloud.spec
+++ b/xos.spec
@@ -1,7 +1,7 @@
Summary: OpenCloud core services
-Name: opencloud
-Version: 1.0.29
-Release: 3
+Name: xos
+Version: 1.1.0
+Release: 1
License: GPL+
Group: Development/Tools
Source0: %{_tmppath}/%{name}-%{version}.tar.gz
@@ -96,7 +96,7 @@
# remove config files from the file list (see %config below)
cat > %{_tmppath}/config-files << "EOF"
-/opt/planetstack/plstackapi_config
+/opt/planetstack/xos_config
/opt/planetstack/deployment_auth.py
EOF
@@ -112,7 +112,7 @@
%files -f %{_tmppath}/tmp-filelist
%defattr(-,root,root,-)
-%config /opt/planetstack/plstackapi_config
+%config /opt/planetstack/xos_config
%config /opt/planetstack/deployment_auth.py
%config /opt/planetstack/model-deps
@@ -148,7 +148,7 @@
%preun
if [ "$1" = 0 ] ; then
- echo "UNINSTALL - destroying planetstack"
+ echo "UNINSTALL - destroying xos"
rm -rf /opt/planetstack
fi