Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c4d12b46
authored
Apr 10, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some dead code and packages for easier install
parent
6315b419
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
79 additions
and
268 deletions
+79
-268
.idea/inspectionProfiles/Project_Default.xml
+5
-1
.idea/workspace.xml
+0
-0
circle/circle/db.sqlite3
+0
-0
circle/circle/settings/base.py
+4
-2
circle/circle/urls.py
+2
-1
circle/dashboard/forms.py
+1
-94
circle/dashboard/tables.py
+53
-53
circle/dashboard/templates/auth/login.html
+8
-4
circle/dashboard/validators.py
+0
-20
circle/dashboard/views/index.py
+1
-1
circle/openstack_auth/views.py
+2
-0
circle/vm/admin.py
+1
-4
circle/vm/models/__init__.py
+1
-5
circle/vm/models/activity.py
+0
-65
circle/vm/models/instance.py
+0
-10
circle/vm/operations.py
+0
-0
requirements/circlestack.txt
+1
-8
No files found.
.idea/inspectionProfiles/Project_Default.xml
View file @
c4d12b46
...
...
@@ -14,12 +14,16 @@
<inspection_tool
class=
"PyPackageRequirementsInspection"
enabled=
"true"
level=
"WARNING"
enabled_by_default=
"true"
>
<option
name=
"ignoredPackages"
>
<value>
<list
size=
"
5
"
>
<list
size=
"
9
"
>
<item
index=
"0"
class=
"java.lang.String"
itemvalue=
"salt"
/>
<item
index=
"1"
class=
"java.lang.String"
itemvalue=
"six"
/>
<item
index=
"2"
class=
"java.lang.String"
itemvalue=
"netaddr"
/>
<item
index=
"3"
class=
"java.lang.String"
itemvalue=
"requests"
/>
<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>
</value>
</option>
...
...
.idea/workspace.xml
View file @
c4d12b46
This diff is collapsed.
Click to expand it.
circle/circle/db.sqlite3
View file @
c4d12b46
No preview for this file type
circle/circle/settings/base.py
View file @
c4d12b46
...
...
@@ -583,5 +583,7 @@ DEFAULT_SUBNETPOOL_PREFIXES = (
DEFAULT_SUBNETPOOL_PREFIX_LEN
=
20
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"
\ No newline at end of file
OPENSTACK_SSL_NO_VERIFY
=
True
\ No newline at end of file
circle/circle/urls.py
View file @
c4d12b46
...
...
@@ -22,7 +22,7 @@ from django.core.urlresolvers import reverse
from
django.shortcuts
import
redirect
from
openstack_auth
import
utils
from
openstack_auth.views
import
login
from
openstack_auth.views
import
login
,
websso
admin
.
autodiscover
()
...
...
@@ -49,6 +49,7 @@ urlpatterns = [
url
(
r'^accounts/login/?$'
,
login
,
name
=
"accounts.login"
),
url
(
r'^accounts/'
,
include
(
'django.contrib.auth.urls'
)),
url
(
r'^auth/websso/$'
,
websso
,
name
=
'websso'
),
# url(r'^two-factor-login/$', TwoFactorLoginView.as_view(),
# name="two-factor-login"),
#
...
...
circle/dashboard/forms.py
View file @
c4d12b46
...
...
@@ -53,7 +53,7 @@ from django.core.urlresolvers import reverse_lazy
from
firewall.models
import
Vlan
,
Host
from
vm.models
import
(
InstanceTemplate
,
Lease
,
InterfaceTemplate
,
Node
,
Trait
,
Instance
InstanceTemplate
,
Lease
,
InterfaceTemplate
,
Trait
,
Instance
)
from
storage.models
import
DataStore
,
Disk
from
django.contrib.admin.widgets
import
FilteredSelectMultiple
...
...
@@ -62,8 +62,6 @@ from .models import Profile, GroupProfile, Message
from
circle.settings.base
import
LANGUAGES
,
MAX_NODE_RAM
from
django.utils.translation
import
string_concat
from
.validators
import
domain_validator
from
dashboard.models
import
ConnectCommand
from
openstack_auth.user_key
import
UserKey
...
...
@@ -412,97 +410,6 @@ class HostForm(NoFormTagMixin, forms.ModelForm):
model
=
Host
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
):
# networks = forms.ModelMultipleChoiceField(queryset=None, required=False, label=_("Networks"))
#
...
...
circle/dashboard/tables.py
View file @
c4d12b46
...
...
@@ -27,7 +27,7 @@ from django_tables2.columns import (
)
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
openstack_auth.user_key
import
UserKey
...
...
@@ -57,58 +57,58 @@ class ApplianceColumn(TemplateColumn):
return
mark_safe
(
"
%
s
%
s"
%
(
abbr
%
(
title
,
text
),
value
))
class
NodeListTable
(
Table
):
pk
=
Column
(
verbose_name
=
"ID"
,
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
)
overcommit
=
Column
(
verbose_name
=
_
(
"Overcommit"
),
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
)
get_status_display
=
Column
(
verbose_name
=
_
(
"Status"
),
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
order_by
=
(
"enabled"
,
"schedule_enabled"
),
)
name
=
TemplateColumn
(
template_name
=
"dashboard/node-list/column-name.html"
,
order_by
=
"normalized_name"
)
priority
=
Column
(
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
)
number_of_VMs
=
TemplateColumn
(
verbose_name
=
_
(
"Number of VMs"
),
template_name
=
'dashboard/node-list/column-vm.html'
,
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
)
monitor
=
TemplateColumn
(
verbose_name
=
_
(
"Monitor"
),
template_name
=
'dashboard/node-list/column-monitor.html'
,
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-monitor'
}},
orderable
=
False
,
)
minion_online
=
BooleanColumn
(
verbose_name
=
_
(
"Minion online"
),
attrs
=
{
'th'
:
{
'class'
:
'node-list-table-thin'
}},
orderable
=
False
,
)
class
Meta
:
model
=
Node
attrs
=
{
'class'
:
(
'table table-bordered table-striped table-hover '
'node-list-table'
)}
fields
=
(
'pk'
,
'name'
,
'host'
,
'get_status_display'
,
'priority'
,
'minion_online'
,
'overcommit'
,
'number_of_VMs'
,
)
#
class NodeListTable(Table):
#
#
pk = Column(
#
verbose_name="ID",
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
)
#
#
overcommit = Column(
#
verbose_name=_("Overcommit"),
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
)
#
#
get_status_display = Column(
#
verbose_name=_("Status"),
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
order_by=("enabled", "schedule_enabled"),
#
)
#
#
name = TemplateColumn(
#
template_name="dashboard/node-list/column-name.html",
#
order_by="normalized_name"
#
)
#
#
priority = Column(
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
)
#
#
number_of_VMs = TemplateColumn(
#
verbose_name=_("Number of VMs"),
#
template_name='dashboard/node-list/column-vm.html',
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
)
#
#
monitor = TemplateColumn(
#
verbose_name=_("Monitor"),
#
template_name='dashboard/node-list/column-monitor.html',
#
attrs={'th': {'class': 'node-list-table-monitor'}},
#
orderable=False,
#
)
#
#
minion_online = BooleanColumn(
#
verbose_name=_("Minion online"),
#
attrs={'th': {'class': 'node-list-table-thin'}},
#
orderable=False,
#
)
#
#
class Meta:
#
model = Node
#
attrs = {'class': ('table table-bordered table-striped table-hover '
#
'node-list-table')}
#
fields = ('pk', 'name', 'host', 'get_status_display', 'priority',
#
'minion_online', 'overcommit', 'number_of_VMs', )
class
GroupListTable
(
Table
):
...
...
circle/dashboard/templates/auth/login.html
View file @
c4d12b46
...
...
@@ -14,7 +14,7 @@
{% include "display-form-errors.html" %}
</div>
{% endif %}
<div
class=
"col-xs-
{% if saml2 %}6{% else %}12{% endif %}
"
>
<div
class=
"col-xs-
6
"
>
<div
class=
"login-form"
>
<form
method=
"POST"
>
{% csrf_token %}
...
...
@@ -34,11 +34,15 @@
</form>
</div>
</div>
{% if saml2 %}
<div
class=
"col-xs-6"
>
<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>
{% endif %}
</div>
{% endblock %}
circle/dashboard/validators.py
View file @
c4d12b46
...
...
@@ -18,7 +18,6 @@
from
django.core.exceptions
import
ValidationError
from
django.utils.translation
import
ugettext_lazy
as
_
from
lxml
import
etree
as
ET
import
logging
rng_file
=
"/usr/share/libvirt/schemas/domain.rng"
...
...
@@ -31,25 +30,6 @@ footer = "</domain>"
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
):
"""Validate value as a connect command template.
...
...
circle/dashboard/views/index.py
View file @
c4d12b46
...
...
@@ -25,7 +25,7 @@ from django.conf import settings
from
django.contrib.auth.models
import
Group
,
User
from
django.core.cache
import
cache
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
network.models
import
Vxlan
...
...
circle/openstack_auth/views.py
View file @
c4d12b46
...
...
@@ -61,6 +61,8 @@ def login(request, template_name=None, extra_context=None, **kwargs):
auth_type
=
request
.
POST
.
get
(
'auth_type'
,
'credentials'
)
if
utils
.
is_websso_enabled
()
and
auth_type
!=
'credentials'
:
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
)
return
shortcuts
.
redirect
(
url
)
...
...
circle/vm/admin.py
View file @
c4d12b46
...
...
@@ -18,8 +18,7 @@
from
django.contrib
import
admin
from
.models
import
(
Instance
,
InstanceActivity
,
InstanceTemplate
,
Interface
,
InterfaceTemplate
,
Lease
,
NamedBaseResourceConfig
,
Node
,
NodeActivity
,
Trait
)
InterfaceTemplate
,
Lease
,
NamedBaseResourceConfig
,
Trait
)
class
InstanceActivityAdmin
(
admin
.
ModelAdmin
):
...
...
@@ -33,6 +32,4 @@ admin.site.register(Interface)
admin
.
site
.
register
(
InterfaceTemplate
)
admin
.
site
.
register
(
Lease
)
admin
.
site
.
register
(
NamedBaseResourceConfig
)
admin
.
site
.
register
(
Node
)
admin
.
site
.
register
(
NodeActivity
)
admin
.
site
.
register
(
Trait
)
circle/vm/models/__init__.py
View file @
c4d12b46
# flake8: noqa
from
.activity
import
InstanceActivity
from
.activity
import
NodeActivity
from
.activity
import
node_activity
from
.common
import
BaseResourceConfigModel
from
.common
import
Lease
from
.common
import
NamedBaseResourceConfig
...
...
@@ -13,12 +11,10 @@ from .instance import post_state_changed
from
.instance
import
pre_state_changed
from
.network
import
InterfaceTemplate
from
.network
import
Interface
from
.node
import
Node
__all__
=
[
'InstanceActivity'
,
'BaseResourceConfigModel'
,
'NamedBaseResourceConfig'
,
'VirtualMachineDescModel'
,
'InstanceTemplate'
,
'Instance'
,
'post_state_changed'
,
'pre_state_changed'
,
'InterfaceTemplate'
,
'Interface'
,
'Trait'
,
'Node'
,
'NodeActivity'
,
'Lease'
,
'node_activity'
,
'pwgen'
'Interface'
,
'Trait'
,
'NodeActivity'
,
'Lease'
,
'node_activity'
]
circle/vm/models/activity.py
View file @
c4d12b46
...
...
@@ -196,71 +196,6 @@ class InstanceActivity(ActivityModel):
return
self
.
instance
.
get_operation_from_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
):
# TODO check if other manager workers are running
msg_txt
=
ugettext_noop
(
"Manager is restarted, activity is cleaned up. "
...
...
circle/vm/models/instance.py
View file @
c4d12b46
...
...
@@ -51,7 +51,6 @@ from ..tasks import agent_tasks
from
.activity
import
(
ActivityInProgressError
,
InstanceActivity
)
from
.common
import
BaseResourceConfigModel
,
Lease
from
.network
import
Interface
from
.node
import
Node
,
Trait
from
network.models
import
EditorElement
...
...
@@ -109,11 +108,6 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
verbose_name
=
_
(
"Lease"
))
raw_data
=
TextField
(
verbose_name
=
_
(
'raw_data'
),
blank
=
True
,
help_text
=
_
(
'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'
),
help_text
=
(
_
(
'Name of operating system in format like '
'"Ubuntu 12.04 LTS Desktop amd64".'
)))
...
...
@@ -222,10 +216,6 @@ class Instance(OperatedMixin, TimeStampedModel):
verbose_name
=
_
(
'time of delete'
),
help_text
=
_
(
"Proposed time of automatic "
"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'
,
help_text
=
_
(
"Set of mounted disks."
),
verbose_name
=
_
(
'disks'
))
...
...
circle/vm/operations.py
View file @
c4d12b46
This diff is collapsed.
Click to expand it.
requirements/circlestack.txt
View file @
c4d12b46
...
...
@@ -59,15 +59,11 @@ jsonschema==2.6.0
keystoneauth1==3.4.0
kombu==3.0.30
logutils==0.3.3
lxml==3.4.4
MarkupSafe==0.23
microsofttranslator==0.8
models==0.9.3
MarkupSafe==1.0
monotonic==1.4
msgpack==0.5.4
msgpack-python==0.5.4
munch==2.2.0
MySQL-python==1.2.5
netaddr==0.7.19
netifaces==0.10.6
nltk==3.2.5
...
...
@@ -95,14 +91,12 @@ ply==3.10
polib==1.1.0
prettytable==0.7.2
prompt-toolkit==1.0.15
psycopg2==2.6
ptyprocess==0.5.2
pyasn1==0.4.2
pycparser==2.18
pycryptodomex==3.4.12
Pygments==2.0.2
pyinotify==0.9.5
pylibmc==1.4.3
PyNaCl==1.2.1
pyOpenSSL==17.5.0
pyotp==2.1.1
...
...
@@ -122,7 +116,6 @@ requests==2.18.4
requestsexceptions==1.4.0
rfc3986==1.1.0
rosetta==0.3
salt==2014.7.0
scandir==1.7
scipy==1.0.0
semantic-version==2.6.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment