← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1265740] Re: incorrect return from exception.InvalidInput()

 

@lizheming

could this[0] be a hint?

[0] https://github.com/openstack/nova/blob/master/nova/exception.py#L276

** Changed in: nova
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1265740

Title:
  incorrect return from exception.InvalidInput()

Status in Cinder:
  Invalid
Status in OpenStack Compute (Nova):
  Invalid

Bug description:
  when I create instance, and set min_count=-1, like this:

  openstack@openstack-001:~$ curl -i -H "X-Auth-Token:6db450ec28174970be674af55c644e23" -H "Content-Type:application/json" http://127.0.0.1:8774/v2/e7fdc71e46bd4945a57104f3899b1335/servers -d '{"server":{"name":"test","flavorRef":"42","imageRef":"2e33aff9-63b4-497c-9c1b-8fe4ee567cce","min_count":-1}}'
  HTTP/1.1 400 Bad Request
  Content-Length: 110
  Content-Type: application/json; charset=UTF-8
  X-Compute-Request-Id: req-b33a8f37-e4a4-42b3-8488-ca669e80911d
  Date: Fri, 03 Jan 2014 08:04:18 GMT

  {"badRequest": {"message":
  "\u6536\u5230\u65e0\u6548\u7684\u8f93\u5165: min_count must be >= 1",
  "code": 400}}

  the return message is messy code. I review the code, find the code:
   if min_value is not None:
          if value < min_value:
              msg = _('%(value_name)s must be >= %(min_value)d')
              raise exception.InvalidInput(
                  reason=(msg % {'value_name': name,
                                 'min_value': min_value}))

  exception.InvalidInput has no para named reason. the para is message.
  replace message to reason, it is ok.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1265740/+subscriptions


References