raise webob.exc.HTTPNotFound(explanation=error.msg)
readonly_flag = body['os-update_readonly_flag'].get('readonly')
+ if not readonly_flag:
+ msg = _("Must specify readonly in request.")
+ raise webob.exc.HTTPBadRequest(explanation=msg)
+
if isinstance(readonly_flag, basestring):
try:
readonly_flag = strutils.bool_from_string(readonly_flag,
def make_update_readonly_flag_test(self, readonly, return_code):
body = {"os-update_readonly_flag": {"readonly": readonly}}
+ if readonly is None:
+ body = {"os-update_readonly_flag": {}}
req = webob.Request.blank('/v2/fake/volumes/1/action')
req.method = "POST"
req.body = jsonutils.dumps(body)
make_update_readonly_flag_test(self, 'false', 202)
make_update_readonly_flag_test(self, 'tt', 400)
make_update_readonly_flag_test(self, 11, 400)
+ make_update_readonly_flag_test(self, None, 400)
def stub_volume_get(self, context, volume_id):