Added graceful handling of OpenNebula network not available
This commit is contained in:
parent
41d1e8b003
commit
354cb144f7
1 changed files with 5 additions and 0 deletions
|
@ -130,11 +130,14 @@ class HostingManageVMsAdmin(admin.ModelAdmin):
|
||||||
messages.add_message(request, messages.ERROR, "Socket timeout error.")
|
messages.add_message(request, messages.ERROR, "Socket timeout error.")
|
||||||
except OpenNebulaException:
|
except OpenNebulaException:
|
||||||
messages.add_message(request, messages.ERROR, "OpenNebulaException occurred.")
|
messages.add_message(request, messages.ERROR, "OpenNebulaException occurred.")
|
||||||
|
except OSError as err:
|
||||||
|
messages.add_message(request, messages.ERROR, str("OS error: {0}".format(err)))
|
||||||
context = dict(
|
context = dict(
|
||||||
# Include common variables for rendering the admin template.
|
# Include common variables for rendering the admin template.
|
||||||
self.admin_site.each_context(request),
|
self.admin_site.each_context(request),
|
||||||
vms = vm_pool,
|
vms = vm_pool,
|
||||||
)
|
)
|
||||||
|
|
||||||
return TemplateResponse(request, "hosting/managevms.html", context)
|
return TemplateResponse(request, "hosting/managevms.html", context)
|
||||||
|
|
||||||
# Creating VM by using method allocate(client, template)
|
# Creating VM by using method allocate(client, template)
|
||||||
|
@ -162,6 +165,8 @@ class HostingManageVMsAdmin(admin.ModelAdmin):
|
||||||
messages.add_message(request, messages.ERROR, "Socket timeout error.")
|
messages.add_message(request, messages.ERROR, "Socket timeout error.")
|
||||||
except OpenNebulaException:
|
except OpenNebulaException:
|
||||||
messages.add_message(request, messages.ERROR, "OpenNebulaException occurred.")
|
messages.add_message(request, messages.ERROR, "OpenNebulaException occurred.")
|
||||||
|
except OSError as err:
|
||||||
|
messages.add_message(request, messages.ERROR, str("OS error: {0}".format(err)))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
messages.add_message(request, messages.ERROR, "Please select an appropriate value for vm template.")
|
messages.add_message(request, messages.ERROR, "Please select an appropriate value for vm template.")
|
||||||
return redirect('admin:showvms')
|
return redirect('admin:showvms')
|
||||||
|
|
Loading…
Reference in a new issue