Earlier  
Posted Nick Remark
#openstack-nova - 2017-01-12
08:51:45 openstackgerrit Zhenyu Zheng proposed openstack/nova: [poc] add a decorator to reject know bad filters. https://review.openstack.org/419256
09:33:58 openstackgerrit Takashi NATSUME proposed openstack/nova: api-ref: Fix a parameter in os-availability-zone.inc https://review.openstack.org/417233
09:35:20 gibi jo
09:35:22 gibi sorry
09:41:22 openstackgerrit OpenStack Proposal Bot proposed openstack/nova: Updated from global requirements https://review.openstack.org/415978
10:00:13 alex_xu gmann: johnthetubaguy Kevin_Zheng, another idea, we write a new formatter which always reject the validation. Then the schema may looks like this {"system_metadata": {"type": "string", "format": "reject_always"}}, then when user input system_metadata in the query, 400 returned. And we have a way to custom the error message returned from formatter.
10:10:26 gmann alex_xu: i see.
10:11:13 gmann alex_xu: i like to idea but worrying if it make json schema confusing but format name is conveying that anyways
10:12:28 alex_xu gmann: yea, benefits are we needn't python code to raise badrequest, less hacky in other places, no need one more decorator
10:12:47 gmann alex_xu: but one issue, format will not work if it is not string
10:13:03 alex_xu gmann: the query string in the url, always string :)
10:13:10 gmann alex_xu: yea better than python code doing that
10:13:22 gmann alex_xu: ah yea
10:15:27 alex_xu Kevin_Zheng will give a try, to see how that looks like
10:16:27 gmann alex_xu: but when it comes to schema it will be list of values right
10:18:12 alex_xu gmann: yea
10:18:57 gmann so "system_metadata" value will be in list while doing validation
10:18:59 alex_xu gmann: I think the key reason for this trouble was there is no way to express "I want to some specific properties, but I don't want some specific properites, and others just ignore" in the jsonschema
10:19:19 alex_xu gmann: yes
10:19:55 alex_xu gmann: and we still need to use patternProperties for internal attributes, the regex is "^_"
10:20:01 gmann alex_xu: yea, that is missing in json schema lib, they should provide any way to restrict few known properties
10:20:44 gmann alex_xu: true
10:21:12 johnthetubaguy alex_xu: I quite like that
10:21:27 alex_xu johnthetubaguy: cool \o/
10:21:35 johnthetubaguy alex_xu: but yeah, I guess you still have to keep the regex thing
10:22:00 johnthetubaguy alex_xu: what about type: "reject_always"?
10:22:05 johnthetubaguy or is that not allowed
10:22:24 gmann alex_xu: johnthetubaguy but will it work as values will not be string
10:22:30 alex_xu probably "patternProperties": {"^_": {"type": "string", "format": reject_always"}}
10:23:14 gmann https://github.com/openstack/nova/blob/master/nova/api/validation/__init__.py#L160
10:23:57 alex_xu johnthetubaguy: i'm not sure json-schema have a way to extend the type, I need to check that
10:24:39 johnthetubaguy I mean they are all strings in query string params anyways
10:25:55 gmann but we do convert those into list of values for validation, so they are array for schema
10:26:26 johnthetubaguy well, I guess I mean everything is a list of strings
10:27:36 gmann yea but json schema just ignore format validation and pass if instance is not string
10:28:52 alex_xu johnthetubaguy: gmann we can add new type. but I guess there is no way to change the error message. User will get a message about "this isn't a type of reject_always"
10:29:02 johnthetubaguy doh
10:29:05 johnthetubaguy good point
10:29:17 johnthetubaguy why are we moving away from the decorator approach?
10:30:38 alex_xu johnthetubaguy: probably avoid one more decorator, and we put all the info into the schema: it is not part of in the schema and part of in the decorator
10:30:56 alex_xu johnthetubaguy: and Kevin_Zheng show me this https://review.openstack.org/#/c/419256/2/nova/api/validation/__init__.py, I feel the change is bigger than I thought
10:31:20 alex_xu But I guess there can be some code sharing, but another worry is another refactor for the code
10:31:25 johnthetubaguy we don't really need min and max though
10:31:29 johnthetubaguy I thought
10:31:36 johnthetubaguy not yet anyways
10:32:15 alex_xu it needs a version control
10:32:42 alex_xu in the future we may add new filter before we reject all?
10:32:51 gmann yea version things we can avoid as of not and do when microversion bump
10:32:56 alex_xu oops, sorry, that isn't the case
10:32:57 Kevin_Zheng yeah, otherwise we can just do it in schema with additional=false
10:32:58 gmann not->now
10:34:57 openstackgerrit zhangyujun proposed openstack/nova: Query parameter validation for hosts API https://review.openstack.org/418880
10:37:07 alex_xu when we reject all, that decorator still can be there.
10:39:38 alex_xu emm...so, yes, sounds like no version is ok
10:43:12 alex_xu johnthetubaguy: gmann Kevin_Zheng I guess the only different is we want to put all the info together, or just split that special case out of schema? is that question we should answer?
10:48:15 gmann alex_xu: you mean in case we add in schema with new formatter ?
10:48:57 alex_xu gmann: yes
10:49:12 gmann alex_xu: but 'format' only work if instance going to be validated is string and in our case it is list of values right
10:49:43 alex_xu gmann: we have macro function 'multi_params', that works for list
10:51:19 openstackgerrit Davanum Srinivas (dims) proposed openstack/nova: Better black list for py35 tests https://review.openstack.org/419250
10:52:00 gmann alex_xu: yea but instance (values) will be list and we would not be able to define like {"system_metadata": {"type": "string", "format": "reject_always"}}
10:52:16 alex_xu gmann: here is https://github.com/openstack/nova/blob/master/nova/api/validation/parameter_types.py#L38
10:52:26 gmann we have to do like this - {"system_metadata": {multi_params, "format": "reject_always"}}
10:52:53 alex_xu gmann: sorry, it should be {"system_metadata": multi_params({"type": "string", "format": "reject_always"})}
10:54:01 gmann alex_xu: ahh i see, so that each item will be validated against "reject_always"
10:54:11 alex_xu gmann: yea
10:54:38 alex_xu but have to say reject_always format is another hacky thing. is it decorator more explicitly?
10:55:09 alex_xu s/is it decorator/ is decorator/
10:55:51 alex_xu s/explicitly/explicity/...
10:56:02 gmann humm, another issue may be error message otherwise i like new formatter way
10:56:24 gmann alex_xu: but we can catch and format error message which will be other hack but wotrks
10:57:46 alex_xu gmann: yea, we already have one case https://github.com/openstack/nova/blob/master/nova/api/validation/validators.py#L264, then probably add another one
10:57:48 gmann johnthetubaguy: i think string thing solved here as alex_xu mentioned we can validate against each item of list and 'format' works
10:58:06 gmann alex_xu: :) aboout to give that example
10:58:25 gmann alex_xu: i am +1 with new formatter.
10:58:32 alex_xu gmann: :)
10:58:56 gmann alex_xu: johnthetubaguy have to rush for train. ll see log later
10:59:34 alex_xu gmann: yea, I have to go home also, back later
11:02:36 openstackgerrit Zhenyu Zheng proposed openstack/nova: [poc] add a decorator to reject know bad filters. https://review.openstack.org/419256
11:20:22 openstackgerrit Zhenyu Zheng proposed openstack/nova: [poc] add a decorator to reject know bad filters. https://review.openstack.org/419256
11:21:02 openstackgerrit zhangyujun proposed openstack/nova: Update JSON Schema for flavor access https://review.openstack.org/418683
11:38:38 openstackgerrit Zhihai Song proposed openstack/nova: Update py35 functional tests blacklist https://review.openstack.org/415149
11:39:51 openstackgerrit Gábor Antal proposed openstack/nova: Transform instance.volume_attach notification https://review.openstack.org/401992
11:49:14 openstackgerrit Wang Qing wu proposed openstack/nova: WIP(4): Introduce base PowerVM driver (cfg drv) https://review.openstack.org/409404
11:57:46 openstackgerrit Zhenyu Zheng proposed openstack/nova: [poc] add a decorator to reject know bad filters. https://review.openstack.org/419256
11:59:48 openstackgerrit Zhihai Song proposed openstack/nova: Enable tests.functional.db.api.test_migrations for py35 https://review.openstack.org/419435
12:02:02 openstackgerrit Zhenyu Zheng proposed openstack/nova: [poc] add a decorator to reject know bad filters. https://review.openstack.org/419256
12:02:48 openstackgerrit Gábor Antal proposed openstack/nova: Transform instance.volume_attach notification https://review.openstack.org/401992
12:13:02 openstackgerrit Gábor Antal proposed openstack/nova: Transform instance.volume_detach notification https://review.openstack.org/408676
12:15:11 openstackgerrit Béla Vancsics proposed openstack/nova: Reduce code duplication https://review.openstack.org/270911
12:21:25 openstackgerrit Istvan Imre proposed openstack/python-novaclient: Pass relevant parameters to Token based authentication https://review.openstack.org/419441
12:24:17 openstackgerrit Zhihai Song proposed openstack/nova: Update py35 functional tests blacklist https://review.openstack.org/415149
12:31:42 dims mriedem : bauzas : the review for the py35 functional test blacklist is ready - https://review.openstack.org/#/c/419250/
12:42:30 openstackgerrit Chris Dent proposed openstack/nova: Small improvements to placement.rst https://review.openstack.org/403811
12:46:42 cdent mriedem, bauzas : can we get that merged or otherwise reviewed? Or if not, let me know so I can abandon it.
12:50:50 openstackgerrit Béla Vancsics proposed openstack/nova: Reduced the complexity of the _init_instance method https://review.openstack.org/374661
12:53:42 openstackgerrit John Garbutt proposed openstack/nova: Pass objects into _create_ports_for_instance https://review.openstack.org/418512
13:02:26 bauzas cdent: looking
13:02:38 cdent thanks
13:03:01 bauzas cdent: +2d

Earlier   Later