Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
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
4ef2a8a8
authored
Dec 30, 2022
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter ci disk
parent
20af2315
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
circle/dashboard/serializers.py
+4
-0
circle/dashboard/views/vm.py
+7
-1
No files found.
circle/dashboard/serializers.py
View file @
4ef2a8a8
...
...
@@ -82,8 +82,12 @@ class InstanceSerializer(serializers.ModelSerializer):
macaddr
=
serializers
.
SerializerMethodField
(
'get_mac'
)
sshportipv4
=
serializers
.
SerializerMethodField
(
'get_sshportipv4'
)
hostipv4
=
serializers
.
SerializerMethodField
(
'get_hostipv4'
)
disks
=
serializers
.
SerializerMethodField
(
'get_disks'
)
#interfaces = serializers.SerializerMethodField('get_interfaces')
def
get_disks
(
self
,
i
):
return
list
(
disk
.
id
for
disk
in
i
.
disks
.
filter
(
ci_disk
=
False
)
.
all
())
def
get_ipv4
(
self
,
i
):
return
str
(
i
.
ipv4
)
...
...
circle/dashboard/views/vm.py
View file @
4ef2a8a8
...
...
@@ -260,10 +260,16 @@ class InstanceREST(APIView):
serializer
=
InstanceSerializer
(
data
=
data
)
if
serializer
.
is_valid
():
inst
=
serializer
.
save
()
if
'disks'
in
data
:
for
d
in
data
[
'disks'
]:
d
=
Disk
.
objects
.
get
(
id
=
d
)
inst
.
disks
.
add
(
d
)
inst
.
save
()
networks
=
[]
if
'vlans'
in
data
:
for
v
in
data
[
'vlans'
]:
v
=
Vlan
.
objects
.
filter
(
vid
=
v
)
.
get
(
)
v
=
Vlan
.
objects
.
get
(
id
=
v
)
if
not
v
.
has_level
(
request
.
user
,
"user"
):
raise
PermissionDenied
()
networks
.
append
(
InterfaceTemplate
(
vlan
=
v
,
managed
=
v
.
managed
))
...
...
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