Commit b5a40679 by Chif Gergő

Fix multiple creation in vm module

parent 200ae4f7
Pipeline #802 failed with stage
in 38 seconds
......@@ -9,7 +9,6 @@ class OpenStackConnection(object):
The connection only connects when something called in it."""
def __init__(self, auth):
super(OpenStackConnection, self).__init__()
self.openstack = openstack.connect(auth_url=auth["auth_url"],
username=auth["username"],
password=auth["password"],
......
......@@ -50,7 +50,7 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
@openstackError
def create_vm_from_template(self, name, image, flavor, networks):
return self.create_multiple_vm_from_template(name, image, flavor,
networks, 1)
networks, 1)[0]
@openstackError
def create_multiple_vm_from_template(self, name, image, flavor, networks,
......@@ -62,13 +62,18 @@ class OSVirtualMachineManager(InstanceInterface, OpenStackConnection):
if not image:
raise ValueError("The template not found")
new_server = compute.create_server(name=name,
flavorRef=flav.id,
imageRef=image.id,
networks=networks,
min_count=number,
)
return self.convert_server_to_instance(new_server)
server_ids = []
# TODO: Maybe we need parallel execution of multiple creation
for i in range(0, number):
new_server = compute.create_server(name=name,
flavorRef=flav.id,
imageRef=image.id,
networks=networks,
)
server_ids.append(new_server.id)
return server_ids
@openstackError
def create_flavor(self, name, ram, vcpus, initial_disk):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment