Commit c4d12b46 by Szabolcs Gelencser

Remove some dead code and packages for easier install

parent 6315b419
...@@ -14,12 +14,16 @@ ...@@ -14,12 +14,16 @@
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true"> <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages"> <option name="ignoredPackages">
<value> <value>
<list size="5"> <list size="9">
<item index="0" class="java.lang.String" itemvalue="salt" /> <item index="0" class="java.lang.String" itemvalue="salt" />
<item index="1" class="java.lang.String" itemvalue="six" /> <item index="1" class="java.lang.String" itemvalue="six" />
<item index="2" class="java.lang.String" itemvalue="netaddr" /> <item index="2" class="java.lang.String" itemvalue="netaddr" />
<item index="3" class="java.lang.String" itemvalue="requests" /> <item index="3" class="java.lang.String" itemvalue="requests" />
<item index="4" class="java.lang.String" itemvalue="cryptography" /> <item index="4" class="java.lang.String" itemvalue="cryptography" />
<item index="5" class="java.lang.String" itemvalue="psycopg2" />
<item index="6" class="java.lang.String" itemvalue="lxml" />
<item index="7" class="java.lang.String" itemvalue="MarkupSafe" />
<item index="8" class="java.lang.String" itemvalue="pylibmc" />
</list> </list>
</value> </value>
</option> </option>
......
No preview for this file type
...@@ -583,5 +583,7 @@ DEFAULT_SUBNETPOOL_PREFIXES = ( ...@@ -583,5 +583,7 @@ DEFAULT_SUBNETPOOL_PREFIXES = (
DEFAULT_SUBNETPOOL_PREFIX_LEN = 20 DEFAULT_SUBNETPOOL_PREFIX_LEN = 20
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN="bme" OPENSTACK_KEYSTONE_DEFAULT_DOMAIN="bme"
OPENSTACK_KEYSTONE_URL="https://oscircle.guest.ik.bme.hu:5000"
WEBSSO_ENABLED = True #TODO: it is always enabled, refactor openstack_auth
OPENSTACK_KEYSTONE_URL="https://10.4.1.19:5000" OPENSTACK_SSL_NO_VERIFY = True
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ from django.core.urlresolvers import reverse ...@@ -22,7 +22,7 @@ from django.core.urlresolvers import reverse
from django.shortcuts import redirect from django.shortcuts import redirect
from openstack_auth import utils from openstack_auth import utils
from openstack_auth.views import login from openstack_auth.views import login, websso
admin.autodiscover() admin.autodiscover()
...@@ -49,6 +49,7 @@ urlpatterns = [ ...@@ -49,6 +49,7 @@ urlpatterns = [
url(r'^accounts/login/?$', login, url(r'^accounts/login/?$', login,
name="accounts.login"), name="accounts.login"),
url(r'^accounts/', include('django.contrib.auth.urls')), url(r'^accounts/', include('django.contrib.auth.urls')),
url(r'^auth/websso/$', websso, name='websso'),
# url(r'^two-factor-login/$', TwoFactorLoginView.as_view(), # url(r'^two-factor-login/$', TwoFactorLoginView.as_view(),
# name="two-factor-login"), # name="two-factor-login"),
# #
......
...@@ -53,7 +53,7 @@ from django.core.urlresolvers import reverse_lazy ...@@ -53,7 +53,7 @@ from django.core.urlresolvers import reverse_lazy
from firewall.models import Vlan, Host from firewall.models import Vlan, Host
from vm.models import ( from vm.models import (
InstanceTemplate, Lease, InterfaceTemplate, Node, Trait, Instance InstanceTemplate, Lease, InterfaceTemplate, Trait, Instance
) )
from storage.models import DataStore, Disk from storage.models import DataStore, Disk
from django.contrib.admin.widgets import FilteredSelectMultiple from django.contrib.admin.widgets import FilteredSelectMultiple
...@@ -62,8 +62,6 @@ from .models import Profile, GroupProfile, Message ...@@ -62,8 +62,6 @@ from .models import Profile, GroupProfile, Message
from circle.settings.base import LANGUAGES, MAX_NODE_RAM from circle.settings.base import LANGUAGES, MAX_NODE_RAM
from django.utils.translation import string_concat from django.utils.translation import string_concat
from .validators import domain_validator
from dashboard.models import ConnectCommand from dashboard.models import ConnectCommand
from openstack_auth.user_key import UserKey from openstack_auth.user_key import UserKey
...@@ -412,97 +410,6 @@ class HostForm(NoFormTagMixin, forms.ModelForm): ...@@ -412,97 +410,6 @@ class HostForm(NoFormTagMixin, forms.ModelForm):
model = Host model = Host
fields = ['hostname', 'vlan', 'mac', 'ipv4', ] fields = ['hostname', 'vlan', 'mac', 'ipv4', ]
class NodeForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(NodeForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.form_show_labels = False
self.helper.layout = Layout(
Div(
Div(
Div(
Div(
AnyTag(
'h3',
HTML(_("Node")),
),
css_class="col-sm-3",
),
css_class="row",
),
Div(
Div( # nodename
HTML('<label for="node-nodename-box">'
'Name'
'</label>'),
css_class="col-sm-3",
),
Div(
'name',
css_class="col-sm-9",
),
css_class="row",
),
Div(
Div( # priority
HTML('<label for="node-nodename-box">'
'Priority'
'</label>'),
css_class="col-sm-3",
),
Div(
'priority',
css_class="col-sm-9",
),
css_class="row",
),
Div(
Div( # enabled
HTML('<label for="node-nodename-box">'
'Enabled'
'</label>'),
css_class="col-sm-3",
),
Div(
'enabled',
css_class="col-sm-9",
),
css_class="row",
),
Div( # nested host
HTML("""{% load crispy_forms_tags %}
{% crispy hostform %}
""")
),
Div(
Div(
AnyTag( # tip: don't try to use Button class
"button",
AnyTag(
"i",
css_class="fa fa-play"
),
HTML("Start"),
css_id="node-create-submit",
css_class="btn btn-success",
),
css_class="col-sm-12 text-right",
),
css_class="row",
),
css_class="col-sm-11",
),
css_class="row",
),
)
class Meta:
model = Node
fields = ['name', 'priority', 'enabled', ]
class TemplateForm(forms.ModelForm): class TemplateForm(forms.ModelForm):
# networks = forms.ModelMultipleChoiceField(queryset=None, required=False, label=_("Networks")) # networks = forms.ModelMultipleChoiceField(queryset=None, required=False, label=_("Networks"))
# #
......
...@@ -27,7 +27,7 @@ from django_tables2.columns import ( ...@@ -27,7 +27,7 @@ from django_tables2.columns import (
) )
from storage.models import Disk from storage.models import Disk
from vm.models import Node, InstanceTemplate, Lease from vm.models import InstanceTemplate, Lease
from dashboard.models import ConnectCommand, Message from dashboard.models import ConnectCommand, Message
from openstack_auth.user_key import UserKey from openstack_auth.user_key import UserKey
...@@ -57,58 +57,58 @@ class ApplianceColumn(TemplateColumn): ...@@ -57,58 +57,58 @@ class ApplianceColumn(TemplateColumn):
return mark_safe("%s %s" % (abbr % (title, text), value)) return mark_safe("%s %s" % (abbr % (title, text), value))
class NodeListTable(Table): # class NodeListTable(Table):
#
pk = Column( # pk = Column(
verbose_name="ID", # verbose_name="ID",
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
) # )
#
overcommit = Column( # overcommit = Column(
verbose_name=_("Overcommit"), # verbose_name=_("Overcommit"),
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
) # )
#
get_status_display = Column( # get_status_display = Column(
verbose_name=_("Status"), # verbose_name=_("Status"),
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
order_by=("enabled", "schedule_enabled"), # order_by=("enabled", "schedule_enabled"),
) # )
#
name = TemplateColumn( # name = TemplateColumn(
template_name="dashboard/node-list/column-name.html", # template_name="dashboard/node-list/column-name.html",
order_by="normalized_name" # order_by="normalized_name"
) # )
#
priority = Column( # priority = Column(
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
) # )
#
number_of_VMs = TemplateColumn( # number_of_VMs = TemplateColumn(
verbose_name=_("Number of VMs"), # verbose_name=_("Number of VMs"),
template_name='dashboard/node-list/column-vm.html', # template_name='dashboard/node-list/column-vm.html',
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
) # )
#
monitor = TemplateColumn( # monitor = TemplateColumn(
verbose_name=_("Monitor"), # verbose_name=_("Monitor"),
template_name='dashboard/node-list/column-monitor.html', # template_name='dashboard/node-list/column-monitor.html',
attrs={'th': {'class': 'node-list-table-monitor'}}, # attrs={'th': {'class': 'node-list-table-monitor'}},
orderable=False, # orderable=False,
) # )
#
minion_online = BooleanColumn( # minion_online = BooleanColumn(
verbose_name=_("Minion online"), # verbose_name=_("Minion online"),
attrs={'th': {'class': 'node-list-table-thin'}}, # attrs={'th': {'class': 'node-list-table-thin'}},
orderable=False, # orderable=False,
) # )
#
class Meta: # class Meta:
model = Node # model = Node
attrs = {'class': ('table table-bordered table-striped table-hover ' # attrs = {'class': ('table table-bordered table-striped table-hover '
'node-list-table')} # 'node-list-table')}
fields = ('pk', 'name', 'host', 'get_status_display', 'priority', # fields = ('pk', 'name', 'host', 'get_status_display', 'priority',
'minion_online', 'overcommit', 'number_of_VMs', ) # 'minion_online', 'overcommit', 'number_of_VMs', )
class GroupListTable(Table): class GroupListTable(Table):
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
{% include "display-form-errors.html" %} {% include "display-form-errors.html" %}
</div> </div>
{% endif %} {% endif %}
<div class="col-xs-{% if saml2 %}6{% else %}12{% endif %}"> <div class="col-xs-6">
<div class="login-form"> <div class="login-form">
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
...@@ -34,11 +34,15 @@ ...@@ -34,11 +34,15 @@
</form> </form>
</div> </div>
</div> </div>
{% if saml2 %}
<div class="col-xs-6"> <div class="col-xs-6">
<h4 style="padding-top: 0; margin-top: 20px;">{% trans "Login with SSO" %}</h4> <h4 style="padding-top: 0; margin-top: 20px;">{% trans "Login with SSO" %}</h4>
<a href="{% url "saml2_login" %}">{% trans "Click here!" %}</a> <form method="POST">
{% csrf_token %}
<button type="submit" class="btn btn-success">{% trans "Click here!" %}</button>
<input type="hidden" name="username">
<input type="hidden" name="password">
<input type="hidden" name="auth_type" value="saml2">
</form>
</div> </div>
{% endif %}
</div> </div>
{% endblock %} {% endblock %}
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from lxml import etree as ET
import logging import logging
rng_file = "/usr/share/libvirt/schemas/domain.rng" rng_file = "/usr/share/libvirt/schemas/domain.rng"
...@@ -31,25 +30,6 @@ footer = "</domain>" ...@@ -31,25 +30,6 @@ footer = "</domain>"
logger = logging.getLogger() logger = logging.getLogger()
def domain_validator(value):
xml = header + value + footer
try:
parsed_xml = ET.fromstring(xml)
except Exception as e:
raise ValidationError(e.message)
try:
relaxng = ET.RelaxNG(file=rng_file)
except:
logger.critical("%s RelaxNG libvirt domain schema file "
"is missing for validation.", rng_file)
else:
try:
relaxng.assertValid(parsed_xml)
except Exception as e:
raise ValidationError(e.message)
def connect_command_template_validator(value): def connect_command_template_validator(value):
"""Validate value as a connect command template. """Validate value as a connect command template.
......
...@@ -25,7 +25,7 @@ from django.conf import settings ...@@ -25,7 +25,7 @@ from django.conf import settings
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from django.core.cache import cache from django.core.cache import cache
from django.views.generic import TemplateView from django.views.generic import TemplateView
from vm.models import Instance, Node, InstanceTemplate from vm.models import Instance, InstanceTemplate
from dashboard.views.vm import vm_ops from dashboard.views.vm import vm_ops
from network.models import Vxlan from network.models import Vxlan
......
...@@ -61,6 +61,8 @@ def login(request, template_name=None, extra_context=None, **kwargs): ...@@ -61,6 +61,8 @@ def login(request, template_name=None, extra_context=None, **kwargs):
auth_type = request.POST.get('auth_type', 'credentials') auth_type = request.POST.get('auth_type', 'credentials')
if utils.is_websso_enabled() and auth_type != 'credentials': if utils.is_websso_enabled() and auth_type != 'credentials':
auth_url = request.POST.get('region') auth_url = request.POST.get('region')
if auth_url is None:
auth_url = settings.OPENSTACK_KEYSTONE_URL + '/v3'
url = utils.get_websso_url(request, auth_url, auth_type) url = utils.get_websso_url(request, auth_url, auth_type)
return shortcuts.redirect(url) return shortcuts.redirect(url)
......
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
from django.contrib import admin from django.contrib import admin
from .models import (Instance, InstanceActivity, InstanceTemplate, Interface, from .models import (Instance, InstanceActivity, InstanceTemplate, Interface,
InterfaceTemplate, Lease, NamedBaseResourceConfig, Node, InterfaceTemplate, Lease, NamedBaseResourceConfig, Trait)
NodeActivity, Trait)
class InstanceActivityAdmin(admin.ModelAdmin): class InstanceActivityAdmin(admin.ModelAdmin):
...@@ -33,6 +32,4 @@ admin.site.register(Interface) ...@@ -33,6 +32,4 @@ admin.site.register(Interface)
admin.site.register(InterfaceTemplate) admin.site.register(InterfaceTemplate)
admin.site.register(Lease) admin.site.register(Lease)
admin.site.register(NamedBaseResourceConfig) admin.site.register(NamedBaseResourceConfig)
admin.site.register(Node)
admin.site.register(NodeActivity)
admin.site.register(Trait) admin.site.register(Trait)
# flake8: noqa # flake8: noqa
from .activity import InstanceActivity from .activity import InstanceActivity
from .activity import NodeActivity
from .activity import node_activity
from .common import BaseResourceConfigModel from .common import BaseResourceConfigModel
from .common import Lease from .common import Lease
from .common import NamedBaseResourceConfig from .common import NamedBaseResourceConfig
...@@ -13,12 +11,10 @@ from .instance import post_state_changed ...@@ -13,12 +11,10 @@ from .instance import post_state_changed
from .instance import pre_state_changed from .instance import pre_state_changed
from .network import InterfaceTemplate from .network import InterfaceTemplate
from .network import Interface from .network import Interface
from .node import Node
__all__ = [ __all__ = [
'InstanceActivity', 'BaseResourceConfigModel', 'InstanceActivity', 'BaseResourceConfigModel',
'NamedBaseResourceConfig', 'VirtualMachineDescModel', 'InstanceTemplate', 'NamedBaseResourceConfig', 'VirtualMachineDescModel', 'InstanceTemplate',
'Instance', 'post_state_changed', 'pre_state_changed', 'InterfaceTemplate', 'Instance', 'post_state_changed', 'pre_state_changed', 'InterfaceTemplate',
'Interface', 'Trait', 'Node', 'NodeActivity', 'Lease', 'node_activity', 'Interface', 'Trait', 'NodeActivity', 'Lease', 'node_activity'
'pwgen'
] ]
...@@ -196,71 +196,6 @@ class InstanceActivity(ActivityModel): ...@@ -196,71 +196,6 @@ class InstanceActivity(ActivityModel):
return self.instance.get_operation_from_activity_code( return self.instance.get_operation_from_activity_code(
self.activity_code) self.activity_code)
class NodeActivity(ActivityModel):
ACTIVITY_CODE_BASE = join_activity_code('vm', 'Node')
node = ForeignKey('Node', related_name='activity_log',
help_text=_('Node this activity works on.'),
verbose_name=_('node'))
class Meta:
app_label = 'vm'
db_table = 'vm_nodeactivity'
def get_operation(self):
return self.node.get_operation_from_activity_code(
self.activity_code)
def get_absolute_url(self):
return reverse('dashboard.views.node-activity', args=[self.pk])
def __unicode__(self):
if self.parent:
return '{}({})->{}'.format(self.parent.activity_code,
self.node,
self.activity_code)
else:
return '{}({})'.format(self.activity_code,
self.node)
@classmethod
def create(cls, code_suffix, node, task_uuid=None, user=None,
readable_name=None):
readable_name = _normalize_readable_name(readable_name, code_suffix)
activity_code = join_activity_code(cls.ACTIVITY_CODE_BASE, code_suffix)
act = cls(activity_code=activity_code, node=node, parent=None,
readable_name_data=readable_name.to_dict(),
started=timezone.now(), task_uuid=task_uuid, user=user)
act.save()
return act
def create_sub(self, code_suffix, task_uuid=None, readable_name=None):
readable_name = _normalize_readable_name(readable_name, code_suffix)
act = NodeActivity(
activity_code=join_activity_code(self.activity_code, code_suffix),
node=self.node, parent=self, started=timezone.now(),
readable_name_data=readable_name.to_dict(), task_uuid=task_uuid,
user=self.user)
act.save()
return act
@contextmanager
def sub_activity(self, code_suffix, task_uuid=None, readable_name=None):
act = self.create_sub(code_suffix, task_uuid,
readable_name=readable_name)
return activitycontextimpl(act)
@contextmanager
def node_activity(code_suffix, node, task_uuid=None, user=None,
readable_name=None):
act = NodeActivity.create(code_suffix, node, task_uuid, user,
readable_name=readable_name)
return activitycontextimpl(act)
def cleanup(conf=None, **kwargs): def cleanup(conf=None, **kwargs):
# TODO check if other manager workers are running # TODO check if other manager workers are running
msg_txt = ugettext_noop("Manager is restarted, activity is cleaned up. " msg_txt = ugettext_noop("Manager is restarted, activity is cleaned up. "
......
...@@ -51,7 +51,6 @@ from ..tasks import agent_tasks ...@@ -51,7 +51,6 @@ from ..tasks import agent_tasks
from .activity import (ActivityInProgressError, InstanceActivity) from .activity import (ActivityInProgressError, InstanceActivity)
from .common import BaseResourceConfigModel, Lease from .common import BaseResourceConfigModel, Lease
from .network import Interface from .network import Interface
from .node import Node, Trait
from network.models import EditorElement from network.models import EditorElement
...@@ -109,11 +108,6 @@ class VirtualMachineDescModel(BaseResourceConfigModel): ...@@ -109,11 +108,6 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
verbose_name=_("Lease")) verbose_name=_("Lease"))
raw_data = TextField(verbose_name=_('raw_data'), blank=True, help_text=_( raw_data = TextField(verbose_name=_('raw_data'), blank=True, help_text=_(
'Additional libvirt domain parameters in XML format.')) 'Additional libvirt domain parameters in XML format.'))
req_traits = ManyToManyField(Trait, blank=True,
help_text=_("A set of traits required for a "
"node to declare to be suitable "
"for hosting the VM."),
verbose_name=_("required traits"))
system = TextField(verbose_name=_('operating system'), system = TextField(verbose_name=_('operating system'),
help_text=(_('Name of operating system in format like ' help_text=(_('Name of operating system in format like '
'"Ubuntu 12.04 LTS Desktop amd64".'))) '"Ubuntu 12.04 LTS Desktop amd64".')))
...@@ -222,10 +216,6 @@ class Instance(OperatedMixin, TimeStampedModel): ...@@ -222,10 +216,6 @@ class Instance(OperatedMixin, TimeStampedModel):
verbose_name=_('time of delete'), verbose_name=_('time of delete'),
help_text=_("Proposed time of automatic " help_text=_("Proposed time of automatic "
"deletion.")) "deletion."))
node = ForeignKey(Node, blank=True, null=True,
related_name='instance_set',
help_text=_("Current hypervisor of this instance."),
verbose_name=_('host node'))
disks = ManyToManyField('storage.Disk', related_name='instance_set', disks = ManyToManyField('storage.Disk', related_name='instance_set',
help_text=_("Set of mounted disks."), help_text=_("Set of mounted disks."),
verbose_name=_('disks')) verbose_name=_('disks'))
......
...@@ -59,15 +59,11 @@ jsonschema==2.6.0 ...@@ -59,15 +59,11 @@ jsonschema==2.6.0
keystoneauth1==3.4.0 keystoneauth1==3.4.0
kombu==3.0.30 kombu==3.0.30
logutils==0.3.3 logutils==0.3.3
lxml==3.4.4 MarkupSafe==1.0
MarkupSafe==0.23
microsofttranslator==0.8
models==0.9.3
monotonic==1.4 monotonic==1.4
msgpack==0.5.4 msgpack==0.5.4
msgpack-python==0.5.4 msgpack-python==0.5.4
munch==2.2.0 munch==2.2.0
MySQL-python==1.2.5
netaddr==0.7.19 netaddr==0.7.19
netifaces==0.10.6 netifaces==0.10.6
nltk==3.2.5 nltk==3.2.5
...@@ -95,14 +91,12 @@ ply==3.10 ...@@ -95,14 +91,12 @@ ply==3.10
polib==1.1.0 polib==1.1.0
prettytable==0.7.2 prettytable==0.7.2
prompt-toolkit==1.0.15 prompt-toolkit==1.0.15
psycopg2==2.6
ptyprocess==0.5.2 ptyprocess==0.5.2
pyasn1==0.4.2 pyasn1==0.4.2
pycparser==2.18 pycparser==2.18
pycryptodomex==3.4.12 pycryptodomex==3.4.12
Pygments==2.0.2 Pygments==2.0.2
pyinotify==0.9.5 pyinotify==0.9.5
pylibmc==1.4.3
PyNaCl==1.2.1 PyNaCl==1.2.1
pyOpenSSL==17.5.0 pyOpenSSL==17.5.0
pyotp==2.1.1 pyotp==2.1.1
...@@ -122,7 +116,6 @@ requests==2.18.4 ...@@ -122,7 +116,6 @@ requests==2.18.4
requestsexceptions==1.4.0 requestsexceptions==1.4.0
rfc3986==1.1.0 rfc3986==1.1.0
rosetta==0.3 rosetta==0.3
salt==2014.7.0
scandir==1.7 scandir==1.7
scipy==1.0.0 scipy==1.0.0
semantic-version==2.6.0 semantic-version==2.6.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment