Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
ad35a055
authored
Jun 14, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard, storage, vm: remove secret
parent
a352d93c
Pipeline
#111
failed with stage
in 0 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
23 deletions
+30
-23
circle/dashboard/fixtures/test-vm-fixture.json
+0
-1
circle/dashboard/forms.py
+1
-3
circle/dashboard/templates/dashboard/storage/form_chunk.html
+0
-1
circle/dashboard/views/storage.py
+4
-7
circle/storage/migrations/0010_remove_datastore_secret.py
+18
-0
circle/storage/models.py
+2
-5
circle/vm/operations.py
+4
-5
circle/vm/tasks/vm_tasks.py
+1
-1
No files found.
circle/dashboard/fixtures/test-vm-fixture.json
View file @
ad35a055
...
...
@@ -22,7 +22,6 @@
"fields"
:
{
"type"
:
"file"
,
"ceph_user"
:
null
,
"secret"
:
null
,
"path"
:
"/disks"
,
"hostname"
:
"wut"
,
"name"
:
"diszkek"
...
...
circle/dashboard/forms.py
View file @
ad35a055
...
...
@@ -36,7 +36,6 @@ from crispy_forms.layout import (
)
from
crispy_forms.utils
import
render_field
from
crispy_forms.bootstrap
import
FormActions
from
django
import
forms
from
django.contrib.auth.forms
import
UserCreationForm
as
OrgUserCreationForm
...
...
@@ -1661,7 +1660,6 @@ class CephDataStoreForm(DataStoreForm):
Fieldset
(
''
,
'ceph_user'
,
'secret'
,
)
)
return
helper
...
...
@@ -1669,7 +1667,7 @@ class CephDataStoreForm(DataStoreForm):
class
Meta
:
model
=
DataStore
fields
=
(
"type"
,
"name"
,
"path"
,
"hostname"
,
"ceph_user"
,
"secret"
,
)
"ceph_user"
,)
class
StorageListSearchForm
(
forms
.
Form
):
...
...
circle/dashboard/templates/dashboard/storage/form_chunk.html
View file @
ad35a055
...
...
@@ -17,7 +17,6 @@
<fieldset>
<legend>
{% trans "Ceph block storage authentication settings" %}
</legend>
{{ form.ceph_user|as_crispy_field }}
{{ form.secret|as_crispy_field }}
</fieldset>
{% endif %}
...
...
circle/dashboard/views/storage.py
View file @
ad35a055
...
...
@@ -29,7 +29,7 @@ from django.contrib.messages.views import SuccessMessageMixin
from
django.shortcuts
import
redirect
from
django_tables2
import
SingleTableView
from
django.http
import
(
Http404
,
HttpResponse
,
HttpResponse
Redirect
,
JsonResponse
Http404
,
HttpResponseRedirect
,
JsonResponse
)
from
django.core.exceptions
import
PermissionDenied
...
...
@@ -284,10 +284,8 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
def
form_valid
(
self
,
form
):
# automatic credential refresh
changed
=
False
if
self
.
object
.
type
==
"ceph_block"
:
changed
=
(
self
.
object
.
tracker
.
has_changed
(
"secret"
)
or
self
.
object
.
tracker
.
has_changed
(
"ceph_user"
))
changed
=
(
self
.
object
.
type
==
"ceph_block"
and
self
.
object
.
tracker
.
has_changed
(
"ceph_user"
))
response
=
super
(
StorageDetail
,
self
)
.
form_valid
(
form
)
if
changed
:
nodes
=
Node
.
objects
.
all
()
...
...
@@ -295,8 +293,7 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
if
node
.
get_online
():
node
.
refresh_credential
(
user
=
self
.
request
.
user
,
username
=
self
.
object
.
ceph_user
,
secret
=
self
.
object
.
secret
)
username
=
self
.
object
.
ceph_user
)
return
response
...
...
circle/storage/migrations/0010_remove_datastore_secret.py
0 → 100644
View file @
ad35a055
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'storage'
,
'0009_auto_20160614_1125'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'datastore'
,
name
=
'secret'
,
),
]
circle/storage/models.py
View file @
ad35a055
...
...
@@ -27,7 +27,7 @@ import re
from
django.conf
import
settings
from
celery.contrib.abortable
import
AbortableAsyncResult
from
django.db.models
import
(
Model
,
BooleanField
,
CharField
,
DateTimeField
,
ForeignKey
,
IntegerField
,
ManyToManyField
)
ForeignKey
)
from
django.core.exceptions
import
ObjectDoesNotExist
,
ValidationError
from
django.core.urlresolvers
import
reverse
from
django.utils
import
timezone
...
...
@@ -71,11 +71,9 @@ class DataStore(Model):
ceph_user
=
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'Ceph username'
))
secret
=
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
,
verbose_name
=
_
(
'secret key'
))
destroyed
=
DateTimeField
(
blank
=
True
,
default
=
None
,
null
=
True
)
tracker
=
FieldTracker
(
fields
=
[
"ceph_user"
,
"secret"
])
tracker
=
FieldTracker
(
fields
=
[
"ceph_user"
])
class
Meta
:
ordering
=
[
'name'
]
...
...
@@ -460,7 +458,6 @@ class Disk(TimeStampedModel):
desc
=
self
.
get_vmdisk_desc_for_filesystem
()
desc
[
"ceph_user"
]
=
self
.
datastore
.
ceph_user
desc
[
"secret"
]
=
self
.
datastore
.
secret
return
desc
...
...
circle/vm/operations.py
View file @
ad35a055
...
...
@@ -580,8 +580,7 @@ class MigrateOperation(RemoteInstanceOperation):
if
ceph_blocks
.
exists
():
ds
=
ceph_blocks
[
0
]
.
datastore
to_node
.
refresh_credential
(
user
=
user
,
username
=
ds
.
ceph_user
,
secret
=
ds
.
secret
)
username
=
ds
.
ceph_user
)
with
activity
.
sub_activity
(
'migrate_vm'
,
readable_name
=
create_readable
(
ugettext_noop
(
"migrate to
%(node)
s"
),
node
=
to_node
)):
...
...
@@ -1360,11 +1359,11 @@ class RefreshCredentialOperation(RemoteNodeOperation):
task
=
vm_tasks
.
refresh_credential
def
_get_remote_args
(
self
,
**
kwargs
):
return
[
kwargs
[
"username"
]
,
kwargs
[
"secret"
]
]
return
[
kwargs
[
"username"
]]
def
_operation
(
self
,
activity
,
username
,
secret
):
def
_operation
(
self
,
activity
,
username
):
super
(
RefreshCredentialOperation
,
self
)
.
_operation
(
username
=
username
,
secret
=
secret
)
username
=
username
)
@register_operation
...
...
circle/vm/tasks/vm_tasks.py
View file @
ad35a055
...
...
@@ -188,5 +188,5 @@ def screenshot(params):
@celery.task
(
name
=
'vmdriver.refresh_secret'
)
def
refresh_credential
(
user
,
secret
):
def
refresh_credential
(
user
):
pass
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