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
Commit
2185b5fb
authored
Aug 09, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage, dashboard: rework ceph_user field tracking, avoids pickling errors
parent
79aeec80
Pipeline
#165
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
circle/dashboard/views/storage.py
+11
-8
circle/storage/models.py
+7
-2
No files found.
circle/dashboard/views/storage.py
View file @
2185b5fb
...
...
@@ -283,17 +283,20 @@ class StorageDetail(SuperuserRequiredMixin, UpdateView):
return
reverse
(
"dashboard.views.storage-detail"
,
kwargs
=
{
"pk"
:
ds
.
id
})
def
form_valid
(
self
,
form
):
response
=
super
(
StorageDetail
,
self
)
.
form_valid
(
form
)
# automatic credential refresh
changed
=
(
self
.
object
.
type
==
"ceph_block"
and
self
.
object
.
tracker
.
has_changed
(
"ceph_user"
))
response
=
super
(
StorageDetail
,
self
)
.
form_valid
(
form
)
self
.
object
.
ceph_user_changed
)
if
changed
:
nodes
=
Node
.
objects
.
all
()
for
node
in
nodes
:
if
node
.
get_online
():
node
.
refresh_credential
(
user
=
self
.
request
.
user
,
username
=
self
.
object
.
ceph_user
)
try
:
nodes
=
Node
.
objects
.
all
()
for
node
in
nodes
:
if
node
.
get_online
():
node
.
refresh_credential
(
user
=
self
.
request
.
user
,
username
=
self
.
object
.
ceph_user
)
except
Exception
as
e
:
messages
.
error
(
self
.
request
,
unicode
(
e
))
return
response
...
...
circle/storage/models.py
View file @
2185b5fb
...
...
@@ -33,7 +33,6 @@ from django.core.urlresolvers import reverse
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext_lazy
as
_
,
ugettext_noop
from
model_utils.models
import
TimeStampedModel
from
model_utils
import
FieldTracker
from
sizefield.models
import
FileSizeField
from
.tasks
import
local_tasks
,
storage_tasks
...
...
@@ -73,7 +72,7 @@ class DataStore(Model):
verbose_name
=
_
(
'Ceph username'
))
destroyed
=
DateTimeField
(
blank
=
True
,
default
=
None
,
null
=
True
)
tracker
=
FieldTracker
(
fields
=
[
"ceph_user"
])
ceph_user_changed
=
False
class
Meta
:
ordering
=
[
'name'
]
...
...
@@ -83,6 +82,12 @@ class DataStore(Model):
def
__unicode__
(
self
):
return
u'
%
s (
%
s)'
%
(
self
.
name
,
self
.
path
)
def
save
(
self
,
*
args
,
**
kwargs
):
if
self
.
pk
is
not
None
:
orig
=
DataStore
.
objects
.
get
(
pk
=
self
.
pk
)
self
.
ceph_user_changed
=
orig
.
ceph_user
!=
self
.
ceph_user
super
(
DataStore
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
get_remote_queue_name
(
self
,
queue_id
,
priority
=
None
,
check_worker
=
True
):
logger
.
debug
(
"Checking for storage queue
%
s.
%
s"
,
...
...
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