Skip to content

Commit bbc1d93

Browse files
authored
Merge pull request #205 from grycap/static2
Improve VM info page
2 parents b4ef74d + 3f5484f commit bbc1d93

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

app/__init__.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,17 @@ def showvminfo():
234234
response = im.get_vm_info(infid, vmid, auth_data)
235235
except Exception as ex:
236236
flash("Error: %s." % ex, 'error')
237+
return redirect(url_for('showinfrastructures'))
237238

238-
vminfo = {}
239-
state = ""
240-
nets = ""
241-
disks = ""
242-
deployment = ""
243239
if not response.ok:
244240
flash("Error retrieving VM info: \n" + response.text, 'error')
241+
return redirect(url_for('showinfrastructures'))
245242
else:
243+
vminfo = {}
244+
state = ""
245+
nets = ""
246+
disks = ""
247+
deployment = ""
246248
app.logger.debug("VM Info: %s" % response.text)
247249
radl_json = response.json()["radl"]
248250
outports = utils.get_out_ports(radl_json)
@@ -308,6 +310,14 @@ def showvminfo():
308310

309311
cont += 1
310312

313+
# delete disk info of disks without size
314+
for prop_name in ["device", "fstype", "mount_path"]:
315+
new_cont = cont
316+
prop = "disk.%s.%s" % (new_cont, prop_name)
317+
while prop in vminfo:
318+
del vminfo[prop]
319+
new_cont += 1
320+
311321
str_outports = ""
312322
if outports:
313323
for port in outports:

0 commit comments

Comments
 (0)