Skip to content

Commit

Permalink
Add volume type in EstimateResources
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed May 9, 2024
1 parent 4d8e0ea commit 5ec051b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
5 changes: 4 additions & 1 deletion IM/InfrastructureManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,10 @@ def EstimateResouces(radl_data, auth):
cont = 1
while (concrete_system.getValue("disk." + str(cont) + ".size")):
volume_size = concrete_system.getFeature("disk." + str(cont) + ".size").getValue('G')
res["storage"].append({"sizeInGigabytes": volume_size})
vol_info = {"sizeInGigabytes": volume_size}
if concrete_system.getValue("disk." + str(cont) + ".type"):
vol_info["type"] = concrete_system.getValue("disk." + str(cont) + ".type")
res["storage"].append(vol_info)
cont += 1

return res
3 changes: 3 additions & 0 deletions IM/connectors/OpenStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ def setVolumesInfo(self, vm, node):
if 'attachments' in volume.extra and volume.extra['attachments']:
vm.info.systems[0].setValue("disk." + str(cont) + ".device",
os.path.basename(volume.extra['attachments'][0]['device']))
if 'volume_type' in volume.extra and volume.extra['volume_type']:
vm.info.systems[0].setValue("disk." + str(cont) + ".type", volume.extra['volume_type'])

cont += 1
except Exception as ex:
self.log_warn("Error getting volume info: %s" % get_ex_error(ex))
Expand Down
11 changes: 6 additions & 5 deletions doc/source/REST.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ POST ``http://imserver.com/infrastructures``
the infrastructure with the following format (memory unit MB, disk and storage unit GB)::

{
'compute': [
{'cpu': 2, 'memory': 4096, 'disk': 20},
{'cpu': 1, 'memory': 2048, 'disk': 10}
"compute": [
{"cpuCores": 2, "memoryInMegabytes": 4096, "diskSizeInGigabytes": 20},
{"cpuCores": 1, "memoryInMegabytes": 2048, "diskSizeInGigabytes": 10}
],
'storage': [
{'size': 100}
"storage": [
{"sizeInGigabytes": 100, "type": "lvm"},
{"sizeInGigabytes": 200},
]
}

Expand Down
11 changes: 6 additions & 5 deletions doc/source/xmlrpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,12 @@ This is the list of method names:
with the following format (memory unit MB, disk and storage unit GB)::

{
'compute': [
{'cpu': 2, 'memory': 4096, 'disk': 20},
{'cpu': 1, 'memory': 2048, 'disk': 10}
"compute": [
{"cpuCores": 2, "memoryInMegabytes": 4096, "diskSizeInGigabytes": 20},
{"cpuCores": 1, "memoryInMegabytes": 2048, "diskSizeInGigabytes": 10}
],
'storage': [
{'size': 100}
"storage": [
{"sizeInGigabytes": 100, "type": "lvm"},
{"sizeInGigabytes": 200},
]
}

0 comments on commit 5ec051b

Please sign in to comment.