Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
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
01de9191
authored
Jul 09, 2019
by
Bodor Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use connection dict to connect to the interface
parent
ab579640
Pipeline
#751
failed with stages
in 18 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
recircle/image/views.py
+4
-5
recircle/instance/views.py
+3
-6
No files found.
recircle/image/views.py
View file @
01de9191
...
...
@@ -3,18 +3,17 @@ from image.serializers import DiskSerializer
# from django.shortcuts import render
from
rest_framework.views
import
APIView
from
rest_framework.response
import
Response
import
openstack
from
interface_openstack.implementation.image.openstack_image_manager
import
(
OpenstackImageManager
,
)
import
openstack
conn
=
openstack
.
connect
(
cloud
=
"openstack"
)
from
django.conf
import
settings
class
DiskList
(
APIView
):
def
get
(
self
,
request
,
format
=
None
):
# OpenStack
interface
=
OpenstackImageManager
(
conn
)
interface
=
OpenstackImageManager
(
settings
.
CONNECTION
)
return
Response
([
disk
.
__dict__
for
disk
in
interface
.
list
()])
# Create response
...
...
recircle/instance/views.py
View file @
01de9191
...
...
@@ -4,14 +4,11 @@ from django.http import Http404
from
rest_framework.views
import
APIView
from
rest_framework.response
import
Response
from
rest_framework
import
status
from
interface_openstack.implementation.vm.instance
import
OSVirtualMachineManager
import
openstack
import
datetime
conn
=
openstack
.
connect
(
cloud
=
"openstack"
)
from
interface_openstack.implementation.vm.instance
import
OSVirtualMachineManager
from
django.conf
import
settings
class
InstanceList
(
APIView
):
def
get
(
self
,
request
,
format
=
None
):
...
...
@@ -20,7 +17,7 @@ class InstanceList(APIView):
def
post
(
self
,
request
,
format
=
None
):
data
=
request
.
data
interface
=
OSVirtualMachineManager
(
conn
)
interface
=
OSVirtualMachineManager
(
settings
.
CONNECTION
)
imageId
=
"da51253f-867c-472d-8ce0-81e7b7126d60"
flavorId
=
"1"
networks
=
[{
"uuid"
:
"c03d0d4b-413e-4cc6-9ebe-c0b5ca0dac3a"
}]
...
...
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