Merge pull request #106 from open-cloud/reconcile_openstack
Reconcile openstack
diff --git a/xos/cord/admin.py b/xos/cord/admin.py
index 103f1d0..6137212 100644
--- a/xos/cord/admin.py
+++ b/xos/cord/admin.py
@@ -158,7 +158,7 @@
class VCPETenantForm(forms.ModelForm):
bbs_account = forms.CharField(required=False)
creator = forms.ModelChoiceField(queryset=User.objects.all())
- sliver = forms.ModelChoiceField(queryset=Sliver.objects.all(),required=False)
+ instance = forms.ModelChoiceField(queryset=Instance.objects.all(),required=False)
last_ansible_hash = forms.CharField(required=False)
def __init__(self,*args,**kwargs):
@@ -169,7 +169,7 @@
# fields for the attributes
self.fields['bbs_account'].initial = self.instance.bbs_account
self.fields['creator'].initial = self.instance.creator
- self.fields['sliver'].initial = self.instance.sliver
+ self.fields['instance'].initial = self.instance.instance
self.fields['last_ansible_hash'].initial = self.instance.last_ansible_hash
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
@@ -180,7 +180,7 @@
def save(self, commit=True):
self.instance.creator = self.cleaned_data.get("creator")
- self.instance.sliver = self.cleaned_data.get("sliver")
+ self.instance.instance = self.cleaned_data.get("instance")
self.instance.last_ansible_hash = self.cleaned_data.get("last_ansible_hash")
return super(VCPETenantForm, self).save(commit=commit)
@@ -191,7 +191,7 @@
list_display = ('backend_status_icon', 'id', 'subscriber_tenant' )
list_display_links = ('backend_status_icon', 'id')
fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'provider_service', 'subscriber_tenant', 'service_specific_id', # 'service_specific_attribute',
- 'bbs_account', 'creator', 'sliver', 'last_ansible_hash'],
+ 'bbs_account', 'creator', 'instance', 'last_ansible_hash'],
'classes':['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', 'service_specific_attribute', 'bbs_account')
form = VCPETenantForm
diff --git a/xos/cord/models.py b/xos/cord/models.py
index f115045..68bd2ba 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -1,5 +1,5 @@
from django.db import models
-from core.models import Service, PlCoreBase, Slice, Sliver, Tenant, TenantWithContainer, Node, Image, User, Flavor, Subscriber
+from core.models import Service, PlCoreBase, Slice, Instance, Tenant, TenantWithContainer, Node, Image, User, Flavor, Subscriber
from core.models.plcorebase import StrippedCharField
import os
from django.db import models, transaction
@@ -469,7 +469,7 @@
"private_ip", "private_mac",
"hpc_client_ip", "hpc_client_mac")
- default_attributes = {"sliver_id": None,
+ default_attributes = {"instance_id": None,
"users": [],
"bbs_account": None,
"last_ansible_hash": None}
@@ -477,6 +477,66 @@
def __init__(self, *args, **kwargs):
super(VCPETenant, self).__init__(*args, **kwargs)
self.cached_vbng=None
+ self.cached_instance=None
+ self.orig_instance_id = self.get_initial_attribute("instance_id")
+
+ @property
+ def image(self):
+ LOOK_FOR_IMAGES=["ubuntu-vcpe4", # ONOS demo machine -- preferred vcpe image
+ "Ubuntu 14.04 LTS", # portal
+ "Ubuntu-14.04-LTS", # ONOS demo machine
+ ]
+ for image_name in LOOK_FOR_IMAGES:
+ images = Image.objects.filter(name = image_name)
+ if images:
+ return images[0]
+
+ raise XOSProgrammingError("No VPCE image (looked for %s)" % str(LOOK_FOR_IMAGES))
+
+ @property
+ def instance(self):
+ if getattr(self, "cached_instance", None):
+ return self.cached_instance
+ instance_id=self.get_attribute("instance_id")
+ if not instance_id:
+ return None
+ instances=Instance.objects.filter(id=instance_id)
+ if not instances:
+ return None
+ instance=instances[0]
+ instance.caller = self.creator
+ self.cached_instance = instance
+ return instance
+
+ @instance.setter
+ def instance(self, value):
+ if value:
+ value = value.id
+ if (value != self.get_attribute("instance_id", None)):
+ self.cached_instance=None
+ self.set_attribute("instance_id", value)
+
+ @property
+ def creator(self):
+ if getattr(self, "cached_creator", None):
+ return self.cached_creator
+ creator_id=self.get_attribute("creator_id")
+ if not creator_id:
+ return None
+ users=User.objects.filter(id=creator_id)
+ if not users:
+ return None
+ user=users[0]
+ self.cached_creator = users[0]
+ return user
+
+ @creator.setter
+ def creator(self, value):
+ if value:
+ value = value.id
+ if (value != self.get_attribute("creator_id", None)):
+ self.cached_creator=None
+ self.set_attribute("creator_id", value)
@property
def vbng(self):
@@ -523,10 +583,10 @@
@property
def ssh_command(self):
- if self.sliver:
- return self.sliver.get_ssh_command()
+ if self.instance:
+ return self.instance.get_ssh_command()
else:
- return "no-sliver"
+ return "no-instance"
@ssh_command.setter
def ssh_command(self, value):
@@ -534,11 +594,11 @@
@property
def addresses(self):
- if not self.sliver:
+ if not self.instance:
return {}
addresses = {}
- for ns in self.sliver.ports.all():
+ for ns in self.instance.ports.all():
if "lan" in ns.network.name.lower():
addresses["lan"] = (ns.ip, ns.mac)
elif "wan" in ns.network.name.lower():
@@ -599,6 +659,53 @@
def is_synced(self, value):
pass
+ def pick_node(self):
+ nodes = list(Node.objects.all())
+ # TODO: logic to filter nodes by which nodes are up, and which
+ # nodes the slice can instantiate on.
+ nodes = sorted(nodes, key=lambda node: node.instances.all().count())
+ return nodes[0]
+
+ def manage_instance(self):
+ # Each VCPE object owns exactly one instance.
+
+ if self.deleted:
+ return
+
+ if (self.instance is not None) and (self.instance.image != self.image):
+ self.instance.delete()
+ self.instance = None
+
+ if self.instance is None:
+ if not self.provider_service.slices.count():
+ raise XOSConfigurationError("The VCPE service has no slices")
+
+ flavors = Flavor.objects.filter(name="m1.small")
+ if not flavors:
+ raise XOSConfigurationError("No m1.small flavor")
+
+ node =self.pick_node()
+ instance = Instance(slice = self.provider_service.slices.all()[0],
+ node = node,
+ image = self.image,
+ creator = self.creator,
+ deployment = node.site_deployment.deployment,
+ flavor = flavors[0])
+ instance.save()
+
+ try:
+ self.instance = instance
+ super(VCPETenant, self).save()
+ except:
+ instance.delete()
+ raise
+
+ def cleanup_instance(self):
+ if self.instance:
+ # print "XXX cleanup instance", self.instance
+ self.instance.delete()
+ self.instance = None
+
def manage_vbng(self):
# Each vCPE object owns exactly one vBNG object
@@ -628,11 +735,11 @@
# print "XXX clean up orphaned vbng", vbng
vbng.delete()
- if self.orig_sliver_id and (self.orig_sliver_id != self.get_attribute("sliver_id")):
- slivers=Sliver.objects.filter(id=self.orig_sliver_id)
- if slivers:
- # print "XXX clean up orphaned sliver", slivers[0]
- slivers[0].delete()
+ if self.orig_instance_id and (self.orig_instance_id != self.get_attribute("instance_id")):
+ instances=Instance.objects.filter(id=self.orig_instance_id)
+ if instances:
+ # print "XXX clean up orphaned instance", instances[0]
+ instances[0].delete()
def manage_bbs_account(self):
if self.deleted:
@@ -660,7 +767,7 @@
super(VCPETenant, self).save(*args, **kwargs)
model_policy_vcpe(self.pk)
- #self.manage_sliver()
+ #self.manage_instance()
#self.manage_vbng()
#self.manage_bbs_account()
#self.cleanup_orphans()
diff --git a/xos/core/admin.py b/xos/core/admin.py
index 6676995..d9f285b 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -402,47 +402,80 @@
def queryset(self, request):
return Tag.select_by_user(request.user)
-class SliverInline(XOSTabularInline):
- model = Sliver
+class NetworkLookerUpper:
+ """ This is a callable that looks up a network name in a instance and returns
+ the ip address for that network.
+ """
+
+ byNetworkName = {} # class variable
+
+ def __init__(self, name):
+ self.short_description = name
+ self.__name__ = name
+ self.network_name = name
+
+ def __call__(self, obj):
+ if obj is not None:
+ for nbs in obj.networkinstance_set.all():
+ if (nbs.network.name == self.network_name):
+ return nbs.ip
+ return ""
+
+ def __str__(self):
+ return self.network_name
+
+ @staticmethod
+ def get(network_name):
+ """ We want to make sure we alwars return the same NetworkLookerUpper
+ because sometimes django will cause them to be instantiated multiple
+ times (and we don't want different ones in form.fields vs
+ InstanceInline.readonly_fields).
+ """
+ if network_name not in NetworkLookerUpper.byNetworkName:
+ NetworkLookerUpper.byNetworkName[network_name] = NetworkLookerUpper(network_name)
+ return NetworkLookerUpper.byNetworkName[network_name]
+
+class InstanceInline(XOSTabularInline):
+ model = Instance
fields = ['backend_status_icon', 'all_ips_string', 'instance_id', 'instance_name', 'slice', 'deployment', 'flavor', 'image', 'node', 'no_sync']
extra = 0
readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_id', 'instance_name']
- suit_classes = 'suit-tab suit-tab-slivers'
+ suit_classes = 'suit-tab suit-tab-instances'
def queryset(self, request):
- return Sliver.select_by_user(request.user)
+ return Instance.select_by_user(request.user)
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
if db_field.name == 'deployment':
kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(sitedeployments__nodes__isnull=False).distinct()
- kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_deployment_changed(this);"})
+ kwargs['widget'] = forms.Select(attrs={'onChange': "instance_deployment_changed(this);"})
if db_field.name == 'flavor':
- kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_flavor_changed(this);"})
+ kwargs['widget'] = forms.Select(attrs={'onChange': "instance_flavor_changed(this);"})
- field = super(SliverInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
+ field = super(InstanceInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
return field
-class CordSliverInline(XOSTabularInline):
- model = Sliver
+class CordInstanceInline(XOSTabularInline):
+ model = Instance
fields = ['backend_status_icon', 'all_ips_string', 'instance_id', 'instance_name', 'slice', 'flavor', 'image', 'node']
extra = 0
readonly_fields = ['backend_status_icon', 'all_ips_string', 'instance_id', 'instance_name']
- suit_classes = 'suit-tab suit-tab-slivers'
+ suit_classes = 'suit-tab suit-tab-instances'
def queryset(self, request):
- return Sliver.select_by_user(request.user)
+ return Instance.select_by_user(request.user)
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
if db_field.name == 'deployment':
kwargs['queryset'] = Deployment.select_by_acl(request.user).filter(sitedeployments__nodes__isnull=False).distinct()
- kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_deployment_changed(this);"})
+ kwargs['widget'] = forms.Select(attrs={'onChange': "instance_deployment_changed(this);"})
if db_field.name == 'flavor':
- kwargs['widget'] = forms.Select(attrs={'onChange': "sliver_flavor_changed(this);"})
+ kwargs['widget'] = forms.Select(attrs={'onChange': "instance_flavor_changed(this);"})
- field = super(CordSliverInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
+ field = super(CordInstanceInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
return field
@@ -932,7 +965,7 @@
# hide MyInline in the add view
if obj is None:
continue
- if isinstance(inline, SliverInline):
+ if isinstance(inline, InstanceInline):
inline.model.caller = request.user
yield inline.get_formset(request, obj)
@@ -1033,12 +1066,12 @@
class SliceAdmin(XOSBaseAdmin):
form = SliceForm
- fieldList = ['backend_status_text', 'site', 'name', 'serviceClass', 'enabled','description', 'service', 'slice_url', 'max_slivers']
+ fieldList = ['backend_status_text', 'site', 'name', 'serviceClass', 'enabled','description', 'service', 'slice_url', 'max_instances']
fieldsets = [('Slice Details', {'fields': fieldList, 'classes':['suit-tab suit-tab-general']}),]
readonly_fields = ('backend_status_text', )
- list_display = ('backend_status_icon', 'name', 'site','serviceClass', 'slice_url', 'max_slivers')
+ list_display = ('backend_status_icon', 'name', 'site','serviceClass', 'slice_url', 'max_instances')
list_display_links = ('backend_status_icon', 'name', )
- normal_inlines = [SlicePrivilegeInline, SliverInline, TagInline, ReservationInline, SliceNetworkInline]
+ normal_inlines = [SlicePrivilegeInline, InstanceInline, TagInline, ReservationInline, SliceNetworkInline]
inlines = normal_inlines
admin_inlines = [ControllerSliceInline]
@@ -1049,7 +1082,7 @@
tabs =[('general', 'Slice Details'),
('slicenetworks','Networks'),
('sliceprivileges','Privileges'),
- ('slivers','Slivers'),
+ ('instances','Instances'),
#('reservations','Reservations'),
('tags','Tags'),
]
@@ -1115,7 +1148,7 @@
# hide MyInline in the add view
if obj is None:
continue
- if isinstance(inline, SliverInline):
+ if isinstance(inline, InstanceInline):
inline.model.caller = request.user
yield inline.get_formset(request, obj)
@@ -1126,7 +1159,7 @@
# XXX this approach is better than clobbering self.inlines, so
# try to make this work post-demo.
if (obj is not None) and (obj.name == "mysite_vcpe"):
- cord_vcpe_inlines = [ SlicePrivilegeInline, CordSliverInline, TagInline, ReservationInline,SliceNetworkInline]
+ cord_vcpe_inlines = [ SlicePrivilegeInline, CordInstanceInline, TagInline, ReservationInline,SliceNetworkInline]
inlines=[]
for inline_class in cord_vcpe_inlines:
@@ -1183,9 +1216,9 @@
]
readonly_fields = ('backend_status_text', )
- suit_form_tabs =(('general','Image Details'),('slivers','Slivers'),('imagedeployments','Deployments'), ('controllerimages', 'Controllers'))
+ suit_form_tabs =(('general','Image Details'),('instances','Instances'),('imagedeployments','Deployments'), ('controllerimages', 'Controllers'))
- inlines = [SliverInline, ControllerImagesInline]
+ inlines = [InstanceInline, ControllerImagesInline]
user_readonly_fields = ['name', 'disk_format', 'container_format']
@@ -1205,22 +1238,22 @@
list_display_links = ('backend_status_icon', 'name', )
list_filter = ('site_deployment',)
- inlines = [TagInline,SliverInline]
+ inlines = [TagInline,InstanceInline]
fieldsets = [('Node Details', {'fields': ['backend_status_text', 'name','site_deployment'], 'classes':['suit-tab suit-tab-details']})]
readonly_fields = ('backend_status_text', )
user_readonly_fields = ['name','site_deployment']
- user_readonly_inlines = [TagInline,SliverInline]
+ user_readonly_inlines = [TagInline,InstanceInline]
- suit_form_tabs =(('details','Node Details'),('slivers','Slivers'))
+ suit_form_tabs =(('details','Node Details'),('instances','Instances'))
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'site':
kwargs['queryset'] = Site.select_by_user(request.user).filter(hosts_nodes=True)
-class SliverForm(forms.ModelForm):
+class InstanceForm(forms.ModelForm):
class Meta:
- model = Sliver
+ model = Instance
ip = forms.CharField(widget=PlainTextWidget)
instance_name = forms.CharField(widget=PlainTextWidget)
widgets = {
@@ -1239,8 +1272,8 @@
user_readonly_fields = ['service', 'name', 'value', 'content_type', 'content_object',]
user_readonly_inlines = []
-class SliverPortInline(XOSTabularInline):
- fields = ['backend_status_icon', 'network', 'sliver', 'ip', 'mac']
+class InstancePortInline(XOSTabularInline):
+ fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']
readonly_fields = ("backend_status_icon", "ip", "mac")
model = Port
selflink_fieldname = "network"
@@ -1249,16 +1282,16 @@
verbose_name = "Port"
suit_classes = 'suit-tab suit-tab-ports'
-class SliverAdmin(XOSBaseAdmin):
- form = SliverForm
+class InstanceAdmin(XOSBaseAdmin):
+ form = InstanceForm
fieldsets = [
- ('Sliver Details', {'fields': ['backend_status_text', 'slice', 'deployment', 'node', 'all_ips_string', 'instance_id', 'instance_name', 'flavor', 'image', 'ssh_command', 'no_sync'], 'classes': ['suit-tab suit-tab-general'], })
+ ('Instance Details', {'fields': ['backend_status_text', 'slice', 'deployment', 'node', 'all_ips_string', 'instance_id', 'instance_name', 'flavor', 'image', 'ssh_command', 'no_sync'], 'classes': ['suit-tab suit-tab-general'], })
]
readonly_fields = ('backend_status_text', 'ssh_command', 'all_ips_string')
list_display = ['backend_status_icon', 'all_ips_string', 'instance_id', 'instance_name', 'slice', 'flavor', 'image', 'node', 'deployment']
list_display_links = ('backend_status_icon', 'all_ips_string', 'instance_id', )
- suit_form_tabs =(('general', 'Sliver Details'), ('ports', 'Ports'))
+ suit_form_tabs =(('general', 'Instance Details'), ('ports', 'Ports'))
inlines = [TagInline, SliverPortInline]
@@ -1275,12 +1308,12 @@
if db_field.name == 'slice':
kwargs['queryset'] = Slice.select_by_user(request.user)
- return super(SliverAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
+ return super(InstanceAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
def queryset(self, request):
- # admins can see all slivers. Users can only see slivers of
+ # admins can see all instances. Users can only see instances of
# the slices they belong to.
- return Sliver.select_by_user(request.user)
+ return Instance.select_by_user(request.user)
def get_formsets(self, request, obj=None):
@@ -1294,7 +1327,7 @@
# hide MyInline in the add view
if obj is None:
continue
- if isinstance(inline, SliverInline):
+ if isinstance(inline, InstanceInline):
inline.model.caller = request.user
yield inline.get_formset(request, obj)
@@ -1515,8 +1548,8 @@
field.initial = field.queryset.all()[0]
else:
field.queryset = field.queryset.none()
- elif db_field.name == 'sliver':
- # restrict slivers to those that belong to the slice
+ elif db_field.name == 'instance':
+ # restrict instances to those that belong to the slice
if request._slice is not None:
field.queryset = field.queryset.filter(slice = request._slice)
else:
@@ -1668,10 +1701,10 @@
readonly_fields = ('backend_status_icon', )
class NetworkPortInline(XOSTabularInline):
- fields = ['backend_status_icon', 'network', 'sliver', 'ip', 'mac']
+ fields = ['backend_status_icon', 'network', 'instance', 'ip', 'mac']
readonly_fields = ("backend_status_icon", "ip", "mac")
model = Port
- selflink_fieldname = "sliver"
+ selflink_fieldname = "instance"
extra = 0
verbose_name_plural = "Ports"
verbose_name = "Port"
@@ -1708,7 +1741,6 @@
list_display = ("backend_status_icon", "name", "subnet", "ports", "labels")
list_display_links = ('backend_status_icon', 'name', )
readonly_fields = ("subnet", )
-
inlines = [NetworkParameterInline, NetworkPortInline, NetworkSlicesInline, RouterInline]
admin_inlines = [ControllerNetworkInline]
@@ -1959,7 +1991,7 @@
admin.site.register(Node, NodeAdmin)
#admin.site.register(SlicePrivilege, SlicePrivilegeAdmin)
#admin.site.register(SitePrivilege, SitePrivilegeAdmin)
- admin.site.register(Sliver, SliverAdmin)
+ admin.site.register(Instance, InstanceAdmin)
admin.site.register(Image, ImageAdmin)
admin.site.register(DashboardView, DashboardViewAdmin)
admin.site.register(Flavor, FlavorAdmin)
diff --git a/xos/core/api/slivers.py b/xos/core/api/instances.py
similarity index 64%
rename from xos/core/api/slivers.py
rename to xos/core/api/instances.py
index 2ce24c7..92e928c 100644
--- a/xos/core/api/slivers.py
+++ b/xos/core/api/instances.py
@@ -1,26 +1,26 @@
from types import StringTypes
from django.contrib.auth import authenticate
from openstack.manager import OpenStackManager
-from core.models import Sliver, Slice
+from core.models import Instance, Slice
from core.api.images import _get_images
from core.api.slices import _get_slices
from core.api.deployment_networks import _get_deployment_networks
from core.api.nodes import _get_nodes
-def _get_slivers(filter):
+def _get_instances(filter):
if isinstance(filter, StringTypes) and filter.isdigit():
filter = int(filter)
if isinstance(filter, int):
- slivers = Sliver.objects.filter(id=filter)
+ instances = Instance.objects.filter(id=filter)
elif isinstance(filter, StringTypes):
- slivers = Sliver.objects.filter(name=filter)
+ instances = Instance.objects.filter(name=filter)
elif isinstance(filter, dict):
- slivers = Sliver.objects.filter(**filter)
+ instances = Instance.objects.filter(**filter)
else:
- slivers = []
- return slivers
+ instances = []
+ return instances
-def add_sliver(auth, fields):
+def add_instance(auth, fields):
user = authenticate(username=auth.get('username'),
password=auth.get('password'))
@@ -33,33 +33,33 @@
if deployment_networks: fields['deploymentNetwork'] = deployment_networks[0]
if nodes: fields['node'] = nodes[0]
- sliver = Sliver(**fields)
- auth['tenant'] = sliver.slice.name
- sliver.os_manager = OpenStackManager(auth=auth, caller = user)
- sliver.save()
- return sliver
+ instance = Instance(**fields)
+ auth['tenant'] = instance.slice.name
+ instance.os_manager = OpenStackManager(auth=auth, caller = user)
+ instance.save()
+ return instance
-def update_sliver(auth, sliver, **fields):
+def update_instance(auth, instance, **fields):
return
-def delete_sliver(auth, filter={}):
+def delete_instance(auth, filter={}):
user = authenticate(username=auth.get('username'),
password=auth.get('password'))
- slivers = _get_slivers(filter)
- for sliver in slivers:
- auth['tenant'] = sliver.slice.name
+ instances = _get_instances(filter)
+ for instance in instances:
+ auth['tenant'] = instance.slice.name
slice.os_manager = OpenStackManager(auth=auth, caller = user)
- sliver.delete()
+ instance.delete()
return 1
-def get_slivers(auth, filter={}):
+def get_instances(auth, filter={}):
user = authenticate(username=auth.get('username'),
password=auth.get('password'))
if 'slice' in filter:
slices = _get_slices(filter.get('slice'))
if slices: filter['slice'] = slices[0]
- slivers = _get_slivers(filter)
- return slivers
+ instances = _get_instances(filter)
+ return instances
diff --git a/xos/core/api_root.py b/xos/core/api_root.py
index 4ac267a..c3d69f1 100644
--- a/xos/core/api_root.py
+++ b/xos/core/api_root.py
@@ -15,7 +15,7 @@
'serviceresources': reverse('serviceresource-list', request=request, format=format),
'sites': reverse('site-list', request=request, format=format),
'slices': reverse('slice-list', request=request, format=format),
- 'slivers': reverse('sliver-list', request=request, format=format),
+ 'instances': reverse('instance-list', request=request, format=format),
'tags': reverse('tag-list', request=request, format=format),
'users': reverse('user-list', request=request, format=format),
})
diff --git a/xos/core/dashboard/sites.py b/xos/core/dashboard/sites.py
index b77a096..de100af 100644
--- a/xos/core/dashboard/sites.py
+++ b/xos/core/dashboard/sites.py
@@ -14,7 +14,7 @@
from django.conf.urls import patterns, url
from views import DashboardCustomize, DashboardDynamicView, SimulatorView, LoggedInView, \
DashboardUserSiteView, \
- TenantViewData, TenantCreateSlice, TenantAddUser,TenantAddOrRemoveSliverView, TenantPickSitesView, TenantDeleteSliceView, \
+ TenantViewData, TenantCreateSlice, TenantAddUser,TenantAddOrRemoveInstanceView, TenantPickSitesView, TenantDeleteSliceView, \
TenantUpdateSlice, DashboardSliceInteractions, RequestAccessView
from views import view_urls
@@ -46,8 +46,8 @@
name="welcome"),
url(r'^simulator/', self.admin_view(SimulatorView.as_view()),
name="simulator"),
- url(r'^tenantaddorremsliver/$', self.admin_view(TenantAddOrRemoveSliverView.as_view()),
- name="tenantaddorremsliver"),
+ url(r'^tenantaddorreminstance/$', self.admin_view(TenantAddOrRemoveInstanceView.as_view()),
+ name="tenantaddorreminstance"),
url(r'^tenantview/$', self.admin_view(TenantViewData.as_view()),
name="tenantview"),
url(r'^createnewslice/$', self.admin_view(TenantCreateSlice.as_view()),
diff --git a/xos/core/dashboard/views/__init__.py b/xos/core/dashboard/views/__init__.py
index bbe403b..8c693c8 100644
--- a/xos/core/dashboard/views/__init__.py
+++ b/xos/core/dashboard/views/__init__.py
@@ -1,7 +1,7 @@
#from home import DashboardWelcomeView, DashboardDynamicView
-#from tenant import TenantCreateSlice, TenantUpdateSlice, TenantDeleteSliceView, TenantAddOrRemoveSliverView, TenantPickSitesView, TenantViewData
+#from tenant import TenantCreateSlice, TenantUpdateSlice, TenantDeleteSliceView, TenantAddOrRemoveInstanceView, TenantPickSitesView, TenantViewData
#from simulator import SimulatorView
-#from cdn import DashboardSummaryAjaxView, DashboardAddOrRemoveSliverView, DashboardAjaxView
+#from cdn import DashboardSummaryAjaxView, DashboardAddOrRemoveInstanceView, DashboardAjaxView
#from analytics import DashboardAnalyticsAjaxView
#from customize import DashboardCustomize
#from interactions import DashboardSliceInteractions
diff --git a/xos/core/dashboard/views/download_ssh_commands.py b/xos/core/dashboard/views/download_ssh_commands.py
index 96d1393..92bcac4 100644
--- a/xos/core/dashboard/views/download_ssh_commands.py
+++ b/xos/core/dashboard/views/download_ssh_commands.py
@@ -9,8 +9,8 @@
def get(self, request, sliceid=None, **kwargs):
#slice = Slices.objects.get(id=sliceid);
- #for sliver in slice.slivers.all():
- # if (sliver.instance_id && sliver.instance_name):
+ #for instance in slice.instances.all():
+ # if (instance.instance_id && instance.instance_name):
slice = SlicePlus.objects.get(id=sliceid)
diff --git a/xos/core/dashboard/views/interactions.py b/xos/core/dashboard/views/interactions.py
index 89bc766..f74d01e 100644
--- a/xos/core/dashboard/views/interactions.py
+++ b/xos/core/dashboard/views/interactions.py
@@ -28,11 +28,11 @@
elif name=="sites":
result["title"] = "Slice interactions by site ownership"
result["objectName"] = "sites"
- elif name=="sliver_sites":
- result["title"] = "Slice interactions by sliver sites"
+ elif name=="instance_sites":
+ result["title"] = "Slice interactions by instance sites"
result["objectName"] = "sites"
- elif name=="sliver_nodes":
- result["title"] = "Slice interactions by sliver nodes"
+ elif name=="instance_nodes":
+ result["title"] = "Slice interactions by instance nodes"
result["objectName"] = "nodes"
return HttpResponse(json.dumps(result), content_type='application/javascript')
@@ -83,12 +83,12 @@
ids.append(sp.network.id)
elif name=="sites":
ids = [slice.site.id]
- elif name=="sliver_sites":
- for sp in slice.slivers.all():
+ elif name=="instance_sites":
+ for sp in slice.instances.all():
if sp.node.site.id not in ids:
ids.append(sp.node.site.id)
- elif name=="sliver_nodes":
- for sp in slice.slivers.all():
+ elif name=="instance_nodes":
+ for sp in slice.instances.all():
if sp.node.id not in ids:
ids.append(sp.node.id)
return ids
diff --git a/xos/core/dashboard/views/shell.py b/xos/core/dashboard/views/shell.py
index e852b16..c49133b 100644
--- a/xos/core/dashboard/views/shell.py
+++ b/xos/core/dashboard/views/shell.py
@@ -20,20 +20,20 @@
d2[k] = v
return d2
-def sliver_to_dict(sliver):
- d = model_to_dict(sliver)
- d["slice_id"] = sliver.slice.id
- d["node_id"] = sliver.node.id
+def instance_to_dict(instance):
+ d = model_to_dict(instance)
+ d["slice_id"] = instance.slice.id
+ d["node_id"] = instance.node.id
return d
def slice_to_dict(slice):
d = model_to_dict(slice)
- d["slivers"] = [sliver_to_dict(x) for x in slice.slivers]
+ d["instances"] = [instance_to_dict(x) for x in slice.instances]
return d
def node_to_dict(node):
d = model_to_dict(node)
- d["slivers"] = []
+ d["instances"] = []
class OpenCloudData:
@@ -43,7 +43,7 @@
def loadAll(self):
self.allNodes = list(Node.objects.all())
self.allSlices = list(Slice.objects.all())
- self.allSlivers = list(Sliver.objects.all())
+ self.allInstances = list(Instance.objects.all())
self.allSites = list(Site.objects.all())
self.site_id = {}
@@ -56,29 +56,29 @@
self.node_id = {}
for node in self.allNodes:
d = model_to_dict(node)
- d["sliver_ids"] = []
+ d["instance_ids"] = []
self.node_id[node.id] = ensure_serializable(d)
self.site_id[node.site_id]["node_ids"].append(node.id)
self.slice_id = {}
for slice in self.allSlices:
d = model_to_dict(slice)
- d["sliver_ids"] = []
+ d["instance_ids"] = []
self.slice_id[slice.id] = ensure_serializable(d)
self.site_id[slice.site_id]["slice_ids"].append(site.id)
print self.slice_id.keys()
- self.sliver_id = {}
- for sliver in self.allSlivers:
- self.sliver_id[sliver.id] = model_to_dict(sliver)
+ self.instance_id = {}
+ for instance in self.allInstances:
+ self.instance_id[instance.id] = model_to_dict(instance)
- self.slice_id[sliver.slice_id]["sliver_ids"].append(sliver.id)
- self.node_id[sliver.node_id]["sliver_ids"].append(sliver.id)
+ self.slice_id[instance.slice_id]["instance_ids"].append(instance.id)
+ self.node_id[instance.node_id]["instance_ids"].append(instance.id)
def get_opencloud_data(self):
return {"slices": self.slice_id.values(),
- "slivers": self.sliver_id.values(),
+ "instances": self.instance_id.values(),
"nodes": self.node_id.values(),
"sites": self.site_id.values()}
diff --git a/xos/core/dashboard/views/tenant.py b/xos/core/dashboard/views/tenant.py
index 951efc2..6fbc4d6 100644
--- a/xos/core/dashboard/views/tenant.py
+++ b/xos/core/dashboard/views/tenant.py
@@ -201,21 +201,21 @@
preferredImage = entry.image_preference
#sliceDataSet = entry.mount_data_sets
sliceNetwork = {}
- numSliver = 0
+ numInstance = 0
sliceImage=""
sliceSite = {}
sliceNode = {}
sliceInstance= {}
#createPrivateVolume(user,sliceName)
available_sites = getAvailableSites()
- for sliver in slice.slivers.all():
- if sliver.node.site.name in available_sites:
- sliceSite[sliver.node.site.name] = sliceSite.get(sliver.node.site.name,0) + 1
- sliceImage = sliver.image.name
- sliceNode[str(sliver)] = sliver.node.name
- numSliver = sum(sliceSite.values())
+ for instance in slice.instances.all():
+ if instance.node.site.name in available_sites:
+ sliceSite[instance.node.site.name] = sliceSite.get(instance.node.site.name,0) + 1
+ sliceImage = instance.image.name
+ sliceNode[str(instance)] = instance.node.name
+ numInstance = sum(sliceSite.values())
numSites = len(sliceSite)
- userSliceInfo.append({'sliceName': sliceName,'sliceServiceClass': sliceServiceClass,'preferredImage':preferredImage,'numOfSites':numSites, 'sliceSite':sliceSite,'sliceImage':sliceImage,'numOfSlivers':numSliver,'instanceNodePair':sliceNode})
+ userSliceInfo.append({'sliceName': sliceName,'sliceServiceClass': sliceServiceClass,'preferredImage':preferredImage,'numOfSites':numSites, 'sliceSite':sliceSite,'sliceImage':sliceImage,'numOfInstances':numInstance,'instanceNodePair':sliceNode})
return userSliceInfo
def getTenantSitesInfo():
@@ -344,14 +344,14 @@
sliceToDel.delete()
return HttpResponse(json.dumps("Slice deleted"), content_type='application/javascript')
-class TenantAddOrRemoveSliverView(View):
- """ Add or remove slivers from a Slice
+class TenantAddOrRemoveInstanceView(View):
+ """ Add or remove instances from a Slice
Arguments:
siteName - name of site. If not specified, XOS will pick the
best site.,
actionToDo - [add | rem]
- count - number of slivers to add or remove
+ count - number of instances to add or remove
sliceName - name of slice
noAct - if set, no changes will be made to db, but result will still
show which sites would have been modified.
@@ -384,9 +384,9 @@
if (siteList is None):
siteList = tenant_pick_sites(user, user_ip, slice, count)
- sitesChanged = slice_increase_slivers(request.user, user_ip, siteList, slice, image, count, noAct)
+ sitesChanged = slice_increase_instances(request.user, user_ip, siteList, slice, image, count, noAct)
elif (actionToDo == "rem"):
- sitesChanged = slice_decrease_slivers(request.user, siteList, slice, count, noAct)
+ sitesChanged = slice_decrease_instances(request.user, siteList, slice, count, noAct)
else:
return HttpResponseServerError("Unknown actionToDo %s" % actionToDo)
@@ -411,16 +411,16 @@
def siteSortKey(site, slice=None, count=None, lat=None, lon=None):
# try to pick a site we're already using
- has_slivers_here=False
+ has_instances_here=False
if slice:
- for sliver in slice.slivers.all():
- if sliver.node.site.name == site.name:
- has_slivers_here=True
+ for instance in slice.instances.all():
+ if instance.node.site.name == site.name:
+ has_instances_here=True
# Haversine method
d = haversine(site.location.latitude, site.location.longitude, lat, lon)
- return (-has_slivers_here, d)
+ return (-has_instances_here, d)
def tenant_pick_sites(user, user_ip=None, slice=None, count=None):
""" Returns list of sites, sorted from most favorable to least favorable """
diff --git a/xos/core/dashboard/views/view_common.py b/xos/core/dashboard/views/view_common.py
index 37da7cf..0ef422e 100644
--- a/xos/core/dashboard/views/view_common.py
+++ b/xos/core/dashboard/views/view_common.py
@@ -66,67 +66,67 @@
continue
slice = slice[0]
slicename = slice.name
- sliverList=Sliver.objects.all()
+ instanceList=Instance.objects.all()
sites_used = {}
- for sliver in slice.slivers.all():
- #sites_used['deploymentSites'] = sliver.node.deployment.name
- # sites_used[sliver.image.name] = sliver.image.name
- sites_used[sliver.node.site_deployment.site] = 1 #sliver.numberCores
+ for instance in slice.instances.all():
+ #sites_used['deploymentSites'] = instance.node.deployment.name
+ # sites_used[instance.image.name] = instance.image.name
+ sites_used[instance.node.site_deployment.site] = 1 #instance.numberCores
sliceid = Slice.objects.get(id=entry.slice.id).id
try:
- sliverList = Sliver.objects.filter(slice=entry.slice.id)
+ instanceList = Instance.objects.filter(slice=entry.slice.id)
siteList = {}
- for x in sliverList:
+ for x in instanceList:
if x.node.site_deployment.site not in siteList:
siteList[x.node.site_deployment.site] = 1
- slivercount = len(sliverList)
+ instancecount = len(instanceList)
sitecount = len(siteList)
except:
traceback.print_exc()
- slivercount = 0
+ instancecount = 0
sitecount = 0
userSliceInfo.append({'slicename': slicename, 'sliceid':sliceid,
'sitesUsed':sites_used,
'role': SliceRole.objects.get(id=entry.role.id).role,
- 'slivercount': slivercount,
+ 'instancecount': instancecount,
'sitecount':sitecount})
return userSliceInfo
-def slice_increase_slivers(user, user_ip, siteList, slice, image, count, noAct=False):
+def slice_increase_instances(user, user_ip, siteList, slice, image, count, noAct=False):
sitesChanged = {}
- # let's compute how many slivers are in use in each node of each site
+ # let's compute how many instances are in use in each node of each site
for site in siteList:
site.nodeList = list(site.nodes.all())
for node in site.nodeList:
- node.sliverCount = 0
- for sliver in node.slivers.all():
- if sliver.slice.id == slice.id:
- node.sliverCount = node.sliverCount + 1
+ node.instanceCount = 0
+ for instance in node.instances.all():
+ if instance.slice.id == slice.id:
+ node.instanceCount = node.instanceCount + 1
- # Allocate slivers to nodes
- # for now, assume we want to allocate all slivers from the same site
+ # Allocate instances to nodes
+ # for now, assume we want to allocate all instances from the same site
nodes = siteList[0].nodeList
while (count>0):
- # Sort the node list by number of slivers per node, then pick the
- # node with the least number of slivers.
- nodes = sorted(nodes, key=attrgetter("sliverCount"))
+ # Sort the node list by number of instances per node, then pick the
+ # node with the least number of instances.
+ nodes = sorted(nodes, key=attrgetter("instanceCount"))
node = nodes[0]
- print "adding sliver at node", node.name, "of site", node.site.name
+ print "adding instance at node", node.name, "of site", node.site.name
if not noAct:
- sliver = Sliver(name=node.name,
+ instance = Instance(name=node.name,
slice=slice,
node=node,
image = image,
creator = User.objects.get(email=user),
deploymentNetwork=node.deployment)
- sliver.save()
+ instance.save()
- node.sliverCount = node.sliverCount + 1
+ node.instanceCount = node.instanceCount + 1
count = count - 1
@@ -134,20 +134,20 @@
return sitesChanged
-def slice_decrease_slivers(user, siteList, slice, count, noAct=False):
+def slice_decrease_instances(user, siteList, slice, count, noAct=False):
sitesChanged = {}
if siteList:
siteNames = [site.name for site in siteList]
else:
siteNames = None
- for sliver in list(slice.slivers.all()):
+ for instance in list(slice.instances.all()):
if count>0:
- if(not siteNames) or (sliver.node.site.name in siteNames):
- sliver.delete()
- print "deleting sliver",sliver.name,"at node",sliver.node.name
+ if(not siteNames) or (instance.node.site.name in siteNames):
+ instance.delete()
+ print "deleting instance",instance.name,"at node",instance.node.name
count=count-1
- sitesChanged[sliver.node.site.name] = sitesChanged.get(sliver.node.site.name,0) - 1
+ sitesChanged[instance.node.site.name] = sitesChanged.get(instance.node.site.name,0) - 1
return sitesChanged
diff --git a/xos/core/migrations/0001_initial.py b/xos/core/migrations/0001_initial.py
index fe34224..db7dad0 100644
--- a/xos/core/migrations/0001_initial.py
+++ b/xos/core/migrations/0001_initial.py
@@ -3,7 +3,7 @@
from django.db import models, migrations
import timezones.fields
-import core.models.sliver
+import core.models.instance
import core.models.network
import geoposition.fields
import encrypted_fields.fields
@@ -528,7 +528,7 @@
bases=(models.Model,),
),
migrations.CreateModel(
- name='NetworkSliver',
+ name='NetworkInstance',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', models.DateTimeField(default=django.utils.timezone.now, auto_now_add=True)),
@@ -537,9 +537,9 @@
('policed', models.DateTimeField(default=None, null=True, blank=True)),
('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)),
('deleted', models.BooleanField(default=False)),
- ('ip', models.GenericIPAddressField(help_text=b'Sliver ip address', null=True, blank=True)),
+ ('ip', models.GenericIPAddressField(help_text=b'Instance ip address', null=True, blank=True)),
('port_id', models.CharField(help_text=b'Quantum port id', max_length=256, null=True, blank=True)),
- ('network', models.ForeignKey(related_name=b'networkslivers', to='core.Network')),
+ ('network', models.ForeignKey(related_name=b'networkinstances', to='core.Network')),
],
options={
'abstract': False,
@@ -952,7 +952,7 @@
('omf_friendly', models.BooleanField(default=False)),
('description', models.TextField(help_text=b'High level description of the slice and expected activities', max_length=1024, blank=True)),
('slice_url', models.URLField(max_length=512, blank=True)),
- ('max_slivers', models.IntegerField(default=10)),
+ ('max_instances', models.IntegerField(default=10)),
('network', models.CharField(default=b'Private Only', max_length=256, null=True, blank=True)),
('mount_data_sets', models.CharField(default=b'GenBank', max_length=256, null=True, blank=True)),
('creator', models.ForeignKey(related_name=b'slices', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
@@ -1040,7 +1040,7 @@
bases=(models.Model,),
),
migrations.CreateModel(
- name='Sliver',
+ name='Instance',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', models.DateTimeField(default=django.utils.timezone.now, auto_now_add=True)),
@@ -1051,17 +1051,17 @@
('deleted', models.BooleanField(default=False)),
('instance_id', models.CharField(help_text=b'Nova instance id', max_length=200, null=True, blank=True)),
('instance_uuid', models.CharField(help_text=b'Nova instance uuid', max_length=200, null=True, blank=True)),
- ('name', models.CharField(help_text=b'Sliver name', max_length=200)),
+ ('name', models.CharField(help_text=b'Instance name', max_length=200)),
('instance_name', models.CharField(help_text=b'OpenStack generated name', max_length=200, null=True, blank=True)),
- ('ip', models.GenericIPAddressField(help_text=b'Sliver ip address', null=True, blank=True)),
- ('numberCores', models.IntegerField(default=0, help_text=b'Number of cores for sliver', verbose_name=b'Number of Cores')),
+ ('ip', models.GenericIPAddressField(help_text=b'Instance ip address', null=True, blank=True)),
+ ('numberCores', models.IntegerField(default=0, help_text=b'Number of cores for instance', verbose_name=b'Number of Cores')),
('userData', models.TextField(help_text=b'user_data passed to instance during creation', null=True, blank=True)),
- ('creator', models.ForeignKey(related_name=b'slivers', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
- ('deployment', models.ForeignKey(related_name=b'sliver_deployment', verbose_name=b'deployment', to='core.Deployment')),
- ('flavor', models.ForeignKey(default=core.models.sliver.get_default_flavor, to='core.Flavor', help_text=b'Flavor of this instance')),
- ('image', models.ForeignKey(related_name=b'slivers', to='core.Image')),
- ('node', models.ForeignKey(related_name=b'slivers', to='core.Node')),
- ('slice', models.ForeignKey(related_name=b'slivers', to='core.Slice')),
+ ('creator', models.ForeignKey(related_name=b'instances', blank=True, to=settings.AUTH_USER_MODEL, null=True)),
+ ('deployment', models.ForeignKey(related_name=b'instance_deployment', verbose_name=b'deployment', to='core.Deployment')),
+ ('flavor', models.ForeignKey(default=core.models.instance.get_default_flavor, to='core.Flavor', help_text=b'Flavor of this instance')),
+ ('image', models.ForeignKey(related_name=b'instances', to='core.Image')),
+ ('node', models.ForeignKey(related_name=b'instances', to='core.Node')),
+ ('slice', models.ForeignKey(related_name=b'instances', to='core.Slice')),
],
options={
'abstract': False,
@@ -1207,8 +1207,8 @@
),
migrations.AddField(
model_name='reservedresource',
- name='sliver',
- field=models.ForeignKey(related_name=b'reservedresources', to='core.Sliver'),
+ name='instance',
+ field=models.ForeignKey(related_name=b'reservedresources', to='core.Instance'),
preserve_default=True,
),
migrations.AddField(
@@ -1242,9 +1242,9 @@
preserve_default=True,
),
migrations.AddField(
- model_name='networksliver',
- name='sliver',
- field=models.ForeignKey(related_name=b'networkslivers', to='core.Sliver'),
+ model_name='networkinstance',
+ name='instance',
+ field=models.ForeignKey(related_name=b'networkinstances', to='core.Instance'),
preserve_default=True,
),
migrations.AddField(
@@ -1279,8 +1279,8 @@
),
migrations.AddField(
model_name='network',
- name='slivers',
- field=models.ManyToManyField(related_name=b'networks', through='core.NetworkSliver', to='core.Sliver', blank=True),
+ name='instances',
+ field=models.ManyToManyField(related_name=b'networks', through='core.NetworkInstance', to='core.Instance', blank=True),
preserve_default=True,
),
migrations.AddField(
diff --git a/xos/core/migrations/0011_sliver_instance_uuid.py b/xos/core/migrations/0011_sliver_instance_uuid.py
index dd8d05c..3320158 100644
--- a/xos/core/migrations/0011_sliver_instance_uuid.py
+++ b/xos/core/migrations/0011_sliver_instance_uuid.py
@@ -12,7 +12,7 @@
operations = [
migrations.AddField(
- model_name='sliver',
+ model_name='instance',
name='instance_uuid',
field=models.CharField(help_text=b'Nova instance uuid', max_length=200, null=True, blank=True),
preserve_default=True,
diff --git a/xos/core/models/__init__.py b/xos/core/models/__init__.py
index d48dc46..0efe37b 100644
--- a/xos/core/models/__init__.py
+++ b/xos/core/models/__init__.py
@@ -23,10 +23,10 @@
from .site import SitePrivilege
from .node import Node
from .slicetag import SliceTag
-from .sliver import Sliver
+from .instance import Instance
from .reservation import ReservedResource
from .reservation import Reservation
-from .network import Network, NetworkParameterType, NetworkParameter, NetworkSliver, Port, NetworkTemplate, Router, NetworkSlice, ControllerNetwork
+from .network import Network, NetworkParameterType, NetworkParameter, NetworkInstance, Port, NetworkTemplate, Router, NetworkSlice, ControllerNetwork
from .billing import Account, Invoice, Charge, UsableObject, Payment
from .program import Program
diff --git a/xos/core/models/billing.py b/xos/core/models/billing.py
index 765e42f..6e517b4 100644
--- a/xos/core/models/billing.py
+++ b/xos/core/models/billing.py
@@ -2,7 +2,7 @@
import os
import socket
from django.db import models
-from core.models import PlCoreBase, Site, Slice, Sliver, Deployment
+from core.models import PlCoreBase, Site, Slice, Instance, Deployment
from core.models.plcorebase import StrippedCharField
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
diff --git a/xos/core/models/sliver.py b/xos/core/models/instance.py
similarity index 80%
rename from xos/core/models/sliver.py
rename to xos/core/models/instance.py
index 4a00161..eb38ff9 100644
--- a/xos/core/models/sliver.py
+++ b/xos/core/models/instance.py
@@ -21,7 +21,7 @@
config = Config()
def get_default_flavor(controller = None):
- # Find a default flavor that can be used for a sliver. This is particularly
+ # Find a default flavor that can be used for a instance. This is particularly
# useful in evolution. It's also intended this helper function can be used
# for admin.py when users
@@ -39,9 +39,9 @@
return flavors[0]
-class SliverDeletionManager(PlCoreBaseDeletionManager):
+class InstanceDeletionManager(PlCoreBaseDeletionManager):
def get_queryset(self):
- parent=super(SliverDeletionManager, self)
+ parent=super(InstanceDeletionManager, self)
try:
backend_type = config.observer_backend_type
except AttributeError:
@@ -58,9 +58,9 @@
return self.get_queryset()
-class SliverManager(PlCoreBaseManager):
+class InstanceManager(PlCoreBaseManager):
def get_queryset(self):
- parent=super(SliverManager, self)
+ parent=super(InstanceManager, self)
try:
backend_type = config.observer_backend_type
@@ -79,21 +79,21 @@
return self.get_queryset()
# Create your models here.
-class Sliver(PlCoreBase):
- objects = SliverManager()
- deleted_objects = SliverDeletionManager()
+class Instance(PlCoreBase):
+ objects = InstanceManager()
+ deleted_objects = InstanceDeletionManager()
instance_id = StrippedCharField(null=True, blank=True, max_length=200, help_text="Nova instance id")
instance_uuid = StrippedCharField(null=True, blank=True, max_length=200, help_text="Nova instance uuid")
- name = StrippedCharField(max_length=200, help_text="Sliver name")
+ name = StrippedCharField(max_length=200, help_text="Instance name")
instance_name = StrippedCharField(blank=True, null=True, max_length=200, help_text="OpenStack generated name")
- ip = models.GenericIPAddressField(help_text="Sliver ip address", blank=True, null=True)
- image = models.ForeignKey(Image, related_name='slivers')
- #key = models.ForeignKey(Key, related_name='slivers')
- creator = models.ForeignKey(User, related_name='slivers', blank=True, null=True)
- slice = models.ForeignKey(Slice, related_name='slivers')
- deployment = models.ForeignKey(Deployment, verbose_name='deployment', related_name='sliver_deployment')
- node = models.ForeignKey(Node, related_name='slivers')
- numberCores = models.IntegerField(verbose_name="Number of Cores", help_text="Number of cores for sliver", default=0)
+ ip = models.GenericIPAddressField(help_text="Instance ip address", blank=True, null=True)
+ image = models.ForeignKey(Image, related_name='instances')
+ #key = models.ForeignKey(Key, related_name='instances')
+ creator = models.ForeignKey(User, related_name='instances', blank=True, null=True)
+ slice = models.ForeignKey(Slice, related_name='instances')
+ deployment = models.ForeignKey(Deployment, verbose_name='deployment', related_name='instance_deployment')
+ node = models.ForeignKey(Node, related_name='instances')
+ numberCores = models.IntegerField(verbose_name="Number of Cores", help_text="Number of cores for instance", default=0)
flavor = models.ForeignKey(Flavor, help_text="Flavor of this instance", default=get_default_flavor)
tags = generic.GenericRelation(Tag)
userData = models.TextField(blank=True, null=True, help_text="user_data passed to instance during creation")
@@ -106,16 +106,16 @@
def __unicode__(self):
if self.name and Slice.objects.filter(id=self.slice_id) and (self.name != self.slice.name):
# NOTE: The weird check on self.slice_id was due to a problem when
- # deleting the slice before the sliver.
+ # deleting the slice before the instance.
return u'%s' % self.name
elif self.instance_name:
return u'%s' % (self.instance_name)
elif self.id:
return u'uninstantiated-%s' % str(self.id)
elif self.slice:
- return u'unsaved-sliver on %s' % self.slice.name
+ return u'unsaved-instance on %s' % self.slice.name
else:
- return u'unsaved-sliver'
+ return u'unsaved-instance'
def save(self, *args, **kwds):
if not self.name:
@@ -123,20 +123,20 @@
if not self.creator and hasattr(self, 'caller'):
self.creator = self.caller
if not self.creator:
- raise ValidationError('sliver has no creator')
+ raise ValidationError('instance has no creator')
if (self.slice.creator != self.creator):
# Check to make sure there's a slice_privilege for the user. If there
# isn't, then keystone will throw an exception inside the observer.
slice_privs = SlicePrivilege.objects.filter(slice=self.slice, user=self.creator)
if not slice_privs:
- raise ValidationError('sliver creator has no privileges on slice')
+ raise ValidationError('instance creator has no privileges on slice')
# XXX smbaker - disabled for now, was causing fault in tenant view create slice
# if not self.controllerNetwork.test_acl(slice=self.slice):
# raise exceptions.ValidationError("Deployment %s's ACL does not allow any of this slice %s's users" % (self.controllerNetwork.name, self.slice.name))
- super(Sliver, self).save(*args, **kwds)
+ super(Instance, self).save(*args, **kwds)
def can_update(self, user):
return user.can_update_slice(self.slice)
@@ -166,18 +166,18 @@
@staticmethod
def select_by_user(user):
if user.is_admin:
- qs = Sliver.objects.all()
+ qs = Instance.objects.all()
else:
slices = Slice.select_by_user(user)
- qs = Sliver.objects.filter(slice__in=slices)
+ qs = Instance.objects.filter(slice__in=slices)
return qs
def get_cpu_stats(self):
- filter = 'instance_id=%s'%self.sliver_id
+ filter = 'instance_id=%s'%self.instance_id
return monitor.get_meter('cpu',filter,None)
def get_bw_stats(self):
- filter = 'instance_id=%s'%self.sliver_id
+ filter = 'instance_id=%s'%self.instance_id
return monitor.get_meter('network.outgoing.bytes',filter,None)
def get_node_stats(self):
@@ -211,4 +211,4 @@
except:
instance.controller = None
-models.signals.post_init.connect(controller_setter, Sliver)
+models.signals.post_init.connect(controller_setter, Instance)
diff --git a/xos/core/models/network.py b/xos/core/models/network.py
index 321facd..dfda072 100644
--- a/xos/core/models/network.py
+++ b/xos/core/models/network.py
@@ -2,7 +2,7 @@
import socket
import sys
from django.db import models
-from core.models import PlCoreBase, Site, Slice, Sliver, Controller
+from core.models import PlCoreBase, Site, Slice, Instance, Controller
from core.models import ControllerLinkManager,ControllerLinkDeletionManager
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
@@ -108,7 +108,7 @@
permit_all_slices = models.BooleanField(default=False)
permitted_slices = models.ManyToManyField(Slice, blank=True, related_name="availableNetworks")
slices = models.ManyToManyField(Slice, blank=True, related_name="networks", through="NetworkSlice")
- slivers = models.ManyToManyField(Sliver, blank=True, related_name="networks", through="NetworkSliver")
+ instances = models.ManyToManyField(Instance, blank=True, related_name="networks", through="NetworkInstance")
topology_parameters = models.TextField(null=True, blank=True)
controller_url = models.CharField(null=True, blank=True, max_length=1024)
@@ -189,9 +189,9 @@
def save(self, *args, **kwds):
slice = self.slice
if (slice not in self.network.permitted_slices.all()) and (slice != self.network.owner) and (not self.network.permit_all_slices):
- # to add a sliver to the network, then one of the following must be true:
- # 1) sliver's slice is in network's permittedSlices list,
- # 2) sliver's slice is network's owner, or
+ # to add a instance to the network, then one of the following must be true:
+ # 1) instance's slice is in network's permittedSlices list,
+ # 2) instance's slice is network's owner, or
# 3) network's permitAllSlices is true
raise ValueError("Slice %s is not allowed to connect to network %s" % (str(slice), str(self.network)))
@@ -211,44 +211,44 @@
qs = NetworkSlice.objects.filter(id__in=slice_ids)
return qs
-class NetworkSliver(PlCoreBase):
+class NetworkInstance(PlCoreBase):
# Please use "Port" instead of "NetworkSliver". NetworkSliver will soon be
# removed.
- network = models.ForeignKey(Network,related_name='networkslivers') # related_name='links'
- sliver = models.ForeignKey(Sliver, null=True, blank=True, related_name='networkslivers') # related_name='ports'
- ip = models.GenericIPAddressField(help_text="Sliver ip address", blank=True, null=True)
+ network = models.ForeignKey(Network,related_name='networkinstances')
+ instance = models.ForeignKey(Instance, null=True, blank=True, related_name='networkinstances')
+ ip = models.GenericIPAddressField(help_text="Instance ip address", blank=True, null=True)
port_id = models.CharField(null=True, blank=True, max_length=256, help_text="Quantum port id")
mac = models.CharField(null=True, blank=True, max_length=256, help_text="MAC address associated with this port")
class Meta:
- unique_together = ('network', 'sliver')
+ unique_together = ('network', 'instance')
def save(self, *args, **kwds):
- if self.sliver:
- slice = self.sliver.slice
+ if self.instance:
+ slice = self.instance.slice
if (slice not in self.network.permitted_slices.all()) and (slice != self.network.owner) and (not self.network.permit_all_slices):
- # to add a sliver to the network, then one of the following must be true:
- # 1) sliver's slice is in network's permittedSlices list,
- # 2) sliver's slice is network's owner, or
+ # to add a instance to the network, then one of the following must be true:
+ # 1) instance's slice is in network's permittedSlices list,
+ # 2) instance's slice is network's owner, or
# 3) network's permitAllSlices is true
raise ValueError("Slice %s is not allowed to connect to network %s" % (str(slice), str(self.network)))
if (not self.ip) and (NO_OBSERVER):
from util.network_subnet_allocator import find_unused_address
self.ip = find_unused_address(self.network.subnet,
- [x.ip for x in self.network.networksliver_set.all()])
- super(NetworkSliver, self).save(*args, **kwds)
+ [x.ip for x in self.network.networkinstance_set.all()])
+ super(NetworkInstance, self).save(*args, **kwds)
def __unicode__(self):
- if self.sliver:
- return u'%s-%s' % (self.network.name, self.sliver.instance_name)
+ if self.instance:
+ return u'%s-%s' % (self.network.name, self.instance.instance_name)
else:
return u'%s-unboundport-%s' % (self.network.name, self.id)
def can_update(self, user):
- if self.sliver:
- return user.can_update_slice(self.sliver.slice)
+ if self.instance:
+ return user.can_update_slice(self.instance.slice)
if self.network:
return user.can_update_slice(self.network.owner)
return False
@@ -256,13 +256,13 @@
@staticmethod
def select_by_user(user):
if user.is_admin:
- qs = NetworkSliver.objects.all()
+ qs = NetworkInstance.objects.all()
else:
- sliver_ids = [s.id for s in NetworkSliver.select_by_user(user)]
- qs = NetworkSliver.objects.filter(id__in=sliver_ids)
+ instance_ids = [s.id for s in NetworkInstance.select_by_user(user)]
+ qs = NetworkInstance.objects.filter(id__in=instance_ids)
return qs
-class Port(NetworkSliver):
+class Port(NetworkInstance):
# Rename in progress: NetworkSliver->Port
class Meta:
proxy = True
diff --git a/xos/core/models/reservation.py b/xos/core/models/reservation.py
index 1a838a2..ecf207c 100644
--- a/xos/core/models/reservation.py
+++ b/xos/core/models/reservation.py
@@ -2,7 +2,7 @@
import datetime
from django.db import models
from core.models import PlCoreBase
-from core.models import Sliver
+from core.models import Instance
from core.models import Slice
from core.models import ServiceResource
@@ -32,7 +32,7 @@
return qs
class ReservedResource(PlCoreBase):
- sliver = models.ForeignKey(Sliver, related_name="reservedresources")
+ instance = models.ForeignKey(Instance, related_name="reservedresources")
resource = models.ForeignKey(ServiceResource, related_name="reservedresources")
quantity = models.IntegerField(default=1)
reservationSet = models.ForeignKey(Reservation, related_name="reservedresources")
@@ -40,18 +40,18 @@
class Meta(PlCoreBase.Meta):
verbose_name_plural = "Reserved Resources"
- def __unicode__(self): return u'%d %s on %s' % (self.quantity, self.resource, self.sliver)
+ def __unicode__(self): return u'%d %s on %s' % (self.quantity, self.resource, self.instance)
def can_update(self, user):
- return user.can_update(self.sliver.slice)
+ return user.can_update(self.instance.slice)
@staticmethod
def select_by_user(user):
if user.is_admin:
qs = ReservedResource.objects.all()
else:
- sliver_ids = [s.id for s in Sliver.select_by_user(user)]
- qs = ReservedResource.objects.filter(id__in=sliver_ids)
+ instance_ids = [s.id for s in Instance.select_by_user(user)]
+ qs = ReservedResource.objects.filter(id__in=instance_ids)
return qs
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index c46b165..b69acf1 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -88,25 +88,25 @@
Get a list of nodes that can be used to scale up a slice.
slice - slice to scale up
- max_per_node - maximum numbers of slivers that 'slice' can have on a single node
+ max_per_node - maximum numbers of instances that 'slice' can have on a single node
exclusive_slices - list of slices that must have no nodes in common with 'slice'.
"""
- from core.models import Node, Sliver # late import to get around order-of-imports constraint in __init__.py
+ from core.models import Node, Instance # late import to get around order-of-imports constraint in __init__.py
nodes = list(Node.objects.all())
- conflicting_slivers = Sliver.objects.filter(slice__in = exclusive_slices)
- conflicting_nodes = Node.objects.filter(slivers__in = conflicting_slivers)
+ conflicting_instances = Instance.objects.filter(slice__in = exclusive_slices)
+ conflicting_nodes = Node.objects.filter(instances__in = conflicting_instances)
nodes = [x for x in nodes if x not in conflicting_nodes]
- # If max_per_node is set, then limit the number of slivers this slice
+ # If max_per_node is set, then limit the number of instances this slice
# can have on a single node.
if max_per_node:
acceptable_nodes = []
for node in nodes:
- existing_count = node.slivers.filter(slice=slice).count()
+ existing_count = node.instances.filter(slice=slice).count()
if existing_count < max_per_node:
acceptable_nodes.append(node)
nodes = acceptable_nodes
@@ -117,22 +117,22 @@
# Pick the best node to scale up a slice.
nodes = self.get_scalable_nodes(slice, max_per_node, exclusive_slices)
- nodes = sorted(nodes, key=lambda node: node.slivers.all().count())
+ nodes = sorted(nodes, key=lambda node: node.instances.all().count())
if not nodes:
return None
return nodes[0]
def adjust_scale(self, slice_hint, scale, max_per_node=None, exclusive_slices=[]):
- from core.models import Sliver # late import to get around order-of-imports constraint in __init__.py
+ from core.models import Instance # late import to get around order-of-imports constraint in __init__.py
slices = [x for x in self.slices.all() if slice_hint in x.name]
for slice in slices:
- while slice.slivers.all().count() > scale:
- s = slice.slivers.all()[0]
- # print "drop sliver", s
+ while slice.instances.all().count() > scale:
+ s = slice.instances.all()[0]
+ # print "drop instance", s
s.delete()
- while slice.slivers.all().count() < scale:
+ while slice.instances.all().count() < scale:
node = self.pick_node(slice, max_per_node, exclusive_slices)
if not node:
# no more available nodes
@@ -146,7 +146,7 @@
if not flavor:
raise XOSConfigurationError("No default_flavor for slice %s" % slice.name)
- s = Sliver(slice=slice,
+ s = Instance(slice=slice,
node=node,
creator=slice.creator,
image=image,
@@ -154,7 +154,7 @@
deployment=node.site_deployment.deployment)
s.save()
- # print "add sliver", s
+ # print "add instance", s
class ServiceAttribute(PlCoreBase):
name = models.SlugField(help_text="Attribute Name", max_length=128)
diff --git a/xos/core/models/slice.py b/xos/core/models/slice.py
index 76f5041..18d3cb6 100644
--- a/xos/core/models/slice.py
+++ b/xos/core/models/slice.py
@@ -25,7 +25,7 @@
description=models.TextField(blank=True,help_text="High level description of the slice and expected activities", max_length=1024)
slice_url = models.URLField(blank=True, max_length=512)
site = models.ForeignKey(Site, related_name='slices', help_text="The Site this Slice belongs to")
- max_slivers = models.IntegerField(default=10)
+ max_instances = models.IntegerField(default=10)
service = models.ForeignKey(Service, related_name='slices', null=True, blank=True)
network = StrippedCharField(default="Private Only",null=True, blank=True, max_length=256)
tags = generic.GenericRelation(Tag)
@@ -192,4 +192,4 @@
return monitor.get_meter('network.outgoing.bytes',filter,None)
def get_node_stats(self):
- return len(self.slice.slivers)
+ return len(self.slice.instances)
diff --git a/xos/core/models/user.py b/xos/core/models/user.py
index 2ea90da..cb90145 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -339,12 +339,12 @@
def get_readable_objects(self, filter_by=None):
""" Returns a list of objects that the user is allowed to read. """
- from core.models import Deployment, Flavor, Image, Network, NetworkTemplate, Node, PlModelMixIn, Site, Slice, SliceTag, Sliver, Tag, User, DeploymentPrivilege, SitePrivilege, SlicePrivilege
+ from core.models import Deployment, Flavor, Image, Network, NetworkTemplate, Node, PlModelMixIn, Site, Slice, SliceTag, Instance, Tag, User, DeploymentPrivilege, SitePrivilege, SlicePrivilege
models = []
if filter_by and isinstance(filter_by, list):
models = [m for m in filter_by if issubclass(m, PlModelMixIn)]
if not models:
- models = [Deployment, Network, Site, Slice, SliceTag, Sliver, Tag, User]
+ models = [Deployment, Network, Site, Slice, SliceTag, Instance, Tag, User]
readable_objects = []
for model in models:
readable_objects.extend(model.select_by_user(self))
@@ -362,7 +362,7 @@
list of dicts
"""
- from core.models import Deployment, Flavor, Image, Network, NetworkTemplate, Node, PlModelMixIn, Site, Slice, SliceTag, Sliver, Tag, User, DeploymentPrivilege, SitePrivilege, SlicePrivilege
+ from core.models import Deployment, Flavor, Image, Network, NetworkTemplate, Node, PlModelMixIn, Site, Slice, SliceTag, Instance, Tag, User, DeploymentPrivilege, SitePrivilege, SlicePrivilege
READ = 'r'
READWRITE = 'rw'
models = []
@@ -371,7 +371,7 @@
deployment_priv_objs = [Image, NetworkTemplate, Flavor]
site_priv_objs = [Node, Slice, User]
- slice_priv_objs = [Sliver, Network]
+ slice_priv_objs = [Instance, Network]
# maps the set of objects a paticular role has write access
write_map = {
diff --git a/xos/core/serializers.py b/xos/core/serializers.py
index 3fb726d..d84f111 100644
--- a/xos/core/serializers.py
+++ b/xos/core/serializers.py
@@ -109,7 +109,7 @@
# HyperlinkedModelSerializer doesn't include the id by default
id = serializers.Field()
site = serializers.HyperlinkedRelatedField(view_name='site-detail')
- slivers = serializers.HyperlinkedRelatedField(view_name='sliver-detail')
+ instances = serializers.HyperlinkedRelatedField(view_name='instance-detail')
class Meta:
model = Slice
fields = ('id',
@@ -128,7 +128,7 @@
'network',
'mountDataSets',
'site',
- 'slivers',
+ 'instances',
'updated',
'created')
@@ -185,7 +185,7 @@
'site',
'role')
-class SliverSerializer(serializers.HyperlinkedModelSerializer):
+class InstanceSerializer(serializers.HyperlinkedModelSerializer):
# HyperlinkedModelSerializer doesn't include the id by default
id = serializers.Field()
image = serializers.HyperlinkedRelatedField(view_name='image-detail')
@@ -196,7 +196,7 @@
#slice = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
- model = Sliver
+ model = Instance
fields = ('id',
'url',
'instance_id',
@@ -261,7 +261,7 @@
SitePrivilege: SitePrivilegeSerializer,
Slice: SliceSerializer,
SlicePrivilege: SlicePrivilegeSerializer,
- Sliver: SliverSerializer,
+ Instance: InstanceSerializer,
Tag: TagSerializer,
User: UserSerializer,
None: None,
diff --git a/xos/core/tests.py b/xos/core/tests.py
index a02497e..e3d7faa 100644
--- a/xos/core/tests.py
+++ b/xos/core/tests.py
@@ -7,7 +7,7 @@
from datetime import datetime
FIXTURES_FILE = 'core/fixtures/initial_data.json'
-MODELS = ['Deployment','Image','Node','Reservation','Slice','Sliver','User']
+MODELS = ['Deployment','Image','Node','Reservation','Slice','Instance','User']
def is_dynamic_type(x):
t = type(x)
diff --git a/xos/core/views/hpc_config.py b/xos/core/views/hpc_config.py
index af183bf..c83c01b 100644
--- a/xos/core/views/hpc_config.py
+++ b/xos/core/views/hpc_config.py
@@ -58,11 +58,11 @@
if not cmiSlice:
return HttpResponseServerError("Error: no CMI slice")
- if len(cmiSlice.slivers.all())==0:
- return HttpResponseServerError("Error: CMI slice has no slivers")
+ if len(cmiSlice.instances.all())==0:
+ return HttpResponseServerError("Error: CMI slice has no instances")
# for now, assuming using NAT
- cmi_hostname = cmiSlice.slivers.all()[0].node.name
+ cmi_hostname = cmiSlice.instances.all()[0].node.name
if not hpcSlice:
return HttpResponseServerError("Error: no HPC slice")
diff --git a/xos/core/views/instances.py b/xos/core/views/instances.py
new file mode 100644
index 0000000..e424538
--- /dev/null
+++ b/xos/core/views/instances.py
@@ -0,0 +1,13 @@
+from core.serializers import InstanceSerializer
+from rest_framework import generics
+from core.models import Instance
+
+class InstanceList(generics.ListCreateAPIView):
+ queryset = Instance.objects.all()
+ serializer_class = InstanceSerializer
+
+class InstanceDetail(generics.RetrieveUpdateDestroyAPIView):
+ queryset = Instance.objects.all()
+ serializer_class = InstanceSerializer
+
+
diff --git a/xos/core/views/legacyapi.py b/xos/core/views/legacyapi.py
index fe86871..942be9a 100644
--- a/xos/core/views/legacyapi.py
+++ b/xos/core/views/legacyapi.py
@@ -6,7 +6,7 @@
import traceback
import xmlrpclib
-from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
+from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
@@ -52,8 +52,8 @@
continue
node_ids=[]
- for ps_sliver in ps_slice.slivers.all():
- node_ids.append(ps_id_to_pl_id(ps_sliver.node.id))
+ for ps_instance in ps_slice.instances.all():
+ node_ids.append(ps_id_to_pl_id(ps_instance.node.id))
slice = {"instantiation": "plc-instantiated",
"description": "XOS slice",
@@ -81,8 +81,8 @@
nodes = []
for ps_node in ps_nodes:
slice_ids=[]
- for ps_sliver in ps_node.slivers.all():
- slice_ids.append(pl_slice_id(ps_sliver.slice, slice_remap))
+ for ps_instance in ps_node.instances.all():
+ slice_ids.append(pl_slice_id(ps_instance.slice, slice_remap))
node = {"node_id": ps_id_to_pl_id(ps_node.id),
"site_id": ps_id_to_pl_id(ps_node.site_id),
@@ -150,17 +150,17 @@
interfaces = []
ps_slices = Slice.objects.filter(name=slicename)
for ps_slice in ps_slices:
- for ps_sliver in ps_slice.slivers.all():
- node_id = ps_id_to_pl_id(ps_sliver.node_id)
+ for ps_instance in ps_slice.instances.all():
+ node_id = ps_id_to_pl_id(ps_instance.node_id)
if node_id in node_ids:
- ps_node = ps_sliver.node
+ ps_node = ps_instance.node
ip = socket.gethostbyname(ps_node.name.strip())
# If the slice has a network that's labeled for hpc_client, then
# return that network.
found_labeled_network = False
- for port in ps_sliver.ports.all():
+ for port in ps_instance.ports.all():
if (not port.ip):
continue
if (port.network.owner != ps_slice):
@@ -171,7 +171,7 @@
if not found_labeled_network:
# search for a dedicated public IP address
- for port in ps_sliver.ports.all():
+ for port in ps_instance.ports.all():
if (not port.ip):
continue
template = port.network.template
@@ -180,7 +180,7 @@
if return_nat:
ip = None
- for port in ps_sliver.ports.all():
+ for port in ps_instance.ports.all():
if (not port.ip):
continue
template = port.network.template
@@ -191,7 +191,7 @@
if return_private:
ip = None
- for port in ps_sliver.ports.all():
+ for port in ps_instance.ports.all():
if (not port.ip):
continue
template = port.network.template
@@ -226,7 +226,7 @@
else:
node_id = 0
- node_sliver_tags = GetTags(slicename, node_id)
+ node_instance_tags = GetTags(slicename, node_id)
slices = GetSlices({"name": slicename}, slice_remap=slice_remap)
perhost = {}
@@ -266,12 +266,12 @@
hostprivmap[nodemap[interface['node_id']]] = interface['ip']
for nid in node_ids:
- sliver_tags = GetTags(slicename,nid)
- perhost[nodemap[nid]] = sliver_tags
+ instance_tags = GetTags(slicename,nid)
+ perhost[nodemap[nid]] = instance_tags
- slivers = GetSlices(slice_remap=slice_remap)
+ instances = GetSlices(slice_remap=slice_remap)
if node_id != 0:
- slivers = [slice for slice in slivers if (node_id in slice.node_ids)]
+ instances = [slice for slice in instances if (node_id in slice.node_ids)]
sites = GetSites(slice_remap=slice_remap)
for site in sites:
@@ -280,12 +280,12 @@
timestamp = int(time.time())
return {'version': 3,
'timestamp': timestamp,
- 'configuration': node_sliver_tags,
+ 'configuration': node_instance_tags,
'allconfigurations':perhost,
'hostipmap':hostipmap,
'hostnatmap':hostnatmap,
'hostprivmap':hostprivmap,
- 'slivers': slivers,
+ 'slivers': instances,
'interfaces': allinterfaces,
'sites': sites,
'nodes': nodes}
diff --git a/xos/core/views/slivers.py b/xos/core/views/slivers.py
deleted file mode 100644
index bb310da..0000000
--- a/xos/core/views/slivers.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.serializers import SliverSerializer
-from rest_framework import generics
-from core.models import Sliver
-
-class SliverList(generics.ListCreateAPIView):
- queryset = Sliver.objects.all()
- serializer_class = SliverSerializer
-
-class SliverDetail(generics.RetrieveUpdateDestroyAPIView):
- queryset = Sliver.objects.all()
- serializer_class = SliverSerializer
-
-
diff --git a/xos/core/xoslib/methods/cordsubscriber.py b/xos/core/xoslib/methods/cordsubscriber.py
index e504c71..ea8da80 100644
--- a/xos/core/xoslib/methods/cordsubscriber.py
+++ b/xos/core/xoslib/methods/cordsubscriber.py
@@ -30,7 +30,7 @@
service_specific_id = ReadOnlyField()
vlan_id = ReadOnlyField()
vcpe_id = ReadOnlyField()
- sliver = ReadOnlyField()
+ instance = ReadOnlyField()
image = ReadOnlyField()
vbng_id = ReadOnlyField()
firewall_enable = serializers.BooleanField()
@@ -39,7 +39,7 @@
url_filter_rules = serializers.CharField()
url_filter_level = serializers.CharField(required=False)
cdn_enable = serializers.BooleanField()
- sliver_name = ReadOnlyField()
+ instance_name = ReadOnlyField()
image_name = ReadOnlyField()
routeable_subnet = serializers.CharField(required=False)
ssh_command = ReadOnlyField()
@@ -60,7 +60,7 @@
model = CordSubscriber
fields = ('humanReadableName', 'id',
'service_specific_id', 'vlan_id',
- 'vcpe_id', 'sliver', 'sliver_name', 'image', 'image_name',
+ 'vcpe_id', 'instance', 'instance_name', 'image', 'image_name',
'firewall_enable', 'firewall_rules',
'url_filter_enable', 'url_filter_rules', 'url_filter_level',
'bbs_account',
diff --git a/xos/core/xoslib/methods/hpcview.py b/xos/core/xoslib/methods/hpcview.py
index 0645405..f14b398 100644
--- a/xos/core/xoslib/methods/hpcview.py
+++ b/xos/core/xoslib/methods/hpcview.py
@@ -24,16 +24,16 @@
except:
return service.service.all()
-def lookup_tag(service, sliver, name, default=None):
- sliver_type = ContentType.objects.get_for_model(sliver)
- t = Tag.objects.filter(service=service, name=name, content_type__pk=sliver_type.id, object_id=sliver.id)
+def lookup_tag(service, instance, name, default=None):
+ instance_type = ContentType.objects.get_for_model(instance)
+ t = Tag.objects.filter(service=service, name=name, content_type__pk=instance_type.id, object_id=instance.id)
if t:
return t[0].value
else:
return default
-def lookup_time(service, sliver, name):
- v = lookup_tag(service, sliver, name)
+def lookup_time(service, instance, name):
+ v = lookup_tag(service, instance, name)
if v:
return str(time.time() - float(v))
else:
@@ -69,22 +69,22 @@
return config_run
# from hpc_watcher.py
-def get_public_ip(service, sliver):
+def get_public_ip(service, instance):
network_name = None
- if "hpc" in sliver.slice.name:
+ if "hpc" in instance.slice.name:
network_name = getattr(service, "watcher_hpc_network", None)
- elif "demux" in sliver.slice.name:
+ elif "demux" in instance.slice.name:
network_name = getattr(service, "watcher_dnsdemux_network", None)
- elif "redir" in sliver.slice.name:
+ elif "redir" in instance.slice.name:
network_name = getattr(service, "watcher_dnsredir_network", None)
if network_name and network_name.lower()=="nat":
return None
if (network_name is None) or (network_name=="") or (network_name.lower()=="public"):
- return sliver.get_public_ip()
+ return instance.get_public_ip()
- for ns in sliver.networkslivers.all():
+ for ns in instance.networkinstances.all():
if (ns.ip) and (ns.network.name==network_name):
return ns.ip
@@ -143,50 +143,50 @@
nameservers[nameserver] = {"name": nameserver, "ip": "exception", "hit": False}
dnsdemux=[]
- for sliver in dnsdemux_slice.slivers.all():
+ for instance in dnsdemux_slice.instances.all():
ip=None
try:
- ip = get_public_ip(dnsdemux_service, sliver)
+ ip = get_public_ip(dnsdemux_service, instance)
except Exception, e:
ip = "Exception: " + str(e)
if not ip:
try:
- ip = socket.gethostbyname(sliver.node.name)
+ ip = socket.gethostbyname(instance.node.name)
except:
- ip = "??? " + sliver.node.name
+ ip = "??? " + instance.node.name
- sliver_nameservers = []
+ instance_nameservers = []
for ns in nameservers.values():
if ns["ip"]==ip:
- sliver_nameservers.append(ns["name"])
+ instance_nameservers.append(ns["name"])
ns["hit"]=True
- # now find the dnsredir sliver that is also on this node
- watcherd_dnsredir = "no-redir-sliver"
- for dnsredir_sliver in dnsredir_slice.slivers.all():
- if dnsredir_sliver.node == sliver.node:
- watcherd_dnsredir = lookup_tag(dnsredir_service, dnsredir_sliver, "watcher.watcher.msg")
+ # now find the dnsredir instance that is also on this node
+ watcherd_dnsredir = "no-redir-instance"
+ for dnsredir_instance in dnsredir_slice.instances.all():
+ if dnsredir_instance.node == instance.node:
+ watcherd_dnsredir = lookup_tag(dnsredir_service, dnsredir_instance, "watcher.watcher.msg")
- watcherd_dnsdemux = lookup_tag(dnsdemux_service, sliver, "watcher.watcher.msg")
+ watcherd_dnsdemux = lookup_tag(dnsdemux_service, instance, "watcher.watcher.msg")
- dnsdemux.append( {"name": sliver.node.name,
- "watcher.DNS.msg": lookup_tag(dnsdemux_service, sliver, "watcher.DNS.msg"),
- "watcher.DNS.time": lookup_time(dnsdemux_service, sliver, "watcher.DNS.time"),
+ dnsdemux.append( {"name": instance.node.name,
+ "watcher.DNS.msg": lookup_tag(dnsdemux_service, instance, "watcher.DNS.msg"),
+ "watcher.DNS.time": lookup_time(dnsdemux_service, instance, "watcher.DNS.time"),
"ip": ip,
- "nameservers": sliver_nameservers,
+ "nameservers": instance_nameservers,
"dnsdemux_config_age": compute_config_run(watcherd_dnsdemux),
"dnsredir_config_age": compute_config_run(watcherd_dnsredir) })
hpc=[]
- for sliver in hpc_slice.slivers.all():
- watcherd_hpc = lookup_tag(hpc_service, sliver, "watcher.watcher.msg")
+ for instance in hpc_slice.instances.all():
+ watcherd_hpc = lookup_tag(hpc_service, instance, "watcher.watcher.msg")
- hpc.append( {"name": sliver.node.name,
- "watcher.HPC-hb.msg": lookup_tag(hpc_service, sliver, "watcher.HPC-hb.msg"),
- "watcher.HPC-hb.time": lookup_time(hpc_service, sliver, "watcher.HPC-hb.time"),
- "watcher.HPC-fetch.msg": lookup_tag(hpc_service, sliver, "watcher.HPC-fetch.msg"),
- "watcher.HPC-fetch.time": lookup_time(hpc_service, sliver, "watcher.HPC-fetch.time"),
- "watcher.HPC-fetch.urls": json_default(lookup_tag(hpc_service, sliver, "watcher.HPC-fetch-urls.msg"), []),
+ hpc.append( {"name": instance.node.name,
+ "watcher.HPC-hb.msg": lookup_tag(hpc_service, instance, "watcher.HPC-hb.msg"),
+ "watcher.HPC-hb.time": lookup_time(hpc_service, instance, "watcher.HPC-hb.time"),
+ "watcher.HPC-fetch.msg": lookup_tag(hpc_service, instance, "watcher.HPC-fetch.msg"),
+ "watcher.HPC-fetch.time": lookup_time(hpc_service, instance, "watcher.HPC-fetch.time"),
+ "watcher.HPC-fetch.urls": json_default(lookup_tag(hpc_service, instance, "watcher.HPC-fetch-urls.msg"), []),
"config_age": compute_config_run(watcherd_hpc),
})
diff --git a/xos/core/xoslib/methods/sliceplus.py b/xos/core/xoslib/methods/sliceplus.py
index 12f7c1a..c339789 100644
--- a/xos/core/xoslib/methods/sliceplus.py
+++ b/xos/core/xoslib/methods/sliceplus.py
@@ -66,7 +66,7 @@
class Meta:
model = SlicePlus
- fields = ('humanReadableName', 'id','created','updated','enacted','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','mount_data_sets',
+ fields = ('humanReadableName', 'id','created','updated','enacted','name','enabled','omf_friendly','description','slice_url','site','max_instances','service','network','mount_data_sets',
'default_image', 'default_flavor',
'serviceClass','creator','networks','sliceInfo','network_ports','backendIcon','backendHtml','site_allocation','site_ready','users',"user_names","current_user_can_see")
diff --git a/xos/core/xoslib/methods/sshkeys.py b/xos/core/xoslib/methods/sshkeys.py
index a714212..8413e65 100644
--- a/xos/core/xoslib/methods/sshkeys.py
+++ b/xos/core/xoslib/methods/sshkeys.py
@@ -16,16 +16,16 @@
def get(self, request, format=None):
instances=[]
- for sliver in self.get_queryset().all():
- if sliver.instance_id:
- instances.append( {"id": sliver.instance_id,
- "public_keys": sliver.get_public_keys(),
- "node_name": sliver.node.name } )
+ for instance in self.get_queryset().all():
+ if instance.instance_id:
+ instances.append( {"id": instance.instance_id,
+ "public_keys": instance.get_public_keys(),
+ "node_name": instance.node.name } )
return Response(instances)
def get_queryset(self):
- queryset = queryset=Sliver.objects.all()
+ queryset = queryset=Instance.objects.all()
node_name = self.request.QUERY_PARAMS.get('node_name', None)
if node_name is not None:
@@ -38,15 +38,15 @@
method_name = "sshkeys"
def get(self, request, format=None, pk=0):
- slivers = self.get_queryset().filter(instance_id=pk)
- if not slivers:
- raise XOSNotFound("didn't find sliver for instance %s" % pk)
- return Response( [ {"id": slivers[0].instance_id,
- "public_keys": slivers[0].get_public_keys(),
- "node_name": slivers[0].node.name } ])
+ instances = self.get_queryset().filter(instance_id=pk)
+ if not instances:
+ raise XOSNotFound("didn't find instance for instance %s" % pk)
+ return Response( [ {"id": instances[0].instance_id,
+ "public_keys": instances[0].get_public_keys(),
+ "node_name": instances[0].node.name } ])
def get_queryset(self):
- queryset = queryset=Sliver.objects.all()
+ queryset = queryset=Instance.objects.all()
node_name = self.request.QUERY_PARAMS.get('node_name', None)
if node_name is not None:
diff --git a/xos/core/xoslib/methods/volttenant.py b/xos/core/xoslib/methods/volttenant.py
index ba0e909..e5998da 100644
--- a/xos/core/xoslib/methods/volttenant.py
+++ b/xos/core/xoslib/methods/volttenant.py
@@ -44,10 +44,10 @@
vcpe = obj.vcpe
if not vcpe:
return None
- sliver = vcpe.sliver
- if not sliver:
+ instance = vcpe.instance
+ if not instance:
return None
- return sliver.node.name
+ return instance.node.name
class VOLTTenantList(XOSListCreateAPIView):
serializer_class = VOLTTenantIdSerializer
diff --git a/xos/core/xoslib/objects/cordsubscriber.py b/xos/core/xoslib/objects/cordsubscriber.py
index 63dfec2..318d54c 100644
--- a/xos/core/xoslib/objects/cordsubscriber.py
+++ b/xos/core/xoslib/objects/cordsubscriber.py
@@ -1,4 +1,4 @@
-from core.models import Slice, SlicePrivilege, SliceRole, Sliver, Site, Node, User
+from core.models import Slice, SlicePrivilege, SliceRole, Instance, Site, Node, User
from cord.models import VOLTTenant, CordSubscriberRoot
from plus import PlusObjectMixin
from operator import itemgetter, attrgetter
@@ -40,8 +40,8 @@
("cdn_enable", "vcpe.cdn_enable"),
("image", "vcpe.image.id"),
("image_name", "vcpe.image.name"),
- ("sliver", "vcpe.sliver.id"),
- ("sliver_name", "vcpe.sliver.name"),
+ ("instance", "vcpe.instance.id"),
+ ("instance_name", "vcpe.instance.name"),
("routeable_subnet", "vcpe.vbng.routeable_subnet"),
("vcpe_id", "vcpe.id"),
("vbng_id", "vcpe.vbng.id"),
@@ -119,8 +119,8 @@
("ssh_command", "volt.vcpe.ssh_command"),
("image", "volt.vcpe.image.id"),
("image_name", "volt.vcpe.image.name"),
- ("sliver", "volt.vcpe.sliver.id"),
- ("sliver_name", "volt.vcpe.sliver.name"),
+ ("instance", "volt.vcpe.instance.id"),
+ ("instance_name", "volt.vcpe.instance.name"),
("routeable_subnet", "volt.vcpe.vbng.routeable_subnet"),
("vcpe_id", "volt.vcpe.id"),
("vbng_id", "volt.vcpe.vbng.id"),
diff --git a/xos/core/xoslib/objects/sliceplus.py b/xos/core/xoslib/objects/sliceplus.py
index 47c93d7..9d2868f 100644
--- a/xos/core/xoslib/objects/sliceplus.py
+++ b/xos/core/xoslib/objects/sliceplus.py
@@ -1,4 +1,4 @@
-from core.models import Slice, SlicePrivilege, SliceRole, Sliver, Site, Node, User
+from core.models import Slice, SlicePrivilege, SliceRole, Instance, Site, Node, User
from plus import PlusObjectMixin
from operator import itemgetter, attrgetter
from rest_framework.exceptions import APIException
@@ -22,16 +22,16 @@
used_sites = {}
ready_sites = {}
used_deployments = {}
- sliverCount = 0
+ instanceCount = 0
sshCommands = []
- for sliver in self.slivers.all():
- site = sliver.node.site_deployment.site
- deployment = sliver.node.site_deployment.deployment
+ for instance in self.instances.all():
+ site = instance.node.site_deployment.site
+ deployment = instance.node.site_deployment.deployment
used_sites[site.name] = used_sites.get(site.name, 0) + 1
used_deployments[deployment.name] = used_deployments.get(deployment.name, 0) + 1
- sliverCount = sliverCount + 1
+ instanceCount = instanceCount + 1
- sshCommand = sliver.get_ssh_command()
+ sshCommand = instance.get_ssh_command()
if sshCommand:
sshCommands.append(sshCommand)
@@ -57,7 +57,7 @@
self._sliceInfo= {"sitesUsed": used_sites,
"sitesReady": ready_sites,
"deploymentsUsed": used_deployments,
- "sliverCount": sliverCount,
+ "instanceCount": instanceCount,
"siteCount": len(used_sites.keys()),
"users": users,
"roles": [],
@@ -127,10 +127,10 @@
nodeList = []
for node in Node.objects.all():
if (node.site_deployment.site.id in siteIDList):
- node.sliverCount = 0
- for sliver in node.slivers.all():
- if sliver.slice.id == self.id:
- node.sliverCount = node.sliverCount + 1
+ node.instanceCount = 0
+ for instance in node.instances.all():
+ if instance.slice.id == self.id:
+ node.instanceCount = node.instanceCount + 1
nodeList.append(node)
return nodeList
@@ -170,58 +170,58 @@
print "save_site_allocation, reset=",reset
if (not self._site_allocation):
- # Must be a sliver that was just created, and has not site_allocation
+ # Must be a instance that was just created, and has not site_allocation
# field.
return
- all_slice_slivers = self.slivers.all()
+ all_slice_instances = self.instances.all()
for site_name in self._site_allocation.keys():
desired_allocation = self._site_allocation[site_name]
- # make a list of the slivers for this site
- slivers = []
- for sliver in all_slice_slivers:
- if sliver.node.site_deployment.site.name == site_name:
- slivers.append(sliver)
+ # make a list of the instances for this site
+ instances = []
+ for instance in all_slice_instances:
+ if instance.node.site_deployment.site.name == site_name:
+ instances.append(instance)
- # delete extra slivers
- while (reset and len(slivers)>0) or (len(slivers) > desired_allocation):
- sliver = slivers.pop()
+ # delete extra instances
+ while (reset and len(instances)>0) or (len(instances) > desired_allocation):
+ instance = instances.pop()
if (not noAct):
- print "deleting sliver", sliver
- sliver.delete()
+ print "deleting instance", instance
+ instance.delete()
else:
- print "would delete sliver", sliver
+ print "would delete instance", instance
- # add more slivers
- if (len(slivers) < desired_allocation):
+ # add more instances
+ if (len(instances) < desired_allocation):
site = Site.objects.get(name = site_name)
nodes = self.get_node_allocation([site])
if (not nodes):
raise APIException(detail="no nodes in site %s" % site_name)
- while (len(slivers) < desired_allocation):
+ while (len(instances) < desired_allocation):
# pick the least allocated node
- nodes = sorted(nodes, key=attrgetter("sliverCount"))
+ nodes = sorted(nodes, key=attrgetter("instanceCount"))
node = nodes[0]
- sliver = Sliver(name=node.name,
+ instance = Instance(name=node.name,
slice=self,
node=node,
image = self.default_image,
flavor = self.default_flavor,
creator = self.creator,
deployment = node.site_deployment.deployment)
- sliver.caller = self.caller
- slivers.append(sliver)
+ instance.caller = self.caller
+ instances.append(instance)
if (not noAct):
- print "added sliver", sliver
- sliver.save()
+ print "added instance", instance
+ instance.save()
else:
- print "would add sliver", sliver
+ print "would add instance", instance
- node.sliverCount = node.sliverCount + 1
+ node.instanceCount = node.instanceCount + 1
def save_users(self, noAct = False):
new_users = self._update_users
diff --git a/xos/ec2_observer/deleters/instance_deleter.py b/xos/ec2_observer/deleters/instance_deleter.py
new file mode 100644
index 0000000..60f9e47
--- /dev/null
+++ b/xos/ec2_observer/deleters/instance_deleter.py
@@ -0,0 +1,14 @@
+from core.models import Instance, SliceDeployments
+from observer.deleter import Deleter
+
+class InstanceDeleter(Deleter):
+ model='Instance'
+
+ def call(self, pk):
+ instance = Instance.objects.get(pk=pk)
+ if instance.instance_id:
+ driver = self.driver.client_driver(caller=instance.creator,
+ tenant=instance.slice.name,
+ deployment=instance.deploymentNetwork.name)
+ driver.destroy_instance(instance.instance_id)
+ instance.delete()
diff --git a/xos/ec2_observer/deleters/network_instance_deleter.py b/xos/ec2_observer/deleters/network_instance_deleter.py
new file mode 100644
index 0000000..8a8f516
--- /dev/null
+++ b/xos/ec2_observer/deleters/network_instance_deleter.py
@@ -0,0 +1,13 @@
+from core.models import NetworkInstance
+from observer.deleter import Deleter
+
+class NetworkInstanceDeleter(Deleter):
+ model='NetworkInstance'
+
+ def call(self, pk):
+ network_instance = NetworkInstances.objects.get(pk=pk)
+ # handle openstack delete
+
+ network_instance.delete()
+
+
diff --git a/xos/ec2_observer/deleters/network_sliver_deleter.py b/xos/ec2_observer/deleters/network_sliver_deleter.py
deleted file mode 100644
index 71ba040..0000000
--- a/xos/ec2_observer/deleters/network_sliver_deleter.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from core.models import NetworkSliver
-from observer.deleter import Deleter
-
-class NetworkSliverDeleter(Deleter):
- model='NetworkSliver'
-
- def call(self, pk):
- network_sliver = NetworkSlivers.objects.get(pk=pk)
- # handle openstack delete
-
- network_sliver.delete()
-
-
diff --git a/xos/ec2_observer/deleters/sliver_deleter.py b/xos/ec2_observer/deleters/sliver_deleter.py
deleted file mode 100644
index 097f0f7..0000000
--- a/xos/ec2_observer/deleters/sliver_deleter.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from core.models import Sliver, SliceDeployments
-from observer.deleter import Deleter
-
-class SliverDeleter(Deleter):
- model='Sliver'
-
- def call(self, pk):
- sliver = Sliver.objects.get(pk=pk)
- if sliver.instance_id:
- driver = self.driver.client_driver(caller=sliver.creator,
- tenant=sliver.slice.name,
- deployment=sliver.deploymentNetwork.name)
- driver.destroy_instance(sliver.instance_id)
- sliver.delete()
diff --git a/xos/ec2_observer/event_loop.py b/xos/ec2_observer/event_loop.py
index bdbbab0..fb91ee8 100644
--- a/xos/ec2_observer/event_loop.py
+++ b/xos/ec2_observer/event_loop.py
@@ -49,7 +49,7 @@
return ig
class XOSObserver:
- #sync_steps = [SyncNetworks,SyncNetworkSlivers,SyncSites,SyncSitePrivilege,SyncSlices,SyncSliceMemberships,SyncSlivers,SyncSliverIps,SyncExternalRoutes,SyncUsers,SyncRoles,SyncNodes,SyncImages,GarbageCollector]
+ #sync_steps = [SyncNetworks,SyncNetworkInstances,SyncSites,SyncSitePrivilege,SyncSlices,SyncSliceMemberships,SyncInstances,SyncInstanceIps,SyncExternalRoutes,SyncUsers,SyncRoles,SyncNodes,SyncImages,GarbageCollector]
sync_steps = []
diff --git a/xos/ec2_observer/steps/__init__.py b/xos/ec2_observer/steps/__init__.py
index ed44fdb..de7a1fd 100644
--- a/xos/ec2_observer/steps/__init__.py
+++ b/xos/ec2_observer/steps/__init__.py
@@ -1,12 +1,12 @@
#from .sync_external_routes import SyncExternalRoutes
-#from .sync_network_slivers import SyncNetworkSlivers
+#from .sync_network_instances import SyncNetworkInstances
#from .sync_networks import SyncNetworks
#from .sync_network_deployments import SyncNetworkDeployments
#from .sync_site_privileges import SyncSitePrivilege
#from .sync_slice_memberships import SyncSliceMemberships
#from .sync_slices import SyncSlices
-#from .sync_sliver_ips import SyncSliverIps
-#from .sync_slivers import SyncSlivers
+#from .sync_instance_ips import SyncInstanceIps
+#from .sync_instances import SyncInstances
#from .sync_users import SyncUsers
#from .sync_roles import SyncRoles
#from .sync_nodes import SyncNodes
diff --git a/xos/ec2_observer/steps/sync_slivers.py b/xos/ec2_observer/steps/sync_instances.py
similarity index 62%
rename from xos/ec2_observer/steps/sync_slivers.py
rename to xos/ec2_observer/steps/sync_instances.py
index a86b4c4..3dc5f0e 100644
--- a/xos/ec2_observer/steps/sync_slivers.py
+++ b/xos/ec2_observer/steps/sync_instances.py
@@ -4,7 +4,7 @@
from django.db.models import F, Q
from xos.config import Config
from ec2_observer.syncstep import SyncStep
-from core.models.sliver import Sliver
+from core.models.instance import Instance
from core.models.slice import SlicePrivilege, SliceDeployments
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
@@ -16,53 +16,53 @@
logger = Logger(level=logging.INFO)
-class SyncSlivers(SyncStep):
- provides=[Sliver]
+class SyncInstances(SyncStep):
+ provides=[Instance]
requested_interval=0
def fetch_pending(self, deletion):
if deletion:
- object_source = Sliver.deleted_objects
+ object_source = Instance.deleted_objects
else:
- object_source = Sliver.objects
+ object_source = Instance.objects
- all_slivers = object_source.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
- my_slivers = []
+ all_instances = object_source.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ my_instances = []
- for sliver in all_slivers:
- sd = SliceDeployments.objects.filter(Q(slice=sliver.slice))
+ for instance in all_instances:
+ sd = SliceDeployments.objects.filter(Q(slice=instance.slice))
if (sd):
if (sd.deployment.name=='Amazon EC2'):
- my_slivers.append(sliver)
- if (sliver.node.deployment.name=='Amazon EC2'):
- my_slivers.append(sliver)
- return my_slivers
+ my_instances.append(instance)
+ if (instance.node.deployment.name=='Amazon EC2'):
+ my_instances.append(instance)
+ return my_instances
- def delete_record(self, sliver):
- user = sliver.creator
+ def delete_record(self, instance):
+ user = instance.creator
e = get_creds(user=user, site=user.site)
- result = aws_run('ec2 terminate-instances --instance-ids=%s'%sliver.instance_id, env=e)
+ result = aws_run('ec2 terminate-instances --instance-ids=%s'%instance.instance_id, env=e)
- def sync_record(self, sliver):
- logger.info("sync'ing sliver:%s deployment:%s " % (sliver, sliver.node.deployment))
+ def sync_record(self, instance):
+ logger.info("sync'ing instance:%s deployment:%s " % (instance, instance.node.deployment))
- if not sliver.instance_id:
+ if not instance.instance_id:
# public keys
- slice_memberships = SlicePrivilege.objects.filter(slice=sliver.slice)
+ slice_memberships = SlicePrivilege.objects.filter(slice=instance.slice)
pubkeys = [sm.user.public_key for sm in slice_memberships if sm.user.public_key]
- if sliver.creator.public_key:
- pubkeys.append(sliver.creator.public_key)
+ if instance.creator.public_key:
+ pubkeys.append(instance.creator.public_key)
- if sliver.slice.creator.public_key:
- pubkeys.append(sliver.slice.creator.public_key)
+ if instance.slice.creator.public_key:
+ pubkeys.append(instance.slice.creator.public_key)
# netowrks
# include all networks available to the slice and/or associated network templates
#nics = []
- #networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
+ #networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)]
#network_deployments = NetworkDeployments.objects.filter(network__in=networks,
- #deployment=sliver.node.deployment)
+ #deployment=instance.node.deployment)
# Gather private networks first. This includes networks with a template that has
# visibility = private and translation = none
#for network_deployment in network_deployments:
@@ -78,11 +78,11 @@
# nics.append({'net-id': net['id']})
# look up image id
- instance_type = sliver.node.name.rsplit('.',1)[0]
+ instance_type = instance.node.name.rsplit('.',1)[0]
# Bail out of we don't have a key
- key_name = sliver.creator.email.lower().replace('@', 'AT').replace('.', '')
- u = sliver.creator
+ key_name = instance.creator.email.lower().replace('@', 'AT').replace('.', '')
+ u = instance.creator
s = u.site
e = get_creds(user=u, site=s)
key_sig = aws_run('ec2 describe-key-pairs', env=e)
@@ -95,23 +95,23 @@
if (not key_found):
# set backend_status
- raise Exception('Will not sync sliver without key')
+ raise Exception('Will not sync instance without key')
- image_id = sliver.image.path
- instance_sig = aws_run('ec2 run-instances --image-id %s --instance-type %s --count 1 --key-name %s --placement AvailabilityZone=%s'%(image_id,instance_type,key_name,sliver.node.site.name), env=e)
- sliver.instance_id = instance_sig['Instances'][0]['InstanceId']
- sliver.save()
+ image_id = instance.image.path
+ instance_sig = aws_run('ec2 run-instances --image-id %s --instance-type %s --count 1 --key-name %s --placement AvailabilityZone=%s'%(image_id,instance_type,key_name,instance.node.site.name), env=e)
+ instance.instance_id = instance_sig['Instances'][0]['InstanceId']
+ instance.save()
state = instance_sig['Instances'][0]['State']['Code']
if (state==16):
- sliver.ip = instance_sig['Instances'][0]['PublicIpAddress']
- sliver.save()
+ instance.ip = instance_sig['Instances'][0]['PublicIpAddress']
+ instance.save()
else:
# This status message should go into backend_status
raise Exception('Waiting for instance to start')
else:
- ret = aws_run('ec2 describe-instances --instance-ids %s'%sliver.instance_id, env=e)
+ ret = aws_run('ec2 describe-instances --instance-ids %s'%instance.instance_id, env=e)
state = ret['Reservations'][0]['Instances'][0]['State']['Code']
if (state==16):
- sliver.ip = ret['Reservations'][0]['Instances'][0]['PublicIpAddress']
- sliver.save()
+ instance.ip = ret['Reservations'][0]['Instances'][0]['PublicIpAddress']
+ instance.save()
diff --git a/xos/ec2_observer/syncstep.py b/xos/ec2_observer/syncstep.py
index 72adb87..e15e719 100644
--- a/xos/ec2_observer/syncstep.py
+++ b/xos/ec2_observer/syncstep.py
@@ -57,7 +57,7 @@
objs = main_obj.deleted_objects.all()
return objs
- #return Sliver.objects.filter(ip=None)
+ #return Instance.objects.filter(ip=None)
def check_dependencies(self, obj, failed):
for dep in self.dependencies:
diff --git a/xos/hpc/models.py b/xos/hpc/models.py
index 48ae0f0..e49bf4e 100644
--- a/xos/hpc/models.py
+++ b/xos/hpc/models.py
@@ -18,16 +18,16 @@
cmi_hostname = StrippedCharField(max_length=254, null=True, blank=True)
hpc_port80 = models.BooleanField(default=True, help_text="Enable port 80 for HPC")
- watcher_hpc_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact hpc sliver")
- watcher_dnsdemux_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact dnsdemux sliver")
- watcher_dnsredir_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact dnsredir sliver")
+ watcher_hpc_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact hpc instance")
+ watcher_dnsdemux_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact dnsdemux instance")
+ watcher_dnsredir_network = StrippedCharField(max_length=254, null=True, blank=True, help_text="Network for hpc_watcher to contact dnsredir instance")
@property
def scale(self):
hpc_slices = [x for x in self.slices.all() if "hpc" in x.name]
if not hpc_slices:
return 0
- return hpc_slices[0].slivers.count()
+ return hpc_slices[0].instances.count()
@scale.setter
def scale(self, value):
diff --git a/xos/hpc_wizard/xos_analytics.py b/xos/hpc_wizard/xos_analytics.py
index a95d3ae..9502aa1 100644
--- a/xos/hpc_wizard/xos_analytics.py
+++ b/xos/hpc_wizard/xos_analytics.py
@@ -15,7 +15,7 @@
from django.conf import settings
from django import db
from django.db import connection
-from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice, Service
+from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice, Service
BLUE_LOAD=5000000
RED_LOAD=15000000
@@ -228,17 +228,17 @@
# we didn't find it in the data model
continue
- allocated_slivers = 0
+ allocated_instances = 0
if model_site and slice:
- for sliver in slice.slivers.all():
- if sliver.node.site == model_site:
- allocated_slivers = allocated_slivers + 1
+ for instance in slice.instances.all():
+ if instance.node.site == model_site:
+ allocated_instances = allocated_instances + 1
row["lat"] = float(model_site.location.latitude)
row["long"] = float(model_site.location.longitude)
row["url"] = model_site.site_url
row["numNodes"] = model_site.nodes.count()
- row["allocated_slivers"] = allocated_slivers
+ row["allocated_instances"] = allocated_instances
max_cpu = row.get("max_avg_cpu", row.get("max_cpu",0))
cpu=float(max_cpu)/100.0
diff --git a/xos/importer/plclassic/importer.py b/xos/importer/plclassic/importer.py
index 864f4b9..de8628b 100644
--- a/xos/importer/plclassic/importer.py
+++ b/xos/importer/plclassic/importer.py
@@ -7,7 +7,7 @@
from plclassic.site_importer import SiteImporter
from plclassic.user_importer import UserImporter
from plclassic.slice_importer import SliceImporter
-from plclassic.sliver_importer import SliverImporter
+from plclassic.instance_importer import InstanceImporter
class Call:
@@ -36,14 +36,14 @@
self.sites = SiteImporter(api)
self.slices = SliceImporter(api)
self.users = UserImporter(api)
- self.slivers = SliverImporter(api)
+ self.instances = InstanceImporter(api)
def run(self):
self.sites.run()
self.users.run()
self.slices.run(remote_sites=self.sites.remote_sites,
local_sites=self.sites.local_sites)
- self.slivers.run()
+ self.instances.run()
diff --git a/xos/importer/plclassic/sliver_importer.py b/xos/importer/plclassic/instance_importer.py
similarity index 82%
rename from xos/importer/plclassic/sliver_importer.py
rename to xos/importer/plclassic/instance_importer.py
index 3f7912f..0858572 100644
--- a/xos/importer/plclassic/sliver_importer.py
+++ b/xos/importer/plclassic/instance_importer.py
@@ -1,6 +1,6 @@
from PLC.Nodes import Nodes
-class SliverImporter:
+class InstanceImporter:
def __init__(self, api):
self.api = api
diff --git a/xos/model_autodeletion.py b/xos/model_autodeletion.py
index f5288a0..2bfc48c 100644
--- a/xos/model_autodeletion.py
+++ b/xos/model_autodeletion.py
@@ -1 +1 @@
-ephemeral_models = ['ReservedResource','Sliver','Image','Network','Port','Tag','SitePrivilege','SliceMembership','SliceTag','Reservation','Slice']
+ephemeral_models = ['ReservedResource','Instance','Image','Network','Port','Tag','SitePrivilege','SliceMembership','SliceTag','Reservation','Slice']
diff --git a/xos/model_policies/__init__.py b/xos/model_policies/__init__.py
index a74e7be..36c6e25 100644
--- a/xos/model_policies/__init__.py
+++ b/xos/model_policies/__init__.py
@@ -1,5 +1,5 @@
from .model_policy_Slice import *
-from .model_policy_Sliver import *
+from .model_policy_Instance import *
from .model_policy_User import *
from .model_policy_Network import *
from .model_policy_Site import *
diff --git a/xos/model_policies/model_policy_Instance.py b/xos/model_policies/model_policy_Instance.py
new file mode 100644
index 0000000..a13428d
--- /dev/null
+++ b/xos/model_policies/model_policy_Instance.py
@@ -0,0 +1,13 @@
+
+def handle(instance):
+ from core.models import Controller, ControllerSlice, ControllerNetwork, NetworkSlice
+
+ networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)]
+ controller_networks = ControllerNetwork.objects.filter(network__in=networks,
+ controller=instance.node.site_deployment.controller)
+
+ for cn in controller_networks:
+ if (cn.lazy_blocked):
+ cn.lazy_blocked=False
+ cn.backend_register = '{}'
+ cn.save()
diff --git a/xos/model_policies/model_policy_Sliver.py b/xos/model_policies/model_policy_Sliver.py
index 0004e33..a13428d 100644
--- a/xos/model_policies/model_policy_Sliver.py
+++ b/xos/model_policies/model_policy_Sliver.py
@@ -1,10 +1,10 @@
-def handle(sliver):
+def handle(instance):
from core.models import Controller, ControllerSlice, ControllerNetwork, NetworkSlice
- networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
+ networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)]
controller_networks = ControllerNetwork.objects.filter(network__in=networks,
- controller=sliver.node.site_deployment.controller)
+ controller=instance.node.site_deployment.controller)
for cn in controller_networks:
if (cn.lazy_blocked):
diff --git a/xos/model_policy.py b/xos/model_policy.py
index 2813416..ce59a32 100644
--- a/xos/model_policy.py
+++ b/xos/model_policy.py
@@ -59,7 +59,7 @@
return
# These are the models whose children get deleted when they are
- delete_policy_models = ['Slice','Sliver','Network']
+ delete_policy_models = ['Slice','Instance','Network']
sender_name = instance.__class__.__name__
policy_name = 'model_policy_%s'%sender_name
noargs = False
@@ -97,10 +97,10 @@
pass
def run_policy():
- from core.models import Sliver,Slice,Controller,Network,User,SlicePrivilege,Site,SitePrivilege,Image,ControllerSlice,ControllerUser,ControllerSite
+ from core.models import Instance,Slice,Controller,Network,User,SlicePrivilege,Site,SitePrivilege,Image,ControllerSlice,ControllerUser,ControllerSite
while (True):
start = time.time()
- models = [Sliver,Slice, Controller, Network, User, SlicePrivilege, Site, SitePrivilege, Image, ControllerSlice, ControllerSite, ControllerUser]
+ models = [Instance,Slice, Controller, Network, User, SlicePrivilege, Site, SitePrivilege, Image, ControllerSlice, ControllerSite, ControllerUser]
objects = []
deleted_objects = []
diff --git a/xos/observers/base/SyncSliverUsingAnsible.py b/xos/observers/base/SyncSliverUsingAnsible.py
index c824595..9455780 100644
--- a/xos/observers/base/SyncSliverUsingAnsible.py
+++ b/xos/observers/base/SyncSliverUsingAnsible.py
@@ -13,7 +13,7 @@
logger = Logger(level=logging.INFO)
-class SyncSliverUsingAnsible(SyncStep):
+class SyncInstanceUsingAnsible(SyncStep):
# All of the following should be defined for classes derived from this
# base class. Examples below use VCPETenant.
@@ -36,13 +36,13 @@
return {}
- def get_sliver(self, o):
- # We need to know what sliver is associated with the object. Let's
- # assume 'o' has a field called 'sliver'. If the field is called
+ def get_instance(self, o):
+ # We need to know what instance is associated with the object. Let's
+ # assume 'o' has a field called 'instance'. If the field is called
# something else, or if custom logic is needed, then override this
# method.
- return o.sliver
+ return o.instance
def run_playbook(self, o, fields):
tStart = time.time()
@@ -61,9 +61,9 @@
def sync_record(self, o):
logger.info("sync'ing object %s" % str(o))
- sliver = self.get_sliver(o)
- if not sliver:
- self.defer_sync(o, "waiting on sliver")
+ instance = self.get_instance(o)
+ if not instance:
+ self.defer_sync(o, "waiting on instance")
return
if not os.path.exists(self.service_key_name):
@@ -71,9 +71,9 @@
service_key = file(self.service_key_name).read()
- fields = { "sliver_name": sliver.name,
- "hostname": sliver.node.name,
- "instance_id": sliver.instance_id,
+ fields = { "instance_name": instance.name,
+ "hostname": instance.node.name,
+ "instance_id": instance.instance_id,
"private_key": service_key,
"ansible_tag": "vcpe_tenant_" + str(o.id)
}
diff --git a/xos/observers/hpc/hpc_watcher.py b/xos/observers/hpc/hpc_watcher.py
index d098257..7c49aae 100644
--- a/xos/observers/hpc/hpc_watcher.py
+++ b/xos/observers/hpc/hpc_watcher.py
@@ -1,7 +1,7 @@
"""
hpc_watcher.py
- Daemon to watch the health of HPC and RR slivers.
+ Daemon to watch the health of HPC and RR instances.
This deamon uses HpcHealthCheck objects in the Data Model to conduct
periodic tests of HPC and RR nodes. Two types of Health Checks are
@@ -25,9 +25,9 @@
In addition to the above, HPC heartbeat probes are conducted, similar to
the ones that dnsredir conducts.
- The results of health checks are stored in a tag attached to the Sliver
+ The results of health checks are stored in a tag attached to the Instance
the healthcheck was conducted against. If all healthchecks of a particular
- variety were successful for a sliver, then "success" will be stored in
+ variety were successful for a instance, then "success" will be stored in
the tag. Otherwise, the first healthcheck to fail will be stored in the
tag.
@@ -351,50 +351,50 @@
Thread.__init__(self)
self.daemon = True
- def get_public_ip(self, service, sliver):
+ def get_public_ip(self, service, instance):
network_name = None
- if "hpc" in sliver.slice.name:
+ if "hpc" in instance.slice.name:
network_name = getattr(service, "watcher_hpc_network", None)
- elif "demux" in sliver.slice.name:
+ elif "demux" in instance.slice.name:
network_name = getattr(service, "watcher_dnsdemux_network", None)
- elif "redir" in sliver.slice.name:
+ elif "redir" in instance.slice.name:
network_name = getattr(service, "watcher_dnsredir_network", None)
if network_name and network_name.lower()=="nat":
return None
if (network_name is None) or (network_name=="") or (network_name.lower()=="public"):
- return sliver.get_public_ip()
+ return instance.get_public_ip()
- for ns in sliver.ports.all():
+ for ns in instance.ports.all():
if (ns.ip) and (ns.network.name==network_name):
return ns.ip
raise ValueError("Couldn't find network %s" % str(network_name))
- def set_status(self, sliver, service, kind, msg, check_error=True):
- #print sliver.node.name, kind, msg
+ def set_status(self, instance, service, kind, msg, check_error=True):
+ #print instance.node.name, kind, msg
if check_error:
- sliver.has_error = (msg!="success")
+ instance.has_error = (msg!="success")
- sliver_type = ContentType.objects.get_for_model(sliver)
+ instance_type = ContentType.objects.get_for_model(instance)
- t = Tag.objects.filter(service=service, name=kind+".msg", content_type__pk=sliver_type.id, object_id=sliver.id)
+ t = Tag.objects.filter(service=service, name=kind+".msg", content_type__pk=instance_type.id, object_id=instance.id)
if t:
t=t[0]
if (t.value != msg):
t.value = msg
t.save()
else:
- Tag(service=service, name=kind+".msg", content_object = sliver, value=msg).save()
+ Tag(service=service, name=kind+".msg", content_object = instance, value=msg).save()
- t = Tag.objects.filter(service=service, name=kind+".time", content_type__pk=sliver_type.id, object_id=sliver.id)
+ t = Tag.objects.filter(service=service, name=kind+".time", content_type__pk=instance_type.id, object_id=instance.id)
if t:
t=t[0]
t.value = str(time.time())
t.save()
else:
- Tag(service=service, name=kind+".time", content_object = sliver, value=str(time.time())).save()
+ Tag(service=service, name=kind+".time", content_object = instance, value=str(time.time())).save()
def get_service_slices(self, service, kind=None):
try:
@@ -416,51 +416,51 @@
for i in range(0,10):
DnsResolver(queue = self.resolver_queue)
- def check_request_routers(self, service, slivers):
- for sliver in slivers:
- sliver.has_error = False
+ def check_request_routers(self, service, instances):
+ for instance in instances:
+ instance.has_error = False
try:
- ip = self.get_public_ip(service, sliver)
+ ip = self.get_public_ip(service, instance)
except Exception, e:
- self.set_status(sliver, service, "watcher.DNS", "exception: %s" % str(e))
+ self.set_status(instance, service, "watcher.DNS", "exception: %s" % str(e))
continue
if not ip:
try:
- ip = socket.gethostbyname(sliver.node.name)
+ ip = socket.gethostbyname(instance.node.name)
except:
- self.set_status(sliver, service, "watcher.DNS", "dns resolution failure")
+ self.set_status(instance, service, "watcher.DNS", "dns resolution failure")
continue
if not ip:
- self.set_status(sliver, service, "watcher.DNS", "no IP address")
+ self.set_status(instance, service, "watcher.DNS", "no IP address")
continue
checks = HpcHealthCheck.objects.filter(kind="dns")
if not checks:
- self.set_status(sliver, service, "watcher.DNS", "no DNS HealthCheck tests configured")
+ self.set_status(instance, service, "watcher.DNS", "no DNS HealthCheck tests configured")
for check in checks:
- self.resolver_queue.submit_job({"domain": check.resource_name, "server": ip, "port": 53, "sliver": sliver, "result_contains": check.result_contains})
+ self.resolver_queue.submit_job({"domain": check.resource_name, "server": ip, "port": 53, "instance": instance, "result_contains": check.result_contains})
while self.resolver_queue.outstanding > 0:
result = self.resolver_queue.get_result()
- sliver = result["sliver"]
- if (result["status"]!="success") and (not sliver.has_error):
- self.set_status(sliver, service, "watcher.DNS", result["status"])
+ instance = result["instance"]
+ if (result["status"]!="success") and (not instance.has_error):
+ self.set_status(instance, service, "watcher.DNS", result["status"])
- for sliver in slivers:
- if not sliver.has_error:
- self.set_status(sliver, service, "watcher.DNS", "success")
+ for instance in instances:
+ if not instance.has_error:
+ self.set_status(instance, service, "watcher.DNS", "success")
def run_once(self):
for hpcService in HpcService.objects.all():
for slice in self.get_service_slices(hpcService, "dnsdemux"):
- self.check_request_routers(hpcService, slice.slivers.all())
+ self.check_request_routers(hpcService, slice.instances.all())
for rrService in RequestRouterService.objects.all():
for slice in self.get_service_slices(rrService, "dnsdemux"):
- self.check_request_routers(rrService, slice.slivers.all())
+ self.check_request_routers(rrService, slice.instances.all())
def run(self):
while True:
@@ -477,26 +477,26 @@
for i in range(0, 10):
HpcHeartbeat(queue = self.heartbeat_queue)
- def probe_hpc(self, service, slivers):
- for sliver in slivers:
- sliver.has_error = False
+ def probe_hpc(self, service, instances):
+ for instance in instances:
+ instance.has_error = False
- self.heartbeat_queue.submit_job({"server": sliver.node.name, "port": 8009, "sliver": sliver})
+ self.heartbeat_queue.submit_job({"server": instance.node.name, "port": 8009, "instance": instance})
while self.heartbeat_queue.outstanding > 0:
result = self.heartbeat_queue.get_result()
- sliver = result["sliver"]
- if (result["status"]!="success") and (not sliver.has_error):
- self.set_status(sliver, service, "watcher.HPC-hb", result["status"])
+ instance = result["instance"]
+ if (result["status"]!="success") and (not instance.has_error):
+ self.set_status(instance, service, "watcher.HPC-hb", result["status"])
- for sliver in slivers:
- if not sliver.has_error:
- self.set_status(sliver, service, "watcher.HPC-hb", "success")
+ for instance in instances:
+ if not instance.has_error:
+ self.set_status(instance, service, "watcher.HPC-hb", "success")
def run_once(self):
for hpcService in HpcService.objects.all():
for slice in self.get_service_slices(hpcService, "hpc"):
- self.probe_hpc(hpcService, slice.slivers.all())
+ self.probe_hpc(hpcService, slice.instances.all())
def run(self):
while True:
@@ -513,42 +513,42 @@
for i in range(0, 10):
HpcFetchUrl(queue = self.fetch_queue)
- def fetch_hpc(self, service, slivers):
- for sliver in slivers:
- sliver.has_error = False
- sliver.url_status = []
+ def fetch_hpc(self, service, instances):
+ for instance in instances:
+ instance.has_error = False
+ instance.url_status = []
checks = HpcHealthCheck.objects.filter(kind="http")
if not checks:
- self.set_status(sliver, service, "watcher.HPC-fetch", "no HTTP HealthCheck tests configured")
+ self.set_status(instance, service, "watcher.HPC-fetch", "no HTTP HealthCheck tests configured")
for check in checks:
if (not check.resource_name) or (":" not in check.resource_name):
- self.set_status(sliver, service, "watcher.HPC-fetch", "malformed resource_name: " + str(check.resource_name))
+ self.set_status(instance, service, "watcher.HPC-fetch", "malformed resource_name: " + str(check.resource_name))
break
(domain, url) = check.resource_name.split(":",1)
- self.fetch_queue.submit_job({"server": sliver.node.name, "port": 80, "sliver": sliver, "domain": domain, "url": url})
+ self.fetch_queue.submit_job({"server": instance.node.name, "port": 80, "instance": instance, "domain": domain, "url": url})
while self.fetch_queue.outstanding > 0:
result = self.fetch_queue.get_result()
- sliver = result["sliver"]
+ instance = result["instance"]
if (result["status"] == "success"):
- sliver.url_status.append( (result["domain"] + result["url"], "success", result["bytes_downloaded"], result["total_time"]) )
- if (result["status"]!="success") and (not sliver.has_error):
- self.set_status(sliver, service, "watcher.HPC-fetch", result["status"])
+ instance.url_status.append( (result["domain"] + result["url"], "success", result["bytes_downloaded"], result["total_time"]) )
+ if (result["status"]!="success") and (not instance.has_error):
+ self.set_status(instance, service, "watcher.HPC-fetch", result["status"])
- for sliver in slivers:
- self.set_status(sliver, service, "watcher.HPC-fetch-urls", json.dumps(sliver.url_status), check_error=False)
- if not sliver.has_error:
- self.set_status(sliver, service, "watcher.HPC-fetch", "success")
+ for instance in instances:
+ self.set_status(instance, service, "watcher.HPC-fetch-urls", json.dumps(instance.url_status), check_error=False)
+ if not instance.has_error:
+ self.set_status(instance, service, "watcher.HPC-fetch", "success")
def run_once(self):
for hpcService in HpcService.objects.all():
for slice in self.get_service_slices(hpcService, "hpc"):
try:
- self.fetch_hpc(hpcService, slice.slivers.all())
+ self.fetch_hpc(hpcService, slice.instances.all())
except:
traceback.print_exc()
@@ -567,41 +567,41 @@
for i in range(0, 10):
WatcherWorker(queue = self.fetch_queue)
- def fetch_watcher(self, service, slivers):
- for sliver in slivers:
+ def fetch_watcher(self, service, instances):
+ for instance in instances:
try:
- ip = self.get_public_ip(service, sliver)
+ ip = self.get_public_ip(service, instance)
except Exception, e:
- self.set_status(sliver, service, "watcher.watcher", json.dumps({"status": "exception: %s" % str(e)}) )
+ self.set_status(instance, service, "watcher.watcher", json.dumps({"status": "exception: %s" % str(e)}) )
continue
if not ip:
try:
- ip = socket.gethostbyname(sliver.node.name)
+ ip = socket.gethostbyname(instance.node.name)
except:
- self.set_status(sliver, service, "watcher.watcher", json.dumps({"status": "dns resolution failure"}) )
+ self.set_status(instance, service, "watcher.watcher", json.dumps({"status": "dns resolution failure"}) )
continue
if not ip:
- self.set_status(sliver, service, "watcher.watcher", json.dumps({"status": "no IP address"}) )
+ self.set_status(instance, service, "watcher.watcher", json.dumps({"status": "no IP address"}) )
continue
port = 8015
- if ("redir" in sliver.slice.name):
+ if ("redir" in instance.slice.name):
port = 8016
- elif ("demux" in sliver.slice.name):
+ elif ("demux" in instance.slice.name):
port = 8017
- self.fetch_queue.submit_job({"server": ip, "port": port, "sliver": sliver})
+ self.fetch_queue.submit_job({"server": ip, "port": port, "instance": instance})
while self.fetch_queue.outstanding > 0:
result = self.fetch_queue.get_result()
- sliver = result["sliver"]
- self.set_status(sliver, service, "watcher.watcher", result["status"])
+ instance = result["instance"]
+ self.set_status(instance, service, "watcher.watcher", result["status"])
def run_once(self):
for hpcService in HpcService.objects.all():
for slice in self.get_service_slices(hpcService):
- self.fetch_watcher(hpcService, slice.slivers.all())
+ self.fetch_watcher(hpcService, slice.instances.all())
def run(self):
while True:
diff --git a/xos/observers/hpc/hpclib.py b/xos/observers/hpc/hpclib.py
index 30dbe87..51864a5 100644
--- a/xos/observers/hpc/hpclib.py
+++ b/xos/observers/hpc/hpclib.py
@@ -99,11 +99,11 @@
for slice in slices:
if slice.name.endswith("cmi"):
- for sliver in slice.slivers.all():
- if sliver.node:
- return sliver.node.name
+ for instance in slice.instances.all():
+ if instance.node:
+ return instance.node.name
- raise Exception("Failed to find a CMI sliver")
+ raise Exception("Failed to find a CMI instance")
@property
def client(self):
diff --git a/xos/observers/vbng/steps/sync_vbngtenant.py b/xos/observers/vbng/steps/sync_vbngtenant.py
index 18adfc8..8868d6f 100644
--- a/xos/observers/vbng/steps/sync_vbngtenant.py
+++ b/xos/observers/vbng/steps/sync_vbngtenant.py
@@ -63,10 +63,10 @@
raise Exception("More than one vCPE tenant is associated with vBNG %s" % str(o.id))
vcpe = vcpes[0]
- sliver = vcpe.sliver
+ instance = vcpe.instance
- if not sliver:
- raise Exception("No sliver associated with vBNG %s" % str(o.id))
+ if not instance:
+ raise Exception("No instance associated with vBNG %s" % str(o.id))
if not vcpe.wan_ip:
self.defer_sync(o, "does not have a WAN IP yet")
@@ -75,7 +75,7 @@
# this should never happen; WAN MAC is computed from WAN IP
self.defer_sync(o, "does not have a WAN MAC yet")
- return (vcpe.wan_ip, vcpe.wan_mac, vcpe.sliver.node.name)
+ return (vcpe.wan_ip, vcpe.wan_mac, vcpe.instance.node.name)
def sync_record(self, o):
logger.info("sync'ing VBNGTenant %s" % str(o))
diff --git a/xos/observers/vcpe/observer_ansible_test.py b/xos/observers/vcpe/observer_ansible_test.py
index 1b4358d..77715af 100644
--- a/xos/observers/vcpe/observer_ansible_test.py
+++ b/xos/observers/vcpe/observer_ansible_test.py
@@ -37,7 +37,7 @@
"""
observer.ansible.run_template_ssh("test.yaml",
- {"sliver_name": "onlab_test405-378",
+ {"instance_name": "onlab_test405-378",
"instance_id": "instance-0000004d",
"hostname": "node67.washington.vicci.org",
"private_key": private_key})
diff --git a/xos/observers/vcpe/steps/ansible_test/xos.py b/xos/observers/vcpe/steps/ansible_test/xos.py
index 3ef72ab..eb4f3eb 100755
--- a/xos/observers/vcpe/steps/ansible_test/xos.py
+++ b/xos/observers/vcpe/steps/ansible_test/xos.py
@@ -48,13 +48,13 @@
self.HASHED_KEY_MAGIC = "|1|"
self.has_pipelining = True
#self.instance_id = "instance-00000045" # C.get_config(C.p, "xos", "instance_id", "INSTANCE_ID", None)
- #self.sliver_name = "onlab_hpc-355" # C.get_config(C.p, "xos", "sliver_name", "SLIVER_NAME", None)
+ #self.instance_name = "onlab_hpc-355" # C.get_config(C.p, "xos", "instance_name", "SLIVER_NAME", None)
inject={}
inject= utils.combine_vars(inject, self.runner.inventory.get_variables(self.host))
self.instance_id = inject["instance_id"]
- self.sliver_name = inject["sliver_name"]
+ self.instance_name = inject["instance_name"]
fcntl.lockf(self.runner.process_lockfile, fcntl.LOCK_EX)
self.cp_dir = utils.prepare_writeable_dir('$HOME/.ansible/cp',mode=0700)
@@ -282,7 +282,7 @@
if self.ipv6:
ssh_cmd += ['-6']
#ssh_cmd += [self.host]
- ssh_cmd += [self.sliver_name]
+ ssh_cmd += [self.instance_name]
if su and su_user:
sudocmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd)
diff --git a/xos/observers/vcpe/steps/sync_vcpetenant.py b/xos/observers/vcpe/steps/sync_vcpetenant.py
index ecc7b7c..1a45b54 100644
--- a/xos/observers/vcpe/steps/sync_vcpetenant.py
+++ b/xos/observers/vcpe/steps/sync_vcpetenant.py
@@ -8,7 +8,7 @@
from xos.config import Config
from observer.syncstep import SyncStep
from observer.ansible import run_template_ssh
-from observers.base.SyncSliverUsingAnsible import SyncSliverUsingAnsible
+from observers.base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from core.models import Service, Slice
from cord.models import VCPEService, VCPETenant, VOLTTenant
from hpc.models import HpcService, CDNPrefix
@@ -22,7 +22,7 @@
logger = Logger(level=logging.INFO)
-class SyncVCPETenant(SyncSliverUsingAnsible):
+class SyncVCPETenant(SyncInstanceUsingAnsible):
provides=[VCPETenant]
observes=VCPETenant
requested_interval=0
@@ -67,21 +67,21 @@
for service in HpcService.objects.all():
for slice in service.slices.all():
if "dnsdemux" in slice.name:
- for sliver in slice.slivers.all():
- for ns in sliver.ports.all():
+ for instance in slice.instances.all():
+ for ns in instance.ports.all():
if ns.ip and ns.network.labels and (vcpe_service.backend_network_label in ns.network.labels):
dnsdemux_ip = ns.ip
if not dnsdemux_ip:
logger.info("failed to find a dnsdemux on network %s" % vcpe_service.backend_network_label)
else:
- # Connect to dnsdemux using the sliver's public address
+ # Connect to dnsdemux using the instance's public address
for service in HpcService.objects.all():
for slice in service.slices.all():
if "dnsdemux" in slice.name:
- for sliver in slice.slivers.all():
+ for instance in slice.instances.all():
if dnsdemux_ip=="none":
try:
- dnsdemux_ip = socket.gethostbyname(sliver.node.name)
+ dnsdemux_ip = socket.gethostbyname(instance.node.name)
except:
pass
if not dnsdemux_ip:
@@ -99,8 +99,8 @@
bbs_addrs = []
if vcpe_service.bbs_slice:
if vcpe_service.backend_network_label:
- for bbs_sliver in vcpe_service.bbs_slice.slivers.all():
- for ns in bbs_sliver.ports.all():
+ for bbs_instance in vcpe_service.bbs_slice.instances.all():
+ for ns in bbs_instance.ports.all():
if ns.ip and ns.network.labels and (vcpe_service.backend_network_label in ns.network.labels):
bbs_addrs.append(ns.ip)
else:
@@ -147,11 +147,11 @@
# Ansible uses the service's keypair in order to SSH into the
# instance. It would be bad if the slice had no service.
- raise Exception("Slice %s is not associated with a service" % sliver.slice.name)
+ raise Exception("Slice %s is not associated with a service" % instance.slice.name)
# Make sure the slice is configured properly
- if (service != o.sliver.slice.service):
- raise Exception("Slice %s is associated with some service that is not %s" % (str(sliver.slice), str(service)))
+ if (service != o.instance.slice.service):
+ raise Exception("Slice %s is associated with some service that is not %s" % (str(instance.slice), str(service)))
# only enable filtering if we have a subscriber object (see below)
url_filter_enable = False
diff --git a/xos/openstack/sliveragent.py b/xos/openstack/instanceagent.py
similarity index 67%
rename from xos/openstack/sliveragent.py
rename to xos/openstack/instanceagent.py
index 4aea44d..8e50cf3 100644
--- a/xos/openstack/sliveragent.py
+++ b/xos/openstack/instanceagent.py
@@ -2,10 +2,10 @@
import sys
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
import time
-from core.models.sliver import Sliver
+from core.models.instance import Instance
from openstack.manager import OpenStackManager
-class SliverAgent:
+class InstanceAgent:
def run(self):
manager = OpenStackManager()
@@ -15,25 +15,25 @@
while True :
# fill in null ip addresses
- slivers = Sliver.objects.filter(ip=None)
- for sliver in slivers:
+ instances = Instance.objects.filter(ip=None)
+ for instance in instances:
# update connection
manager.client.connect(username=manager.client.keystone.username,
password=manager.client.keystone.password,
- tenant=sliver.slice.name)
- sliver.os_manager = manager
- servers = manager.client.nova.servers.findall(id=sliver.instance_id)
+ tenant=instance.slice.name)
+ instance.os_manager = manager
+ servers = manager.client.nova.servers.findall(id=instance.instance_id)
if not servers:
continue
server = servers[0]
- ips = server.addresses.get(sliver.slice.name, [])
+ ips = server.addresses.get(instance.slice.name, [])
if not ips:
continue
- sliver.ip = ips[0]['addr']
- sliver.save()
+ instance.ip = ips[0]['addr']
+ instance.save()
time.sleep(7)
if __name__ == '__main__':
- SliverAgent().run()
+ InstanceAgent().run()
diff --git a/xos/openstack/manager.py b/xos/openstack/manager.py
index 42b1ef1..45d49b4 100644
--- a/xos/openstack/manager.py
+++ b/xos/openstack/manager.py
@@ -314,47 +314,47 @@
return networks
@require_enabled
- def save_sliver(self, sliver):
+ def save_instance(self, instance):
metadata_update = {}
- if ("numberCores" in sliver.changed_fields):
- metadata_update["cpu_cores"] = str(sliver.numberCores)
+ if ("numberCores" in instance.changed_fields):
+ metadata_update["cpu_cores"] = str(instance.numberCores)
- for tag in sliver.slice.tags.all():
+ for tag in instance.slice.tags.all():
if tag.name.startswith("sysctl-"):
metadata_update[tag.name] = tag.value
- if not sliver.instance_id:
- nics = self.get_requested_networks(sliver.slice)
+ if not instance.instance_id:
+ nics = self.get_requested_networks(instance.slice)
for nic in nics:
# If a network hasn't been instantiated yet, then we'll fail
- # during slice creation. Defer saving the sliver for now.
+ # during slice creation. Defer saving the instance for now.
if not nic.get("net-id", None):
- sliver.save() # in case it hasn't been saved yet
+ instance.save() # in case it hasn't been saved yet
return
- slice_memberships = SliceMembership.objects.filter(slice=sliver.slice)
+ slice_memberships = SliceMembership.objects.filter(slice=instance.slice)
pubkeys = [sm.user.public_key for sm in slice_memberships if sm.user.public_key]
- pubkeys.append(sliver.creator.public_key)
- instance = self.driver.spawn_instance(name=sliver.name,
- key_name = sliver.creator.keyname,
- image_id = sliver.image.image_id,
- hostname = sliver.node.name,
+ pubkeys.append(instance.creator.public_key)
+ instance = self.driver.spawn_instance(name=instance.name,
+ key_name = instance.creator.keyname,
+ image_id = instance.image.image_id,
+ hostname = instance.node.name,
pubkeys = pubkeys,
nics = nics,
metadata = metadata_update )
- sliver.instance_id = instance.id
- sliver.instance_name = getattr(instance, 'OS-EXT-SRV-ATTR:instance_name')
+ instance.instance_id = instance.id
+ instance.instance_name = getattr(instance, 'OS-EXT-SRV-ATTR:instance_name')
else:
if metadata_update:
- self.driver.update_instance_metadata(sliver.instance_id, metadata_update)
+ self.driver.update_instance_metadata(instance.instance_id, metadata_update)
- sliver.save()
- sliver.enacted = datetime.now()
- sliver.save(update_fields=['enacted'])
+ instance.save()
+ instance.enacted = datetime.now()
+ instance.save(update_fields=['enacted'])
@require_enabled
- def delete_sliver(self, sliver):
- if sliver.instance_id:
- self.driver.destroy_instance(sliver.instance_id)
+ def delete_instance(self, instance):
+ if instance.instance_id:
+ self.driver.destroy_instance(instance.instance_id)
def refresh_nodes(self):
diff --git a/xos/openstack/reservationagent.py b/xos/openstack/reservationagent.py
index cee5269..5cb9c8e 100644
--- a/xos/openstack/reservationagent.py
+++ b/xos/openstack/reservationagent.py
@@ -4,14 +4,14 @@
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
import time
import django.utils
-from core.models.sliver import Sliver
+from core.models.instance import Instance
from core.models.reservation import Reservation, ReservedResource
class ReservationAgent:
def run(self):
while True :
- slivers = {}
+ instances = {}
tNow = django.utils.timezone.now()
print "Processing reservations, tNow is %s" % tNow
@@ -22,25 +22,25 @@
print " deleting expired reservation"
reservation.delete()
for reservedResource in reservation.reservedresources.all():
- sliver_resources = slivers.get(reservedResource.sliver.id, {})
- sliver_resources[reservedResource.resource.name] = reservedResource.quantity
- slivers[reservedResource.sliver.id] = sliver_resources
+ instance_resources = instances.get(reservedResource.instance.id, {})
+ instance_resources[reservedResource.resource.name] = reservedResource.quantity
+ instances[reservedResource.instance.id] = instance_resources
- print "Sliver reservation set"
- for (sliverid, sliver_resources) in slivers.items():
- print " sliver", sliverid,
- for (name, value) in sliver_resources.items():
+ print "Instance reservation set"
+ for (instanceid, instance_resources) in instances.items():
+ print " instance", instanceid,
+ for (name, value) in instance_resources.items():
print str(name)+":", value,
print
- print "Updating slivers"
- for sliver in Sliver.objects.all():
- sliver_resv = slivers.get(sliver.id, {})
- numberCores = sliver_resv.get("numberCores", 0)
- if numberCores != sliver.numberCores:
- print "sliver %s setting numberCores to %s" % (sliver.name, numberCores)
- sliver.numberCores = numberCores
- sliver.save()
+ print "Updating instances"
+ for instance in Instance.objects.all():
+ instance_resv = instances.get(instance.id, {})
+ numberCores = instance_resv.get("numberCores", 0)
+ if numberCores != instance.numberCores:
+ print "instance %s setting numberCores to %s" % (instance.name, numberCores)
+ instance.numberCores = numberCores
+ instance.save()
print "sleep"
time.sleep(7)
diff --git a/xos/openstack_observer/ansible.py b/xos/openstack_observer/ansible.py
index 0e006ae..fad7610 100755
--- a/xos/openstack_observer/ansible.py
+++ b/xos/openstack_observer/ansible.py
@@ -136,7 +136,7 @@
def run_template_ssh(name, opts, path='', expected_num=None):
instance_id = opts["instance_id"]
- sliver_name = opts["sliver_name"]
+ instance_name = opts["instance_name"]
hostname = opts["hostname"]
private_key = opts["private_key"]
nat_ip = opts["nat_ip"]
@@ -167,7 +167,7 @@
f.close()
f = open(hosts_pathname, "w")
- f.write("[%s]\n" % sliver_name)
+ f.write("[%s]\n" % instance_name)
if proxy_ssh:
f.write("%s ansible_ssh_private_key_file=%s\n" % (hostname, private_key_pathname))
else:
diff --git a/xos/openstack_observer/ceilometer.py b/xos/openstack_observer/ceilometer.py
index 9944a9c..792515e 100644
--- a/xos/openstack_observer/ceilometer.py
+++ b/xos/openstack_observer/ceilometer.py
@@ -14,7 +14,7 @@
from core.models import *
filter_dict = {
'ControllerSlice':[ControllerSlice, 'tenant_id', 'project_id'],
- 'Sliver':[Sliver, 'instance_id', 'resource_id'],
+ 'Instance':[Instance, 'instance_id', 'resource_id'],
'ControllerSite':[ControllerSite, 'tenant_id', 'project_id']
}
diff --git a/xos/openstack_observer/event_loop.py b/xos/openstack_observer/event_loop.py
index b6eceb3..fc07e7d 100644
--- a/xos/openstack_observer/event_loop.py
+++ b/xos/openstack_observer/event_loop.py
@@ -192,9 +192,10 @@
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(step_graph)
self.ordered_steps = toposort(self.dependency_graph, map(lambda s:s.__name__,self.sync_steps))
- #self.ordered_steps = ['SyncRoles', 'SyncControllerSites', 'SyncControllerSitePrivileges','SyncImages', 'SyncControllerImages','SyncControllerUsers','SyncControllerUserSitePrivileges','SyncControllerSlices', 'SyncControllerSlicePrivileges', 'SyncControllerUserSlicePrivileges', 'SyncControllerNetworks','SyncSlivers']
+ #self.ordered_steps = ['SyncRoles', 'SyncControllerSites', 'SyncControllerSitePrivileges','SyncImages', 'SyncControllerImages','SyncControllerUsers','SyncControllerUserSitePrivileges','SyncControllerSlices', 'SyncControllerSlicePrivileges', 'SyncControllerUserSlicePrivileges', 'SyncControllerNetworks','SyncInstances']
#self.ordered_steps = ['SyncControllerSites','SyncRoles','SyncControllerUsers','SyncControllerSlices','SyncControllerNetworks']
#self.ordered_steps = ['SyncControllerNetworks']
+ #self.ordered_steps = ['SyncInstances','SyncNetworkInstances']
print "Order of steps=",self.ordered_steps
diff --git a/xos/openstack_observer/steps/sync_controller_networks.py b/xos/openstack_observer/steps/sync_controller_networks.py
index eecba85..54f2466 100644
--- a/xos/openstack_observer/steps/sync_controller_networks.py
+++ b/xos/openstack_observer/steps/sync_controller_networks.py
@@ -8,7 +8,7 @@
from observer.syncstep import *
from core.models.network import *
from core.models.slice import *
-from core.models.sliver import Sliver
+from core.models.instance import Instance
from util.logger import observer_logger as logger
from observer.ansible import *
from openstack.driver import OpenStackDriver
diff --git a/xos/openstack_observer/steps/sync_controller_slices.py b/xos/openstack_observer/steps/sync_controller_slices.py
index ef69496..c456a2f 100644
--- a/xos/openstack_observer/steps/sync_controller_slices.py
+++ b/xos/openstack_observer/steps/sync_controller_slices.py
@@ -42,7 +42,7 @@
controller_user = controller_users[0]
roles = ['admin']
- max_instances=int(controller_slice.slice.max_slivers)
+ max_instances=int(controller_slice.slice.max_instances)
tenant_fields = {'endpoint':controller_slice.controller.auth_url,
'admin_user': controller_slice.controller.admin_user,
'admin_password': controller_slice.controller.admin_password,
@@ -60,7 +60,7 @@
if (not controller_slice.tenant_id):
try:
driver = OpenStackDriver().admin_driver(controller=controller_slice.controller)
- driver.shell.nova.quotas.update(tenant_id=tenant_id, instances=int(controller_slice.slice.max_slivers))
+ driver.shell.nova.quotas.update(tenant_id=tenant_id, instances=int(controller_slice.slice.max_instances))
except:
logger.log_exc('Could not update quota for %s'%controller_slice.slice.name)
raise Exception('Could not update quota for %s'%controller_slice.slice.name)
diff --git a/xos/openstack_observer/steps/sync_instances.py b/xos/openstack_observer/steps/sync_instances.py
new file mode 100644
index 0000000..cbcdec6
--- /dev/null
+++ b/xos/openstack_observer/steps/sync_instances.py
@@ -0,0 +1,196 @@
+import os
+import base64
+import socket
+from django.db.models import F, Q
+from xos.config import Config
+from xos.settings import RESTAPI_HOSTNAME, RESTAPI_PORT
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models.instance import Instance
+from core.models.slice import Slice, SlicePrivilege, ControllerSlice
+from core.models.network import Network, NetworkSlice, ControllerNetwork
+from observer.ansible import *
+from observer.syncstep import *
+from util.logger import observer_logger as logger
+
+def escape(s):
+ s = s.replace('\n',r'\n').replace('"',r'\"')
+ return s
+
+class SyncInstances(OpenStackSyncStep):
+ provides=[Instance]
+ requested_interval=0
+ observes=Instance
+
+ def get_userdata(self, instance, pubkeys):
+ userdata = '#cloud-config\n\nopencloud:\n slicename: "%s"\n hostname: "%s"\n restapi_hostname: "%s"\n restapi_port: "%s"\n' % (instance.slice.name, instance.node.name, RESTAPI_HOSTNAME, str(RESTAPI_PORT))
+ userdata += 'ssh_authorized_keys:\n'
+ for key in pubkeys:
+ userdata += ' - %s\n' % key
+ return userdata
+
+ def sync_record(self, instance):
+ logger.info("sync'ing instance:%s slice:%s controller:%s " % (instance, instance.slice.name, instance.node.site_deployment.controller))
+ controller_register = json.loads(instance.node.site_deployment.controller.backend_register)
+
+ if (controller_register.get('disabled',False)):
+ raise InnocuousException('Controller %s is disabled'%instance.node.site_deployment.controller.name)
+
+ metadata_update = {}
+ if (instance.numberCores):
+ metadata_update["cpu_cores"] = str(instance.numberCores)
+
+ for tag in instance.slice.tags.all():
+ if tag.name.startswith("sysctl-"):
+ metadata_update[tag.name] = tag.value
+
+ # public keys
+ slice_memberships = SlicePrivilege.objects.filter(slice=instance.slice)
+ pubkeys = set([sm.user.public_key for sm in slice_memberships if sm.user.public_key])
+ if instance.creator.public_key:
+ pubkeys.add(instance.creator.public_key)
+
+ if instance.slice.creator.public_key:
+ pubkeys.add(instance.slice.creator.public_key)
+
+ if instance.slice.service and instance.slice.service.public_key:
+ pubkeys.add(instance.slice.service.public_key)
+
+ # Handle any ports that are already created and attached to the sliver.
+ # If we do have a port for a network, then add that network to an
+ # exclude list so we won't try to auto-create ports on that network
+ # when instantiating.
+ ports = []
+ exclude_networks = set()
+ exclude_templates = set()
+ for ns in sliver.ports.all():
+ if not ns.port_id:
+ raise DeferredException("Port %s on sliver %s has no id; Try again later" % (str(ns), str(sliver)) )
+ ports.append(ns.port_id)
+ exclude_networks.add(ns.network)
+ exclude_templates.add(ns.network.template)
+
+ nics = []
+ networks = [ns.network for ns in NetworkSlice.objects.filter(slice=instance.slice)]
+ networks = [n for n in networks if (n not in exclude_networks)]
+ controller_networks = ControllerNetwork.objects.filter(network__in=networks,
+ controller=instance.node.site_deployment.controller)
+
+ for controller_network in controller_networks:
+ if controller_network.network.template.visibility == 'private' and \
+ controller_network.network.template.translation == 'none':
+ if not controller_network.net_id:
+ raise DeferredException("Private Network %s has no id; Try again later" % controller_network.network.name)
+ nics.append(controller_network.net_id)
+
+ # Now include network templates, for those networks that use a
+ # shared_network_name.
+ network_templates = [network.template.shared_network_name for network in networks \
+ if network.template.shared_network_name]
+ network_templates = [nt for nt in network_templates if (nt not in exclude_templates)]
+
+ #driver = self.driver.client_driver(caller=instance.creator, tenant=instance.slice.name, controller=instance.controllerNetwork)
+ driver = self.driver.admin_driver(tenant='admin', controller=instance.node.site_deployment.controller)
+ nets = driver.shell.quantum.list_networks()['networks']
+ for net in nets:
+ if net['name'] in network_templates:
+ nics.append(net['id'])
+
+ # If the slice isn't connected to anything, then at least put it on
+ # the public network.
+ if (not nics) and (not ports):
+ for net in nets:
+ if net['name']=='public':
+ nics.append(net['id'])
+
+ image_name = None
+ controller_images = instance.image.controllerimages.filter(controller=instance.node.site_deployment.controller)
+ if controller_images:
+ image_name = controller_images[0].image.name
+ logger.info("using image from ControllerImage object: " + str(image_name))
+
+ if image_name is None:
+ controller_driver = self.driver.admin_driver(controller=instance.node.site_deployment.controller)
+ images = controller_driver.shell.glanceclient.images.list()
+ for image in images:
+ if image.name == instance.image.name or not image_name:
+ image_name = image.name
+ logger.info("using image from glance: " + str(image_name))
+
+ try:
+ legacy = Config().observer_legacy
+ except:
+ legacy = False
+
+ if (legacy):
+ host_filter = instance.node.name.split('.',1)[0]
+ else:
+ host_filter = instance.node.name.strip()
+
+ availability_zone_filter = 'nova:%s'%host_filter
+ instance_name = '%s-%d'%(instance.slice.name,instance.id)
+
+ userData = self.get_userdata(instance, pubkeys)
+ if instance.userData:
+ userData = instance.userData
+
+ controller = instance.node.site_deployment.controller
+ tenant_fields = {'endpoint':controller.auth_url,
+ 'admin_user': instance.creator.email,
+ 'admin_password': instance.creator.remote_password,
+ 'admin_tenant': instance.slice.name,
+ 'tenant': instance.slice.name,
+ 'tenant_description': instance.slice.description,
+ 'name':instance_name,
+ 'ansible_tag':instance_name,
+ 'availability_zone': availability_zone_filter,
+ 'image_name':image_name,
+ 'flavor_name':instance.flavor.name,
+ 'nics':nics,
+ 'ports':ports,
+ 'meta':metadata_update,
+ 'user_data':r'%s'%escape(userData)}
+
+ res = run_template('sync_instances.yaml', tenant_fields,path='instances', expected_num=1)
+ instance_id = res[0]['info']['OS-EXT-SRV-ATTR:instance_name']
+ instance_uuid = res[0]['id']
+
+ try:
+ hostname = res[0]['info']['OS-EXT-SRV-ATTR:hypervisor_hostname']
+ ip = socket.gethostbyname(hostname)
+ instance.ip = ip
+ except:
+ pass
+
+ instance.instance_id = instance_id
+ instance.instance_uuid = instance_uuid
+ instance.instance_name = instance_name
+ instance.save()
+
+ def delete_record(self, instance):
+ controller_register = json.loads(instance.node.site_deployment.controller.backend_register)
+
+ if (controller_register.get('disabled',False)):
+ raise InnocuousException('Controller %s is disabled'%instance.node.site_deployment.controller.name)
+
+ instance_name = '%s-%d'%(instance.slice.name,instance.id)
+ controller = instance.node.site_deployment.controller
+ tenant_fields = {'endpoint':controller.auth_url,
+ 'admin_user': instance.creator.email,
+ 'admin_password': instance.creator.remote_password,
+ 'admin_tenant': instance.slice.name,
+ 'tenant': instance.slice.name,
+ 'tenant_description': instance.slice.description,
+ 'name':instance_name,
+ 'ansible_tag':instance_name,
+ 'delete': True}
+
+ try:
+ res = run_template('sync_instances.yaml', tenant_fields,path='instances', expected_num=1)
+ except Exception,e:
+ print "Could not sync %s"%instance_name
+ #import traceback
+ #traceback.print_exc()
+ raise e
+
+ if (len(res)!=1):
+ raise Exception('Could not delete instance %s'%instance.slice.name)
diff --git a/xos/openstack_observer/steps/sync_ports.py b/xos/openstack_observer/steps/sync_ports.py
index b7543f5..15fd4a1 100644
--- a/xos/openstack_observer/steps/sync_ports.py
+++ b/xos/openstack_observer/steps/sync_ports.py
@@ -17,7 +17,7 @@
# which Network is associated from the port.
def call(self, **args):
- logger.info("sync'ing network slivers")
+ logger.info("sync'ing network instances")
ports = Port.objects.all()
ports_by_id = {}
@@ -36,10 +36,10 @@
#for (network_id, network) in networks_by_id.items():
# logger.info(" %s: %s" % (network_id, network.name))
- slivers = Sliver.objects.all()
- slivers_by_instance_uuid = {}
- for sliver in slivers:
- slivers_by_instance_uuid[sliver.instance_uuid] = sliver
+ instances = Instance.objects.all()
+ instances_by_instance_uuid = {}
+ for instance in instances:
+ instances_by_instance_uuid[instance.instance_uuid] = instance
# Get all ports in all controllers
@@ -84,25 +84,25 @@
#logger.info("port %s is not a compute port, it is a %s" % (port["id"], port["device_owner"]))
continue
- sliver = slivers_by_instance_uuid.get(port['device_id'], None)
- if not sliver:
- logger.info("no sliver for port %s device_id %s" % (port["id"], port['device_id']))
+ instance = instances_by_instance_uuid.get(port['device_id'], None)
+ if not instance:
+ logger.info("no instance for port %s device_id %s" % (port["id"], port['device_id']))
continue
network = networks_by_id.get(port['network_id'], None)
if not network:
# maybe it's public-nat or public-dedicated. Search the templates for
- # the id, then see if the sliver's slice has some network that uses
+ # the id, then see if the instance's slice has some network that uses
# that template
template = templates_by_id.get(port['network_id'], None)
- if template and sliver.slice:
- for candidate_network in sliver.slice.networks.all():
+ if template and instance.slice:
+ for candidate_network in instance.slice.networks.all():
if candidate_network.template == template:
network=candidate_network
if not network:
logger.info("no network for port %s network %s" % (port["id"], port["network_id"]))
- # we know it's associated with a sliver, but we don't know
+ # we know it's associated with a instance, but we don't know
# which network it is part of.
continue
@@ -114,7 +114,7 @@
networks = network.template.network_set.all()
network = None
for candidate_network in networks:
- if (candidate_network.owner == sliver.slice):
+ if (candidate_network.owner == instance.slice):
print "found network", candidate_network
network = candidate_network
@@ -128,10 +128,10 @@
ip=port["fixed_ips"][0]["ip_address"]
mac=port["mac_address"]
- logger.info("creating Port (%s, %s, %s, %s)" % (str(network), str(sliver), ip, str(port["id"])))
+ logger.info("creating Port (%s, %s, %s, %s)" % (str(network), str(instance), ip, str(port["id"])))
ns = Port(network=network,
- sliver=sliver,
+ instance=instance,
ip=ip,
mac=mac,
port_id=port["id"])
@@ -144,9 +144,9 @@
# For ports that were created by the user, find that ones
# that don't have neutron ports, and create them.
- for port in Port.objects.filter(port_id__isnull=True, sliver__isnull=False):
+ for port in Port.objects.filter(port_id__isnull=True, instance__isnull=False):
#logger.info("XXX working on port %s" % port)
- controller = port.sliver.node.site_deployment.controller
+ controller = port.instance.node.site_deployment.controller
if controller:
cn=port.network.controllernetworks.filter(controller=controller)
if not cn:
@@ -163,9 +163,9 @@
continue
try:
# We need to use a client driver that specifies the tenant
- # of the destination sliver. Nova-compute will not connect
- # ports to slivers if the port's tenant does not match
- # the sliver's tenant.
+ # of the destination instance. Nova-compute will not connect
+ # ports to instances if the port's tenant does not match
+ # the instance's tenant.
# A bunch of stuff to compensate for OpenStackDriver.client_driveR()
# not being in working condition.
@@ -174,7 +174,7 @@
caller = port.network.owner.creator
auth = {'username': caller.email,
'password': caller.remote_password,
- 'tenant': port.sliver.slice.name} # port.network.owner.name}
+ 'tenant': port.instance.slice.name} # port.network.owner.name}
client = OpenStackClient(controller=controller, **auth) # cacert=self.config.nova_ca_ssl_cert,
driver = OpenStackDriver(client=client)
@@ -212,18 +212,18 @@
neutron_nat_list = []
if (neutron_nat_list != nat_list):
- logger.info("Setting nat:forward_ports for port %s network %s sliver %s to %s" % (str(port.port_id), str(port.network.id), str(port.sliver), str(nat_list)))
+ logger.info("Setting nat:forward_ports for port %s network %s instance %s to %s" % (str(port.port_id), str(port.network.id), str(port.instance), str(nat_list)))
try:
- driver = self.driver.admin_driver(controller=port.sliver.node.site_deployment.controller,tenant='admin')
+ driver = self.driver.admin_driver(controller=port.instance.node.site_deployment.controller,tenant='admin')
driver.shell.quantum.update_port(port.port_id, {"port": {"nat:forward_ports": nat_list}})
except:
logger.log_exc("failed to update port with nat_list %s" % str(nat_list))
continue
else:
- #logger.info("port %s network %s sliver %s nat %s is already set" % (str(port.port_id), str(port.network.id), str(port.sliver), str(nat_list)))
+ #logger.info("port %s network %s instance %s nat %s is already set" % (str(port.port_id), str(port.network.id), str(port.instance), str(nat_list)))
pass
- def delete_record(self, network_sliver):
+ def delete_record(self, network_instance):
# Nothing to do, this is an OpenCloud object
pass
diff --git a/xos/openstack_observer/steps/sync_slivers.py b/xos/openstack_observer/steps/sync_slivers.py
deleted file mode 100644
index d98c2d2..0000000
--- a/xos/openstack_observer/steps/sync_slivers.py
+++ /dev/null
@@ -1,196 +0,0 @@
-import os
-import base64
-import socket
-from django.db.models import F, Q
-from xos.config import Config
-from xos.settings import RESTAPI_HOSTNAME, RESTAPI_PORT
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.sliver import Sliver
-from core.models.slice import Slice, SlicePrivilege, ControllerSlice
-from core.models.network import Network, NetworkSlice, ControllerNetwork
-from observer.ansible import *
-from observer.syncstep import *
-from util.logger import observer_logger as logger
-
-def escape(s):
- s = s.replace('\n',r'\n').replace('"',r'\"')
- return s
-
-class SyncSlivers(OpenStackSyncStep):
- provides=[Sliver]
- requested_interval=0
- observes=Sliver
-
- def get_userdata(self, sliver, pubkeys):
- userdata = '#cloud-config\n\nopencloud:\n slicename: "%s"\n hostname: "%s"\n restapi_hostname: "%s"\n restapi_port: "%s"\n' % (sliver.slice.name, sliver.node.name, RESTAPI_HOSTNAME, str(RESTAPI_PORT))
- userdata += 'ssh_authorized_keys:\n'
- for key in pubkeys:
- userdata += ' - %s\n' % key
- return userdata
-
- def sync_record(self, sliver):
- logger.info("sync'ing sliver:%s slice:%s controller:%s " % (sliver, sliver.slice.name, sliver.node.site_deployment.controller))
- controller_register = json.loads(sliver.node.site_deployment.controller.backend_register)
-
- if (controller_register.get('disabled',False)):
- raise InnocuousException('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
-
- metadata_update = {}
- if (sliver.numberCores):
- metadata_update["cpu_cores"] = str(sliver.numberCores)
-
- for tag in sliver.slice.tags.all():
- if tag.name.startswith("sysctl-"):
- metadata_update[tag.name] = tag.value
-
- # public keys
- slice_memberships = SlicePrivilege.objects.filter(slice=sliver.slice)
- pubkeys = set([sm.user.public_key for sm in slice_memberships if sm.user.public_key])
- if sliver.creator.public_key:
- pubkeys.add(sliver.creator.public_key)
-
- if sliver.slice.creator.public_key:
- pubkeys.add(sliver.slice.creator.public_key)
-
- if sliver.slice.service and sliver.slice.service.public_key:
- pubkeys.add(sliver.slice.service.public_key)
-
- # Handle any ports that are already created and attached to the sliver.
- # If we do have a port for a network, then add that network to an
- # exclude list so we won't try to auto-create ports on that network
- # when instantiating.
- ports = []
- exclude_networks = set()
- exclude_templates = set()
- for ns in sliver.ports.all():
- if not ns.port_id:
- raise DeferredException("Port %s on sliver %s has no id; Try again later" % (str(ns), str(sliver)) )
- ports.append(ns.port_id)
- exclude_networks.add(ns.network)
- exclude_templates.add(ns.network.template)
-
- nics = []
- networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
- networks = [n for n in networks if (n not in exclude_networks)]
- controller_networks = ControllerNetwork.objects.filter(network__in=networks,
- controller=sliver.node.site_deployment.controller)
-
- for controller_network in controller_networks:
- if controller_network.network.template.visibility == 'private' and \
- controller_network.network.template.translation == 'none':
- if not controller_network.net_id:
- raise DeferredException("Private Network %s has no id; Try again later" % controller_network.network.name)
- nics.append(controller_network.net_id)
-
- # Now include network templates, for those networks that use a
- # shared_network_name.
- network_templates = [network.template.shared_network_name for network in networks \
- if network.template.shared_network_name]
- network_templates = [nt for nt in network_templates if (nt not in exclude_templates)]
-
- #driver = self.driver.client_driver(caller=sliver.creator, tenant=sliver.slice.name, controller=sliver.controllerNetwork)
- driver = self.driver.admin_driver(tenant='admin', controller=sliver.node.site_deployment.controller)
- nets = driver.shell.quantum.list_networks()['networks']
- for net in nets:
- if net['name'] in network_templates:
- nics.append(net['id'])
-
- # If the slice isn't connected to anything, then at least put it on
- # the public network.
- if (not nics) and (not ports):
- for net in nets:
- if net['name']=='public':
- nics.append(net['id'])
-
- image_name = None
- controller_images = sliver.image.controllerimages.filter(controller=sliver.node.site_deployment.controller)
- if controller_images:
- image_name = controller_images[0].image.name
- logger.info("using image from ControllerImage object: " + str(image_name))
-
- if image_name is None:
- controller_driver = self.driver.admin_driver(controller=sliver.node.site_deployment.controller)
- images = controller_driver.shell.glanceclient.images.list()
- for image in images:
- if image.name == sliver.image.name or not image_name:
- image_name = image.name
- logger.info("using image from glance: " + str(image_name))
-
- try:
- legacy = Config().observer_legacy
- except:
- legacy = False
-
- if (legacy):
- host_filter = sliver.node.name.split('.',1)[0]
- else:
- host_filter = sliver.node.name.strip()
-
- availability_zone_filter = 'nova:%s'%host_filter
- sliver_name = '%s-%d'%(sliver.slice.name,sliver.id)
-
- userData = self.get_userdata(sliver, pubkeys)
- if sliver.userData:
- userData = sliver.userData
-
- controller = sliver.node.site_deployment.controller
- tenant_fields = {'endpoint':controller.auth_url,
- 'admin_user': sliver.creator.email,
- 'admin_password': sliver.creator.remote_password,
- 'admin_tenant': sliver.slice.name,
- 'tenant': sliver.slice.name,
- 'tenant_description': sliver.slice.description,
- 'name':sliver_name,
- 'ansible_tag':sliver_name,
- 'availability_zone': availability_zone_filter,
- 'image_name':image_name,
- 'flavor_name':sliver.flavor.name,
- 'nics':nics,
- 'ports':ports,
- 'meta':metadata_update,
- 'user_data':r'%s'%escape(userData)}
-
- res = run_template('sync_slivers.yaml', tenant_fields,path='slivers', expected_num=1)
- sliver_id = res[0]['info']['OS-EXT-SRV-ATTR:instance_name']
- sliver_uuid = res[0]['id']
-
- try:
- hostname = res[0]['info']['OS-EXT-SRV-ATTR:hypervisor_hostname']
- ip = socket.gethostbyname(hostname)
- sliver.ip = ip
- except:
- pass
-
- sliver.instance_id = sliver_id
- sliver.instance_uuid = sliver_uuid
- sliver.instance_name = sliver_name
- sliver.save()
-
- def delete_record(self, sliver):
- controller_register = json.loads(sliver.node.site_deployment.controller.backend_register)
-
- if (controller_register.get('disabled',False)):
- raise InnocuousException('Controller %s is disabled'%sliver.node.site_deployment.controller.name)
-
- sliver_name = '%s-%d'%(sliver.slice.name,sliver.id)
- controller = sliver.node.site_deployment.controller
- tenant_fields = {'endpoint':controller.auth_url,
- 'admin_user': sliver.creator.email,
- 'admin_password': sliver.creator.remote_password,
- 'admin_tenant': sliver.slice.name,
- 'tenant': sliver.slice.name,
- 'tenant_description': sliver.slice.description,
- 'name':sliver_name,
- 'ansible_tag':sliver_name,
- 'delete': True}
-
- try:
- res = run_template('sync_slivers.yaml', tenant_fields,path='slivers', expected_num=1)
- except Exception,e:
- print "Could not sync %s"%sliver_name
- #import traceback
- #traceback.print_exc()
- raise e
-
- if (len(res)!=1):
- raise Exception('Could not delete sliver %s'%sliver.slice.name)
diff --git a/xos/openstack_observer/syncstep.py b/xos/openstack_observer/syncstep.py
index 03f6d16..791a89a 100644
--- a/xos/openstack_observer/syncstep.py
+++ b/xos/openstack_observer/syncstep.py
@@ -80,7 +80,7 @@
objs = main_obj.deleted_objects.all()
return objs
- #return Sliver.objects.filter(ip=None)
+ #return Instance.objects.filter(ip=None)
def check_dependencies(self, obj, failed):
for dep in self.dependencies:
diff --git a/xos/rr_observer/rrlib.py b/xos/rr_observer/rrlib.py
index 20c2341..6968dcd 100644
--- a/xos/rr_observer/rrlib.py
+++ b/xos/rr_observer/rrlib.py
@@ -27,7 +27,7 @@
pass
def gen_slice_info(self, service=None):
- """generates sliver information from slice of request router
+ """generates instance information from slice of request router
"""
if (service is None ):
@@ -40,13 +40,13 @@
'''for slice in service.service.all():
name = slice.name
- for sliver in slice.slivers.all():
- mapping[sliver.name] = str(sliver.ip)
+ for instance in slice.instances.all():
+ mapping[instance.name] = str(instance.ip)
'''
return mapping
def gen_servicemap_slice_info(self, servicemap):
- """generates sliver information from slice of servicemap
+ """generates instance information from slice of servicemap
"""
wzone = Set(['arizona', 'stanford', 'on.lab', 'housten']) # zone=1 in cooden.conf
@@ -56,14 +56,14 @@
mapping_ip = {}
slice = servicemap.slice
name = slice.name
- for sliver in slice.slivers.all():
- mapping_ip[sliver.node.name] = socket.gethostbyname(sliver.node.name)
- #print "sliver name "+sliver.name+str(sliver.ip)+"\n"
- site = sliver.node.site.name
+ for instance in slice.instances.all():
+ mapping_ip[instance.node.name] = socket.gethostbyname(instance.node.name)
+ #print "instance name "+instance.name+str(instance.ip)+"\n"
+ site = instance.node.site.name
if(site.lower() in wzone):
- mapping_zone[sliver.node.name] = str(1)
+ mapping_zone[instance.node.name] = str(1)
else:
- mapping_zone[sliver.node.name] = str(2)
+ mapping_zone[instance.node.name] = str(2)
return mapping_ip, mapping_zone
diff --git a/xos/syndicate_observer/syndicatelib.py b/xos/syndicate_observer/syndicatelib.py
index 331e925..9044a48 100644
--- a/xos/syndicate_observer/syndicatelib.py
+++ b/xos/syndicate_observer/syndicatelib.py
@@ -61,7 +61,7 @@
import syndicate_storage.models as models
# get OpenCloud models
- from core.models import Slice,Sliver
+ from core.models import Slice,Instance
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
@@ -501,7 +501,7 @@
def put_principal_data( user_email, observer_secret, public_key_pem, private_key_pem ):
"""
Seal and store the principal's private key into the database, in a SyndicatePrincipal object,
- so the sliver-side Syndicate daemon syndicated.py can get them later.
+ so the instance-side Syndicate daemon syndicated.py can get them later.
Overwrite an existing principal if one exists.
"""
@@ -814,9 +814,9 @@
#-------------------------------
-def do_push( sliver_hosts, portnum, payload ):
+def do_push( instance_hosts, portnum, payload ):
"""
- Push a payload to a list of slivers.
+ Push a payload to a list of instances.
NOTE: this has to be done in one go, since we can't import grequests
into the global namespace (without wrecking havoc on the credential server),
but it has to stick around for the push to work.
@@ -837,7 +837,7 @@
# fan-out
requests = []
- for sh in sliver_hosts:
+ for sh in instance_hosts:
rs = grequests.post( "http://" + sh + ":" + str(portnum), data={"observer_message": payload}, timeout=getattr(CONFIG, "SYNDICATE_HTTP_PUSH_TIMEOUT", 60) )
requests.append( rs )
@@ -873,7 +873,7 @@
logger.error("No such slice '%s'" % slice_name)
return None
- hostnames = [s.node.name for s in openstack_slice.slivers.all()]
+ hostnames = [s.node.name for s in openstack_slice.instances.all()]
return hostnames
@@ -894,8 +894,8 @@
for volume state.
NOTE: this is a fall-back mechanism. The observer should push new
- volume state to the slices' slivers. However, if that fails, the
- slivers are configured to poll for volume state periodically. This
+ volume state to the slices' instances. However, if that fails, the
+ instances are configured to poll for volume state periodically. This
server allows them to do just that.
Responses:
@@ -906,12 +906,12 @@
GET /<slicename>/SYNDICATE_SLICE_SECRET -- Reply with the slice secret (TEMPORARY)
- NOTE: We want to limit who can learn which Volumes a slice can access, so we'll seal its slivers'
- credentials with the SliceSecret secret. The slivers (which have the slice-wide secret) can then decrypt it.
+ NOTE: We want to limit who can learn which Volumes a slice can access, so we'll seal its instances'
+ credentials with the SliceSecret secret. The instances (which have the slice-wide secret) can then decrypt it.
However, sealing the listing is a time-consuming process (on the order of 10s), so we only want
to do it when we have to. Since *anyone* can ask for the ciphertext of the volume list,
we will cache the list ciphertext for each slice for a long-ish amount of time, so we don't
- accidentally DDoS this server. This necessarily means that the sliver might see a stale
+ accidentally DDoS this server. This necessarily means that the instance might see a stale
volume listing, but that's okay, since the Observer is eventually consistent anyway.
"""
@@ -971,7 +971,7 @@
# block the cache.
# NOTE: don't release the lock until we've generated credentials.
- # Chances are, there's a thundering herd of slivers coming online.
+ # Chances are, there's a thundering herd of instances coming online.
# Block them all until we've generated their slice's credentials,
# and then serve them the cached one.
diff --git a/xos/syndicate_observer/syndicatelib_config/config-opencloud.py b/xos/syndicate_observer/syndicatelib_config/config-opencloud.py
index 463b84e..3cd2950 100644
--- a/xos/syndicate_observer/syndicatelib_config/config-opencloud.py
+++ b/xos/syndicate_observer/syndicatelib_config/config-opencloud.py
@@ -11,7 +11,7 @@
# URL to the Syndicate SMI. For example, https://syndicate-metadata.appspot.com
SYNDICATE_SMI_URL="http://localhost:8080"
-# If you are going to use OpenID to authenticate the Syndicate sliver daemon,
+# If you are going to use OpenID to authenticate the Syndicate instance daemon,
# this is the OpenID provider URL. It is currently used only to generate
# identity pages for users, so you can put whatever you want here for now.
SYNDICATE_OPENID_TRUSTROOT="http://localhost:8081"
@@ -39,7 +39,7 @@
SYNDICATE_PRIVATE_KEY="/opt/xos/syndicate_observer/syndicatelib_config/pollserver.pem"
# This is the master secret used to generate secrets to seal sensitive information sent to the
-# Syndicate sliver mount daemons. It is also used to seal sensitive information
+# Syndicate instance mount daemons. It is also used to seal sensitive information
# stored to the Django database.
# TODO: think of a way to not have to store this on disk. Maybe we feed into the
# observer when it starts up?
@@ -47,14 +47,14 @@
# This is the default port number on which a Syndicate Replica Gateway
# will be provisioned. It's a well-known port, and can be the same across
-# slivers, since in OpenCloud, an RG instance only listens to localhost.
+# instances, since in OpenCloud, an RG instance only listens to localhost.
SYNDICATE_RG_DEFAULT_PORT=38800
# This is the absolute path to the RG's storage driver (which will be automatically
-# pushed to slivers by Syndicate). See https://github.com/jcnelson/syndicate/wiki/Replica-Gateways
+# pushed to instances by Syndicate). See https://github.com/jcnelson/syndicate/wiki/Replica-Gateways
SYNDICATE_RG_CLOSURE=None
-# This is the port number the observer listens on for GETs from the Syndicate sliver mount
+# This is the port number the observer listens on for GETs from the Syndicate instance mount
# daemons. Normally, the oserver pushes (encrypted) commands to the daemons, but if the
# daemons are NAT'ed or temporarily partitioned, they will pull commands instead.
SYNDICATE_HTTP_PORT=65321
@@ -65,7 +65,7 @@
# This is the number of seconds to wait for pushing a slice credential before timing out.
SYNDICATE_HTTP_PUSH_TIMEOUT=60
-# This is the port number the Syndicate sliver mount daemons listen on. The observer will
+# This is the port number the Syndicate instance mount daemons listen on. The observer will
# push commands to them on this port.
SYNDICATE_SLIVER_PORT=65322
diff --git a/xos/syndicate_observer/syndicatelib_config/config.py b/xos/syndicate_observer/syndicatelib_config/config.py
index 463b84e..3cd2950 100644
--- a/xos/syndicate_observer/syndicatelib_config/config.py
+++ b/xos/syndicate_observer/syndicatelib_config/config.py
@@ -11,7 +11,7 @@
# URL to the Syndicate SMI. For example, https://syndicate-metadata.appspot.com
SYNDICATE_SMI_URL="http://localhost:8080"
-# If you are going to use OpenID to authenticate the Syndicate sliver daemon,
+# If you are going to use OpenID to authenticate the Syndicate instance daemon,
# this is the OpenID provider URL. It is currently used only to generate
# identity pages for users, so you can put whatever you want here for now.
SYNDICATE_OPENID_TRUSTROOT="http://localhost:8081"
@@ -39,7 +39,7 @@
SYNDICATE_PRIVATE_KEY="/opt/xos/syndicate_observer/syndicatelib_config/pollserver.pem"
# This is the master secret used to generate secrets to seal sensitive information sent to the
-# Syndicate sliver mount daemons. It is also used to seal sensitive information
+# Syndicate instance mount daemons. It is also used to seal sensitive information
# stored to the Django database.
# TODO: think of a way to not have to store this on disk. Maybe we feed into the
# observer when it starts up?
@@ -47,14 +47,14 @@
# This is the default port number on which a Syndicate Replica Gateway
# will be provisioned. It's a well-known port, and can be the same across
-# slivers, since in OpenCloud, an RG instance only listens to localhost.
+# instances, since in OpenCloud, an RG instance only listens to localhost.
SYNDICATE_RG_DEFAULT_PORT=38800
# This is the absolute path to the RG's storage driver (which will be automatically
-# pushed to slivers by Syndicate). See https://github.com/jcnelson/syndicate/wiki/Replica-Gateways
+# pushed to instances by Syndicate). See https://github.com/jcnelson/syndicate/wiki/Replica-Gateways
SYNDICATE_RG_CLOSURE=None
-# This is the port number the observer listens on for GETs from the Syndicate sliver mount
+# This is the port number the observer listens on for GETs from the Syndicate instance mount
# daemons. Normally, the oserver pushes (encrypted) commands to the daemons, but if the
# daemons are NAT'ed or temporarily partitioned, they will pull commands instead.
SYNDICATE_HTTP_PORT=65321
@@ -65,7 +65,7 @@
# This is the number of seconds to wait for pushing a slice credential before timing out.
SYNDICATE_HTTP_PUSH_TIMEOUT=60
-# This is the port number the Syndicate sliver mount daemons listen on. The observer will
+# This is the port number the Syndicate instance mount daemons listen on. The observer will
# push commands to them on this port.
SYNDICATE_SLIVER_PORT=65322
diff --git a/xos/tests/slivertest.py b/xos/tests/instancetest.py
similarity index 67%
rename from xos/tests/slivertest.py
rename to xos/tests/instancetest.py
index 60124fd..2813521 100644
--- a/xos/tests/slivertest.py
+++ b/xos/tests/instancetest.py
@@ -1,8 +1,8 @@
"""
- Basic Sliver Test
+ Basic Instance Test
1) Create a slice1
- 2) Create sliver1 on slice1
+ 2) Create instance1 on slice1
"""
import os
@@ -14,15 +14,15 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from openstack.manager import OpenStackManager
-from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
+from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
from planetstacktest import PlanetStackTest, fail_unless
-class SliverTest(PlanetStackTest):
+class InstanceTest(PlanetStackTest):
def __init__(self):
PlanetStackTest.__init__(self)
- def run_sliver1(self):
+ def run_instance1(self):
slice1Name = self.make_slice_name()
slice1 = Slice(name = slice1Name,
omf_friendly=True,
@@ -30,22 +30,22 @@
creator=self.testUser)
slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=["tenant_id"])
- sliver1 = Sliver(image = self.testImage,
+ instance1 = Instance(image = self.testImage,
creator=self.testUser,
slice=slice1,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver1=self.save_and_wait_for_enacted(sliver1, nonempty_fields=["instance_id", "ip"])
+ instance1=self.save_and_wait_for_enacted(instance1, nonempty_fields=["instance_id", "ip"])
def run(self):
self.setup()
try:
- self.run_sliver1()
+ self.run_instance1()
finally:
self.cleanup()
def main():
- SliverTest().run()
+ InstanceTest().run()
if __name__=="__main__":
main()
diff --git a/xos/tests/networktest.py b/xos/tests/networktest.py
index 5390f0f..b4bcbd2 100644
--- a/xos/tests/networktest.py
+++ b/xos/tests/networktest.py
@@ -2,12 +2,12 @@
Network Data Model Test
1) Create a slice1
- 2) Create sliver1 on slice1
- 3) Verify one quantum network created for sliver1
+ 2) Create instance1 on slice1
+ 3) Verify one quantum network created for instance1
4) Create a private network, network1
5) Connect network1 to slice1
- 6) Create sliver1_2 on slice1
- 7) Verify two quantum networks created for sliver1_2
+ 6) Create instance1_2 on slice1
+ 7) Verify two quantum networks created for instance1_2
"""
import os
@@ -19,7 +19,7 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from openstack.manager import OpenStackManager
-from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
+from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
from planetstacktest import PlanetStackTest, fail_unless, fail
@@ -27,10 +27,10 @@
def __init__(self):
PlanetStackTest.__init__(self)
- def wait_for_ports(self, sliver, count=1, max_time=120):
- print "waiting for %d ports on %s" % (count, str(sliver))
+ def wait_for_ports(self, instance, count=1, max_time=120):
+ print "waiting for %d ports on %s" % (count, str(instance))
while max_time>0:
- ports = self.manager.driver.shell.quantum.list_ports(device_id=sliver.instance_id)["ports"]
+ ports = self.manager.driver.shell.quantum.list_ports(device_id=instance.instance_id)["ports"]
if len(ports)==count:
return ports
@@ -70,15 +70,15 @@
creator=self.testUser)
slice1=self.save_and_wait_for_enacted(slice1, nonempty_fields=["tenant_id"])
- sliver1 = Sliver(image = self.testImage,
+ instance1 = Instance(image = self.testImage,
creator=self.testUser,
slice=slice1,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver1=self.save_and_wait_for_enacted(sliver1, nonempty_fields=["instance_id", "ip"])
+ instance1=self.save_and_wait_for_enacted(instance1, nonempty_fields=["instance_id", "ip"])
- # sliver1 should have only one port, its private network
- ports = self.wait_for_ports(sliver1, count=1)
+ # instance1 should have only one port, its private network
+ ports = self.wait_for_ports(instance1, count=1)
self.verify_network_names(ports, [slice1.name])
network1 = Network(name = slice1Name + "-pvt",
@@ -89,14 +89,14 @@
network1_slice1 = NetworkSlice(network=network1, slice=slice1)
network1_slice1.save() # does not need to be enacted
- sliver1_2 = Sliver(image = self.testImage,
+ instance1_2 = Instance(image = self.testImage,
creator=self.testUser,
slice=slice1,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver1_2=self.save_and_wait_for_enacted(sliver1_2, nonempty_fields=["instance_id", "ip"])
+ instance1_2=self.save_and_wait_for_enacted(instance1_2, nonempty_fields=["instance_id", "ip"])
- ports = self.wait_for_ports(sliver1_2, count=2)
+ ports = self.wait_for_ports(instance1_2, count=2)
self.verify_network_names(ports, [slice1.name, network1.name])
self.slice1 = slice1
@@ -118,14 +118,14 @@
network2_slice2 = NetworkSlice(network=network2, slice=slice2)
network2_slice2.save() # does not need to be enacted
- sliver2_1 = Sliver(image = self.testImage,
+ instance2_1 = Instance(image = self.testImage,
creator=self.testUser,
slice=slice2,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver2_1=self.save_and_wait_for_enacted(sliver2_1, nonempty_fields=["instance_id", "ip"])
+ instance2_1=self.save_and_wait_for_enacted(instance2_1, nonempty_fields=["instance_id", "ip"])
- ports = self.wait_for_ports(sliver2_1, count=2)
+ ports = self.wait_for_ports(instance2_1, count=2)
self.verify_network_names(ports, [slice2.name, network2.name])
self.slice2 = slice2
@@ -137,14 +137,14 @@
network2_slice1 = NetworkSlice(network=self.network2, slice=self.slice1)
network2_slice1.save()
- sliver1_3 = Sliver(image = self.testImage,
+ instance1_3 = Instance(image = self.testImage,
creator=self.testUser,
slice=self.slice1,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver1_3=self.save_and_wait_for_enacted(sliver1_3, nonempty_fields=["instance_id", "ip"])
+ instance1_3=self.save_and_wait_for_enacted(instance1_3, nonempty_fields=["instance_id", "ip"])
- ports = self.wait_for_ports(sliver1_3, count=3)
+ ports = self.wait_for_ports(instance1_3, count=3)
self.verify_network_names(ports, [self.slice1.name, self.network1.name, self.network2.name])
def test_nat_net(self):
@@ -164,14 +164,14 @@
network3_slice3 = NetworkSlice(network=network3, slice=slice3)
network3_slice3.save() # does not need to be enacted
- sliver3_1 = Sliver(image = self.testImage,
+ instance3_1 = Instance(image = self.testImage,
creator=self.testUser,
slice=slice3,
node=self.testNode,
deploymentNetwork=self.testDeployment)
- sliver3_1=self.save_and_wait_for_enacted(sliver3_1, nonempty_fields=["instance_id", "ip"])
+ instance3_1=self.save_and_wait_for_enacted(instance3_1, nonempty_fields=["instance_id", "ip"])
- ports = self.wait_for_ports(sliver3_1, count=2)
+ ports = self.wait_for_ports(instance3_1, count=2)
self.verify_network_names(ports, [slice3.name, "nat-net"])
def run(self):
diff --git a/xos/tests/planetstacktest.py b/xos/tests/planetstacktest.py
index 99bd730..baf7efe 100644
--- a/xos/tests/planetstacktest.py
+++ b/xos/tests/planetstacktest.py
@@ -7,7 +7,7 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from openstack.manager import OpenStackManager
-from core.models import Slice, Sliver, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
+from core.models import Slice, Instance, ServiceClass, Reservation, Tag, Network, User, Node, Image, Deployment, Site, NetworkTemplate, NetworkSlice
TEST_SITE_NAME = "Princeton University"
TEST_USER_EMAIL = "sbaker@planetstack.org"
diff --git a/xos/tools/ansible_hosts.py b/xos/tools/ansible_hosts.py
index 0cdb809..9ae3e52 100644
--- a/xos/tools/ansible_hosts.py
+++ b/xos/tools/ansible_hosts.py
@@ -14,7 +14,7 @@
NODES_API = REST_API + "nodes/"
SITES_API = REST_API + "sites/"
SLICES_API = REST_API + "slices/"
-SLIVERS_API = REST_API + "sliver/"
+SLIVERS_API = REST_API + "instance/"
def get_nodes_by_site():
r = requests.get(SITES_API + "?no_hyperlinks=1", auth=opencloud_auth)
@@ -51,16 +51,16 @@
nodes[str(nodes["id"])] = node
r = requests.get(SLIVERS_API + "?no_hyperlinks=1", auth=opencloud_auth)
- slivers = r.json()
- for slivers in nodes:
- if sliver["node"] not in nodes:
+ instances = r.json()
+ for instances in nodes:
+ if instance["node"] not in nodes:
continue
- if sliver["slice"] not in slices:
+ if instance["slice"] not in slices:
continue
- hostname = nodes[sliver["node"]].name
+ hostname = nodes[instance["node"]].name
- slices[sliver["slice"]]["hostnames"].append(hostname)
+ slices[instance["slice"]]["hostnames"].append(hostname)
return slices
"""
diff --git a/xos/tools/cleanup_unique.py b/xos/tools/cleanup_unique.py
index 92ce599..a637df1 100644
--- a/xos/tools/cleanup_unique.py
+++ b/xos/tools/cleanup_unique.py
@@ -57,7 +57,7 @@
seen=[]
for obj in Port.objects.all():
seen.append(obj.id)
- conflicts = Port.objects.filter(network=obj.network, sliver=obj.sliver)
+ conflicts = Port.objects.filter(network=obj.network, instance=obj.instanc)
for conflict in conflicts:
if conflict.id not in seen:
print "Purging", conflict, conflict.id, "due to duplicate of", obj.id
diff --git a/xos/tools/get_instance_ip.py b/xos/tools/get_instance_ip.py
index 0e6a456..dd3c788 100644
--- a/xos/tools/get_instance_ip.py
+++ b/xos/tools/get_instance_ip.py
@@ -11,7 +11,7 @@
NODES_API = REST_API + "nodes/"
SLICES_API = REST_API + "slices/"
-SLIVERS_API = REST_API + "slivers/"
+INSTANCES_API = REST_API + "instances/"
PORTS_API = REST_API + "ports/"
opencloud_auth=("demo@onlab.us", "demo")
@@ -29,7 +29,7 @@
print >> sys.stderr, "Error: failed to find node %s" % host_name
sys.exit(-1)
-def get_slivers(slice_id=None, node_id=None):
+def get_instances(slice_id=None, node_id=None):
queries = []
if slice_id:
queries.append("slice=%s" % str(slice_id))
@@ -41,7 +41,7 @@
else:
query_string = ""
- r = requests.get(SLIVERS_API + query_string, auth=opencloud_auth)
+ r = requests.get(INSTANCES_API + query_string, auth=opencloud_auth)
return r.json()
def main():
@@ -60,19 +60,18 @@
slice_id = get_slice_id(slice_name)
node_id = get_node_id(hostname)
- slivers = get_slivers(slice_id, node_id)
+ instances = get_instances(slice_id, node_id)
# get (instance_name, ip) pairs for instances with names and ips
- slivers = [x for x in slivers if x["instance_name"]]
- slivers = sorted(slivers, key = lambda sliver: sliver["instance_name"])
+ instances = [x for x in instances if x["instance_name"]]
+ instances = sorted(instances, key = lambda instance: instance["instance_name"])
# return the last one in the list (i.e. the newest one)
- sliver_id = slivers[-1]["id"]
+ instance_id = instances[-1]["id"]
- r = requests.get(PORTS_API + "?sliver=%s" % sliver_id, auth=opencloud_auth)
-
+ r = requests.get(NETWORKINSTANCES_API + "?instance=%s" % instance_id, auth=opencloud_auth)
ports = r.json()
ips = [x["ip"] for x in ports]
diff --git a/xos/tools/get_instance_name.py b/xos/tools/get_instance_name.py
index 3450df5..844ba5a 100644
--- a/xos/tools/get_instance_name.py
+++ b/xos/tools/get_instance_name.py
@@ -9,7 +9,7 @@
NODES_API = REST_API + "nodes/"
SLICES_API = REST_API + "slices/"
-SLIVERS_API = REST_API + "slivers/"
+SLIVERS_API = REST_API + "instances/"
opencloud_auth=("demo@onlab.us", "demo")
@@ -26,7 +26,7 @@
print >> sys.stderr, "Error: failed to find node %s" % host_name
sys.exit(-1)
-def get_slivers(slice_id=None, node_id=None):
+def get_instances(slice_id=None, node_id=None):
queries = []
if slice_id:
queries.append("slice=%s" % str(slice_id))
@@ -57,9 +57,9 @@
slice_id = get_slice_id(slice_name)
node_id = get_node_id(hostname)
- slivers = get_slivers(slice_id, node_id)
+ instances = get_instances(slice_id, node_id)
- instance_names = [x["instance_name"] for x in slivers if x["instance_name"]]
+ instance_names = [x["instance_name"] for x in instances if x["instance_name"]]
# return the last one in the list (i.e. the newest one)
diff --git a/xos/tools/init-xos.py b/xos/tools/init-xos.py
index 581eb46..433d444 100644
--- a/xos/tools/init-xos.py
+++ b/xos/tools/init-xos.py
@@ -59,6 +59,6 @@
ServiceClass(name="Best Effort", description="Best Effort").save()
NetworkTemplate(name="Private", description="A private virtual network", visibility="private", translation="none", topology_kind="bigswitch", controller_kind="none").save()
-NetworkTemplate(name="Public shared IPv4", description="Connect a sliver to the public network", visibility="private", translation="NAT", shared_network_name="nat-net", topology_kind="bigswitch", controller_kind="none").save()
-NetworkTemplate(name="Public dedicated IPv4", description="Connect a sliver to the public network", visibility="public", translation="none", shared_network_name="ext-net", topology_kind="bigswitch", controller_kind="none").save()
+NetworkTemplate(name="Public shared IPv4", description="Connect a instance to the public network", visibility="private", translation="NAT", shared_network_name="nat-net", topology_kind="bigswitch", controller_kind="none").save()
+NetworkTemplate(name="Public dedicated IPv4", description="Connect a instance to the public network", visibility="public", translation="none", shared_network_name="ext-net", topology_kind="bigswitch", controller_kind="none").save()
diff --git a/xos/tosca/engine.py b/xos/tosca/engine.py
index 3a4aeb2..efce829 100644
--- a/xos/tosca/engine.py
+++ b/xos/tosca/engine.py
@@ -7,7 +7,7 @@
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
-from core.models import Slice,Sliver,User,Flavor,Node,Image
+from core.models import Slice,Instance,User,Flavor,Node,Image
from nodeselect import XOSNodeSelector
from imageselect import XOSImageSelector
diff --git a/xos/tosca/flavorselect.py b/xos/tosca/flavorselect.py
index 2f40bcf..cab8e56 100644
--- a/xos/tosca/flavorselect.py
+++ b/xos/tosca/flavorselect.py
@@ -1,7 +1,7 @@
import os
import sys
-from core.models import Slice,Sliver,User,Flavor,Node,Image
+from core.models import Slice,Instance,User,Flavor,Node,Image
class XOSFlavorSelector(object):
def __init__(self, user, mem_size=None, num_cpus=None, disk_size=None):
diff --git a/xos/tosca/nodeselect.py b/xos/tosca/nodeselect.py
index 11c3c78..24c5b85 100644
--- a/xos/tosca/nodeselect.py
+++ b/xos/tosca/nodeselect.py
@@ -1,7 +1,7 @@
import os
import sys
-from core.models import Slice,Sliver,User,Flavor,Node,Image
+from core.models import Slice,Instance,User,Flavor,Node,Image
class XOSNodeSelector(object):
def __init__(self, user, mem_size=None, num_cpus=None, disk_size=None, hostname = None):
diff --git a/xos/tosca/resources/compute.py b/xos/tosca/resources/compute.py
index 2f33ce5..f01a401 100644
--- a/xos/tosca/resources/compute.py
+++ b/xos/tosca/resources/compute.py
@@ -5,7 +5,7 @@
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
-from core.models import Slice,Sliver,User,Flavor,Node,Image
+from core.models import Slice,Instance,User,Flavor,Node,Image
from nodeselect import XOSNodeSelector
from imageselect import XOSImageSelector
from flavorselect import XOSFlavorSelector
@@ -14,7 +14,7 @@
class XOSCompute(XOSResource):
provides = "tosca.nodes.Compute"
- xos_model = Sliver
+ xos_model = Instance
def select_compute_node(self, user, v, hostname=None):
mem_size = v.get_property_value("mem_size")
@@ -50,14 +50,14 @@
sliceName = self.get_requirement("tosca.relationships.MemberOfSlice", throw_exception=True)
slice = self.get_xos_object(Slice, name=sliceName)
- # locate it one the same host as some other sliver
+ # locate it one the same host as some other instance
colocate_host = None
- colocate_sliver_name = self.get_requirement("tosca.relationships.SameHost")
+ colocate_instance_name = self.get_requirement("tosca.relationships.SameHost")
if index is not None:
- colocate_sliver_name = "%s-%d" % (colocate_sliver_name, index)
- colocate_slivers = Sliver.objects.filter(name=colocate_sliver_name)
- if colocate_slivers:
- colocate_host = colocate_slivers[0].node.name
+ colocate_instance_name = "%s-%d" % (colocate_instance_name, index)
+ colocate_instances = Instance.objects.filter(name=colocate_instance_name)
+ if colocate_instances:
+ colocate_host = colocate_instances[0].node.name
self.info("colocating on %s" % colocate_host)
capabilities = nodetemplate.get_capabilities()
@@ -84,15 +84,14 @@
def create(self, name = None, index = None):
xos_args = self.get_xos_args(name=name, index=index)
- sliver = Sliver(**xos_args)
- sliver.caller = self.user
- sliver.no_sync = True
- sliver.save()
+ instance = Instance(**xos_args)
+ instance.caller = self.user
+ instance.no_sync = True
+ instance.save()
+ self.deferred_sync.append(instance)
- self.deferred_sync.append(sliver)
-
- self.info("Created Sliver '%s' on node '%s' using flavor '%s' and image '%s'" %
- (str(sliver), str(sliver.node), str(sliver.flavor), str(sliver.image)))
+ self.info("Created Instance '%s' on node '%s' using flavor '%s' and image '%s'" %
+ (str(instance), str(instance.node), str(instance.flavor), str(instance.image)))
def create_or_update(self):
scalable = self.get_scalable()
@@ -100,10 +99,10 @@
default_instances = scalable.get("default_instances",1)
for i in range(0, default_instances):
name = "%s-%d" % (self.nodetemplate.name, i)
- existing_slivers = Sliver.objects.filter(name=name)
- if existing_slivers:
+ existing_instances = Instance.objects.filter(name=name)
+ if existing_instances:
self.info("%s %s already exists" % (self.xos_model.__name__, name))
- self.update(existing_slivers[0])
+ self.update(existing_instances[0])
else:
self.create(name, index=i)
else:
@@ -112,12 +111,12 @@
def get_existing_objs(self):
scalable = self.get_scalable()
if scalable:
- existing_slivers = []
+ existing_instances = []
max_instances = scalable.get("max_instances",1)
for i in range(0, max_instances):
name = "%s-%d" % (self.nodetemplate.name, i)
- existing_slivers = existing_slivers + list(Sliver.objects.filter(name=name))
- return existing_slivers
+ existing_instances = existing_instances + list(Instance.objects.filter(name=name))
+ return existing_instances
else:
return super(XOSCompute,self).get_existing_objs()
diff --git a/xos/tosca/resources/slice.py b/xos/tosca/resources/slice.py
index 5c576be..d9684f2 100644
--- a/xos/tosca/resources/slice.py
+++ b/xos/tosca/resources/slice.py
@@ -60,8 +60,8 @@
self.info("Created Slice '%s' on Site '%s'" % (str(slice), str(slice.site)))
def delete(self, obj):
- if obj.slivers.exists():
- self.info("Slice %s has active slivers; skipping delete" % obj.name)
+ if obj.instances.exists():
+ self.info("Slice %s has active instances; skipping delete" % obj.name)
return
super(XOSSlice, self).delete(obj)
diff --git a/xos/xos/settings.py b/xos/xos/settings.py
index 96f62e8..ba5ff1d 100644
--- a/xos/xos/settings.py
+++ b/xos/xos/settings.py
@@ -192,7 +192,7 @@
'auth.group',
'auth',
'core.network',
- 'core.sliver',
+ 'core.instance',
'core.node',
'core.image',
'core.deploymentrole',
diff --git a/xos/xos/xosapi.py b/xos/xos/xosapi.py
index 5dd1ce0..f7be27a 100644
--- a/xos/xos/xosapi.py
+++ b/xos/xos/xosapi.py
@@ -75,8 +75,8 @@
url(r'xos/slice_privileges/$', SlicePrivilegeList.as_view(), name='sliceprivilege-list'),
url(r'xos/slice_privileges/(?P<pk>[a-zA-Z0-9\-]+)/$', SlicePrivilegeDetail.as_view(), name ='sliceprivilege-detail'),
- url(r'xos/networkslivers/$', NetworkSliverList.as_view(), name='networksliver-list'),
- url(r'xos/networkslivers/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkSliverDetail.as_view(), name ='networksliver-detail'),
+ url(r'xos/networkinstances/$', NetworkInstanceList.as_view(), name='networkinstance-list'),
+ url(r'xos/networkinstances/(?P<pk>[a-zA-Z0-9\-]+)/$', NetworkInstanceDetail.as_view(), name ='networkinstance-detail'),
url(r'xos/flavors/$', FlavorList.as_view(), name='flavor-list'),
url(r'xos/flavors/(?P<pk>[a-zA-Z0-9\-]+)/$', FlavorDetail.as_view(), name ='flavor-detail'),
@@ -123,8 +123,8 @@
url(r'xos/slicecredentials/$', SliceCredentialList.as_view(), name='slicecredential-list'),
url(r'xos/slicecredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceCredentialDetail.as_view(), name ='slicecredential-detail'),
- url(r'xos/slivers/$', SliverList.as_view(), name='sliver-list'),
- url(r'xos/slivers/(?P<pk>[a-zA-Z0-9\-]+)/$', SliverDetail.as_view(), name ='sliver-detail'),
+ url(r'xos/instances/$', InstanceList.as_view(), name='instance-list'),
+ url(r'xos/instances/(?P<pk>[a-zA-Z0-9\-]+)/$', InstanceDetail.as_view(), name ='instance-detail'),
url(r'xos/nodes/$', NodeList.as_view(), name='node-list'),
url(r'xos/nodes/(?P<pk>[a-zA-Z0-9\-]+)/$', NodeDetail.as_view(), name ='node-detail'),
@@ -245,7 +245,7 @@
'tags': reverse('tag-list', request=request, format=format),
'invoices': reverse('invoice-list', request=request, format=format),
'sliceprivileges': reverse('sliceprivilege-list', request=request, format=format),
- 'networkslivers': reverse('networksliver-list', request=request, format=format),
+ 'networkinstances': reverse('networkinstance-list', request=request, format=format),
'flavors': reverse('flavor-list', request=request, format=format),
'controllersites': reverse('controllersite-list', request=request, format=format),
'projects': reverse('project-list', request=request, format=format),
@@ -261,7 +261,7 @@
'usableobjects': reverse('usableobject-list', request=request, format=format),
'providers': reverse('provider-list', request=request, format=format),
'slicecredentials': reverse('slicecredential-list', request=request, format=format),
- 'slivers': reverse('sliver-list', request=request, format=format),
+ 'instances': reverse('instance-list', request=request, format=format),
'nodes': reverse('node-list', request=request, format=format),
'dashboardviews': reverse('dashboardview-list', request=request, format=format),
'controllernetworks': reverse('controllernetwork-list', request=request, format=format),
@@ -791,7 +791,7 @@
-class NetworkSliverSerializer(serializers.HyperlinkedModelSerializer):
+class NetworkInstanceSerializer(serializers.HyperlinkedModelSerializer):
id = IdField()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -804,10 +804,10 @@
except:
return None
class Meta:
- model = NetworkSliver
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ model = NetworkInstance
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
-class NetworkSliverIdSerializer(XOSModelSerializer):
+class NetworkInstanceIdSerializer(XOSModelSerializer):
id = IdField()
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
@@ -820,8 +820,8 @@
except:
return None
class Meta:
- model = NetworkSliver
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ model = NetworkInstance
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
@@ -961,7 +961,7 @@
return None
class Meta:
model = Slice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_instance','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
class SliceIdSerializer(XOSModelSerializer):
id = IdField()
@@ -985,8 +985,7 @@
return None
class Meta:
model = Slice
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
-
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_instances','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
@@ -1002,7 +1001,7 @@
- slivers = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='sliver-detail')
+ instances = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='instance-detail')
@@ -1024,7 +1023,7 @@
return None
class Meta:
model = Network
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','slivers','routers','routers',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','instances','routers','routers',)
class NetworkIdSerializer(XOSModelSerializer):
id = IdField()
@@ -1038,7 +1037,7 @@
- slivers = serializers.PrimaryKeyRelatedField(many=True, queryset = Sliver.objects.all())
+ instances = serializers.PrimaryKeyRelatedField(many=True, queryset = Instance.objects.all())
@@ -1060,7 +1059,7 @@
return None
class Meta:
model = Network
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','slivers','routers','routers',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','instances','routers','routers',)
@@ -1415,7 +1414,7 @@
-class SliverSerializer(serializers.HyperlinkedModelSerializer):
+class InstanceSerializer(serializers.HyperlinkedModelSerializer):
id = IdField()
@@ -1432,10 +1431,15 @@
except:
return None
class Meta:
+<<<<<<< HEAD
+ model = Instance
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',)
+=======
model = Sliver
fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',)
+>>>>>>> origin/master
-class SliverIdSerializer(XOSModelSerializer):
+class InstanceIdSerializer(XOSModelSerializer):
id = IdField()
@@ -1452,8 +1456,13 @@
except:
return None
class Meta:
+<<<<<<< HEAD
+ model = Instance
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',)
+=======
model = Sliver
fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',)
+>>>>>>> origin/master
@@ -1663,7 +1672,7 @@
return None
class Meta:
model = ReservedResource
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','sliver','resource','quantity','reservationSet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance','resource','quantity','reservationSet',)
class ReservedResourceIdSerializer(XOSModelSerializer):
id = IdField()
@@ -1679,7 +1688,7 @@
return None
class Meta:
model = ReservedResource
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','sliver','resource','quantity','reservationSet',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance','resource','quantity','reservationSet',)
@@ -1715,6 +1724,7 @@
class Meta:
model = NetworkTemplate
fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','description','guaranteed_bandwidth','visibility','translation','shared_network_name','shared_network_id','topology_kind','controller_kind',)
+>>>>>>> origin/master
@@ -1846,7 +1856,7 @@
return None
class Meta:
model = Port
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
class PortIdSerializer(XOSModelSerializer):
id = IdField()
@@ -1862,7 +1872,7 @@
return None
class Meta:
model = Port
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
@@ -2746,7 +2756,7 @@
SlicePrivilege: SlicePrivilegeSerializer,
- NetworkSliver: NetworkSliverSerializer,
+ NetworkInstance: NetworkInstanceSerializer,
Flavor: FlavorSerializer,
@@ -2778,7 +2788,7 @@
SliceCredential: SliceCredentialSerializer,
- Sliver: SliverSerializer,
+ Instance: InstanceSerializer,
Node: NodeSerializer,
@@ -3418,12 +3428,12 @@
-class NetworkSliverList(XOSListCreateAPIView):
- queryset = NetworkSliver.objects.select_related().all()
- serializer_class = NetworkSliverSerializer
- id_serializer_class = NetworkSliverIdSerializer
+class NetworkInstanceList(XOSListCreateAPIView):
+ queryset = NetworkInstance.objects.select_related().all()
+ serializer_class = NetworkInstanceSerializer
+ id_serializer_class = NetworkInstanceIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
def get_serializer_class(self):
no_hyperlinks=False
@@ -3437,13 +3447,13 @@
def get_queryset(self):
if (not self.request.user.is_authenticated()):
raise XOSNotAuthenticated()
- return NetworkSliver.select_by_user(self.request.user)
+ return NetworkInstance.select_by_user(self.request.user)
-class NetworkSliverDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = NetworkSliver.objects.select_related().all()
- serializer_class = NetworkSliverSerializer
- id_serializer_class = NetworkSliverIdSerializer
+class NetworkInstanceDetail(XOSRetrieveUpdateDestroyAPIView):
+ queryset = NetworkInstance.objects.select_related().all()
+ serializer_class = NetworkInstanceSerializer
+ id_serializer_class = NetworkInstanceIdSerializer
def get_serializer_class(self):
no_hyperlinks=False
@@ -3457,7 +3467,7 @@
def get_queryset(self):
if (not self.request.user.is_authenticated()):
raise XOSNotAuthenticated()
- return NetworkSliver.select_by_user(self.request.user)
+ return NetworkInstance.select_by_user(self.request.user)
# update() is handled by XOSRetrieveUpdateDestroyAPIView
@@ -3611,7 +3621,7 @@
serializer_class = SliceSerializer
id_serializer_class = SliceIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_slivers','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','enabled','omf_friendly','description','slice_url','site','max_instances','service','network','serviceClass','creator','default_flavor','default_image','mount_data_sets','networks','networks',)
def get_serializer_class(self):
no_hyperlinks=False
@@ -3658,7 +3668,7 @@
serializer_class = NetworkSerializer
id_serializer_class = NetworkIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','slivers','routers','routers',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','name','template','subnet','ports','labels','owner','guaranteed_bandwidth','permit_all_slices','topology_parameters','controller_url','controller_parameters','network_id','router_id','subnet_id','autoconnect','slices','slices','instances','routers','routers',)
def get_serializer_class(self):
no_hyperlinks=False
@@ -4170,10 +4180,10 @@
-class SliverList(XOSListCreateAPIView):
- queryset = Sliver.objects.select_related().all()
- serializer_class = SliverSerializer
- id_serializer_class = SliverIdSerializer
+class InstanceList(XOSListCreateAPIView):
+ queryset = Instance.objects.select_related().all()
+ serializer_class = InstanceSerializer
+ id_serializer_class = InstanceIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance_id','instance_uuid','name','instance_name','ip','image','creator','slice','deployment','node','numberCores','flavor','userData','networks',)
@@ -4189,13 +4199,13 @@
def get_queryset(self):
if (not self.request.user.is_authenticated()):
raise XOSNotAuthenticated()
- return Sliver.select_by_user(self.request.user)
+ return Instance.select_by_user(self.request.user)
-class SliverDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Sliver.objects.select_related().all()
- serializer_class = SliverSerializer
- id_serializer_class = SliverIdSerializer
+class InstanceDetail(XOSRetrieveUpdateDestroyAPIView):
+ queryset = Instance.objects.select_related().all()
+ serializer_class = InstanceSerializer
+ id_serializer_class = InstanceIdSerializer
def get_serializer_class(self):
no_hyperlinks=False
@@ -4209,7 +4219,7 @@
def get_queryset(self):
if (not self.request.user.is_authenticated()):
raise XOSNotAuthenticated()
- return Sliver.select_by_user(self.request.user)
+ return Instance.select_by_user(self.request.user)
# update() is handled by XOSRetrieveUpdateDestroyAPIView
@@ -4457,7 +4467,7 @@
serializer_class = ReservedResourceSerializer
id_serializer_class = ReservedResourceIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','sliver','resource','quantity','reservationSet',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','instance','resource','quantity','reservationSet',)
def get_serializer_class(self):
no_hyperlinks=False
@@ -4692,7 +4702,7 @@
serializer_class = PortSerializer
id_serializer_class = PortIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','sliver','ip','port_id',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','network','instance','ip','port_id',)
def get_serializer_class(self):
no_hyperlinks=False