Commit 068a7155 by Chif Gergő

Fix conversion type error

parent e01d873c
......@@ -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"],
......
......@@ -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,
......
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