summaryrefslogtreecommitdiffstats
path: root/nova/exception.py
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2012-08-11 20:51:27 +1000
committerMichael Still <mikal@stillhq.com>2012-08-14 09:56:58 +1000
commit4d350dc82ecfe1d272bfbd43445a78c69a32fc90 (patch)
treeec33ab174447f7861522410b4e486fc35588dd64 /nova/exception.py
parent4d9cca956c7df53e0ca47e88b01ea34e541d1a3e (diff)
downloadnova-4d350dc82ecfe1d272bfbd43445a78c69a32fc90.tar.gz
nova-4d350dc82ecfe1d272bfbd43445a78c69a32fc90.tar.xz
nova-4d350dc82ecfe1d272bfbd43445a78c69a32fc90.zip
Simple checks for instance user data.
Check that instance user data wont be truncated, and that it is valid base64 data. This partially resolves bug 1035055. I don't love the hard coded maximum length, but I haven't worked out how to get sqlalchemy to tell me the maximum size of the data type. Change-Id: I045d6b4481563d01cae371cf61a91781cfed6f4b
Diffstat (limited to 'nova/exception.py')
-rw-r--r--nova/exception.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 315147764..de8982488 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -1155,6 +1155,16 @@ class ConfigDriveUnknownFormat(NovaException):
"iso9660 or vfat.")
+class InstanceUserDataTooLarge(NovaException):
+ message = _("User data too large. User data must be no larger than "
+ "%(maxsize)s bytes once base64 encoded. Your data is "
+ "%(length)d bytes")
+
+
+class InstanceUserDataMalformed(NovaException):
+ message = _("User data needs to be valid base 64.")
+
+
def get_context_from_function_and_args(function, args, kwargs):
"""Find an arg of type RequestContext and return it.