Merge branch 'master' of github.com:open-cloud/xos
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 6babec2..81fdbf1 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -642,7 +642,7 @@
class ControllerAdmin(PlanetStackBaseAdmin):
model = Controller
- fieldList = ['name', 'backend_type', 'version', 'auth_url', 'admin_user', 'admin_tenant','admin_password']
+ fieldList = ['name', 'backend_type', 'version', 'auth_url', 'admin_user', 'admin_tenant','admin_password', 'domain']
fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-general']})]
inlines = [ControllerSiteInline] # ,ControllerImagesInline]
list_display = ['backend_status_icon', 'name', 'version', 'backend_type']
diff --git a/planetstack/core/migrations/0001_initial.py b/planetstack/core/migrations/0001_initial.py
index fe34224..ad82329 100644
--- a/planetstack/core/migrations/0001_initial.py
+++ b/planetstack/core/migrations/0001_initial.py
@@ -103,6 +103,7 @@
('admin_user', models.CharField(help_text=b'Username of an admin user at this controller', max_length=200, null=True, blank=True)),
('admin_password', models.CharField(help_text=b'Password of theadmin user at this controller', max_length=200, null=True, blank=True)),
('admin_tenant', models.CharField(help_text=b'Name of the tenant the admin user belongs to', max_length=200, null=True, blank=True)),
+ ('domain', models.CharField(help_text=b'Name of the domain this controller belongs to', max_length=200, null=True, blank=True)),
],
options={
'abstract': False,
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index d6914f6..2a41352 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -251,6 +251,7 @@
admin_user = models.CharField(max_length=200, null=True, blank=True, help_text="Username of an admin user at this controller")
admin_password = models.CharField(max_length=200, null=True, blank=True, help_text="Password of theadmin user at this controller")
admin_tenant = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the tenant the admin user belongs to")
+ domain = models.CharField(max_length=200, null=True, blank=True, help_text="Name of the domain this controller belongs to")
def __unicode__(self): return u'%s %s %s' % (self.name, self.backend_type, self.version)
diff --git a/planetstack/ec2_observer/steps/sync_nodes.py b/planetstack/ec2_observer/steps/sync_nodes.py
deleted file mode 100644
index 0fa8b61..0000000
--- a/planetstack/ec2_observer/steps/sync_nodes.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import os
-import base64
-import random
-import time
-from datetime import datetime
-from django.db.models import F, Q
-from planetstack.config import Config
-from ec2_observer.syncstep import SyncStep
-from core.models.node import Node
-from core.models.site import *
-from ec2_observer.awslib import *
-import pdb
-
-class SyncNodes(SyncStep):
- provides=[Node]
- requested_interval=0
-
- def fetch_pending(self, deletion):
- if (deletion):
- return []
-
- deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
- current_site_deployments = SiteDeployment.objects.filter(Q(deployment=deployment))
-
- zone_ret = aws_run('ec2 describe-availability-zones')
- zones = zone_ret['AvailabilityZones']
-
- # collect local nodes
- instance_types = 'm1.small | m1.medium | m1.large | m1.xlarge | m3.medium | m3.large | m3.xlarge | m3.2xlarge'.split(' | ')
-
- all_new_nodes = []
- for sd in current_site_deployments:
- s = sd.site
- current_fqns = [n.name for n in s.nodes.all()]
- all_fqns = ['.'.join([n,s.name]) for n in instance_types]
- new_node_names = list(set(all_fqns) - set(current_fqns))
-
- new_nodes = []
- for node_name in new_node_names:
- node = Node(name=node_name,
- site=s,deployment=deployment)
- new_nodes.append(node)
-
- all_new_nodes.extend(new_nodes)
-
- return all_new_nodes
-
-
- def sync_record(self, node):
- node.save()
-
diff --git a/planetstack/openstack_observer/steps/sync_nodes.py b/planetstack/openstack_observer/steps/sync_nodes.py
deleted file mode 100644
index e2c63bc..0000000
--- a/planetstack/openstack_observer/steps/sync_nodes.py
+++ /dev/null
@@ -1,61 +0,0 @@
-import os
-import base64
-import random
-from datetime import datetime
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.node import Node
-from core.models.site import SiteDeployment, Controller
-from util.logger import Logger, logging
-
-logger = Logger(level=logging.INFO)
-
-class SyncNodes(OpenStackSyncStep):
- provides=[Node]
- requested_interval=0
-
- def fetch_pending(self, deleted):
- # Nodes come from the back end
- # You can't delete them
- if (deleted):
- return []
-
- # collect local nodes
- controllers = Controller.objects.all()
- nodes = Node.objects.all()
- node_hostnames = [node.name for node in nodes]
-
- # fetch all nodes from each controller
- new_nodes = []
- for controller in controllers:
- try:
- controller_site_deployments = SiteDeployment.objects.filter(controller=controller)[0]
- except IndexError:
- raise Exception("Controller %s not bound to any site deployments"%controller.name)
-
- site_deployment = controller_site_deployments.site_deployment
- if (not site_deployment):
- raise Exception('Controller without Site Deployment: %s'%controller.name)
-
- try:
- driver = self.driver.admin_driver(controller=controller,tenant='admin')
- compute_nodes = driver.shell.nova.hypervisors.list()
- except:
- logger.log_exc("Failed to get nodes from controller %s" % str(controller))
- continue
-
- for compute_node in compute_nodes:
- if compute_node.hypervisor_hostname not in node_hostnames:
- # XX TODO:figure out how to correctly identify a node's site.
- # XX pick the first one
- node = Node(name=compute_node.hypervisor_hostname,
- site_deployment=site_deployment)
- new_nodes.append(node)
-
- return new_nodes
-
-
- def sync_record(self, node):
- node.save()
-