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
b5a40679
authored
Aug 02, 2019
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix multiple creation in vm module
parent
200ae4f7
Pipeline
#802
failed with stage
in 38 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
implementation/utils/connection.py
+0
-1
implementation/vm/instance.py
+8
-3
No files found.
implementation/utils/connection.py
View file @
b5a40679
...
@@ -9,7 +9,6 @@ class OpenStackConnection(object):
...
@@ -9,7 +9,6 @@ class OpenStackConnection(object):
The connection only connects when something called in it."""
The connection only connects when something called in it."""
def
__init__
(
self
,
auth
):
def
__init__
(
self
,
auth
):
super
(
OpenStackConnection
,
self
)
.
__init__
()
self
.
openstack
=
openstack
.
connect
(
auth_url
=
auth
[
"auth_url"
],
self
.
openstack
=
openstack
.
connect
(
auth_url
=
auth
[
"auth_url"
],
username
=
auth
[
"username"
],
username
=
auth
[
"username"
],
password
=
auth
[
"password"
],
password
=
auth
[
"password"
],
...
...
implementation/vm/instance.py
View file @
b5a40679
...
@@ -50,7 +50,7 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
...
@@ -50,7 +50,7 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
@openstackError
@openstackError
def
create_vm_from_template
(
self
,
name
,
image
,
flavor
,
networks
):
def
create_vm_from_template
(
self
,
name
,
image
,
flavor
,
networks
):
return
self
.
create_multiple_vm_from_template
(
name
,
image
,
flavor
,
return
self
.
create_multiple_vm_from_template
(
name
,
image
,
flavor
,
networks
,
1
)
networks
,
1
)
[
0
]
@openstackError
@openstackError
def
create_multiple_vm_from_template
(
self
,
name
,
image
,
flavor
,
networks
,
def
create_multiple_vm_from_template
(
self
,
name
,
image
,
flavor
,
networks
,
...
@@ -62,13 +62,18 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
...
@@ -62,13 +62,18 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
if
not
image
:
if
not
image
:
raise
ValueError
(
"The template not found"
)
raise
ValueError
(
"The template not found"
)
server_ids
=
[]
# TODO: Maybe we need parallel execution of multiple creation
for
i
in
range
(
0
,
number
):
new_server
=
compute
.
create_server
(
name
=
name
,
new_server
=
compute
.
create_server
(
name
=
name
,
flavorRef
=
flav
.
id
,
flavorRef
=
flav
.
id
,
imageRef
=
image
.
id
,
imageRef
=
image
.
id
,
networks
=
networks
,
networks
=
networks
,
min_count
=
number
,
)
)
return
self
.
convert_server_to_instance
(
new_server
)
server_ids
.
append
(
new_server
.
id
)
return
server_ids
@openstackError
@openstackError
def
create_flavor
(
self
,
name
,
ram
,
vcpus
,
initial_disk
):
def
create_flavor
(
self
,
name
,
ram
,
vcpus
,
initial_disk
):
...
...
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