Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #179 from deNBI/dev
Browse files Browse the repository at this point in the history
updated to list_server
  • Loading branch information
dweinholz authored Nov 25, 2019
2 parents 5f19128 + cc70ce6 commit d49817b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions VirtualMachineService/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,12 +872,15 @@ def openstack_server_to_thrift_server(self, server):
self.logger.info("Convert server {} to thrift server".format(server))
fixed_ip = None
floating_ip = None
diskspace = 0

if server["os-extended-volumes:volumes_attached"]:
volume_id = server["os-extended-volumes:volumes_attached"][0]["id"]
diskspace = self.conn.block_storage.get_volume(volume_id).to_dict()["size"]
else:
diskspace = 0
try:
diskspace = self.conn.block_storage.get_volume(volume_id).to_dict()["size"]
except Exception as e:
self.logger.exception("Could not found volume {}: {}".format(volume_id, e))

if server["OS-SRV-USG:launched_at"]:
dt = datetime.datetime.strptime(
server["OS-SRV-USG:launched_at"][:-7], "%Y-%m-%dT%H:%M:%S"
Expand Down

0 comments on commit d49817b

Please sign in to comment.