Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
interface-openstack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
068a7155
authored
Jul 11, 2019
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conversion type error
parent
e01d873c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
9 deletions
+8
-9
implementation/utils/connection.py
+1
-2
implementation/vm/instance.py
+7
-7
No files found.
implementation/utils/connection.py
View file @
068a7155
...
...
@@ -13,9 +13,8 @@ class OpenStackConnection(object):
self
.
openstack
=
openstack
.
connect
(
auth_url
=
auth
[
"auth_url"
],
username
=
auth
[
"username"
],
password
=
auth
[
"password"
],
project_id
=
auth
[
"project_id"
],
project_name
=
auth
[
"project_name"
],
region_name
=
auth
[
"region_name"
]
region_name
=
auth
[
"region_name"
]
,
)
client_auth
=
v3
.
Password
(
auth_url
=
auth
[
"auth_url"
],
username
=
auth
[
"username"
],
...
...
implementation/vm/instance.py
View file @
068a7155
...
...
@@ -45,7 +45,8 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
networks
=
networks
,
block_device_mapping
=
devices
)
return
self
.
convert_server_to_instance
(
new_server
)
server
=
self
.
_get_openstack_server
(
new_server
.
id
)
return
self
.
convert_server_to_instance
(
server
)
@openstackError
def
create_vm_from_template
(
self
,
name
,
image
,
flavor
,
networks
):
...
...
@@ -68,7 +69,8 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
networks
=
networks
,
min_count
=
number
,
)
return
self
.
convert_server_to_instance
(
new_server
)
server
=
self
.
_get_openstack_server
(
new_server
.
id
)
return
self
.
convert_server_to_instance
(
server
)
@openstackError
def
create_flavor
(
self
,
name
,
ram
,
vcpus
,
initial_disk
):
...
...
@@ -183,12 +185,10 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
server
=
server_id
)
def
convert_server_to_instance
(
self
,
server
):
if
not
server
.
image
:
image_id
=
None
else
:
image_id
=
server
.
image
[
"id"
]
image_id
=
server
.
image
[
"id"
]
flavor
=
server
.
flavor
[
"id"
]
return
Instance
(
id
=
server
.
id
,
flavor
=
server
.
flavor
[
"id"
]
,
flavor
=
flavor
,
name
=
server
.
name
,
image_id
=
image_id
,
disks
=
server
.
attached_volumes
,
...
...
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