The params are converted to lowercase, the problem is the processed params
are available only inside the dispatch chain, so later when the rest of the
method ApiDispatcher#dispatch tries to get the param, in the map where it
was looking up it was still with Camel Case name. I think the proper way to
do this is to include the rest of the ApiDispatcher#dispatch method in the
chain: another worker the receives the modified params (lowercase).


Actually this worker should call a Cmd method that would do one thing or
another depending on the Cmd type. This way we avoid having all this:

   if (cmd instanceof BaseAsyncCmd) {
....// 30 lines to be moved to BaseAsyncCmd
}

        if (cmd instanceof BaseAsyncCustomIdCmd) {
            ((BaseAsyncCustomIdCmd)cmd).checkUuid();
        } else if (cmd instanceof BaseCustomIdCmd) {
            ((BaseCustomIdCmd)cmd).checkUuid();
        }


And one last thing. At some point in these 30 lines, it returns if two ifs
are satisfied. I understand the return if meant to avoid calling
cmd.execute(); in the last line. Is that right? My concern is that the
return is also avoiding the code that calls  ...cmd).checkUuid() . Is this
correct? Shouldn't we checkUuid even if we are not going to execute?



Sorry for the problems and thanks for fixing it so fast.



By the way, how can I get rights to add this information to the Cloudstack
wiki? Just to explain the dispatching info and how the Dispatch Chain
works. I would also include some info about format of incoming parameters
(like Maps)

Thanks. Cheers
Antonio



2014-03-14 9:50 GMT+01:00 Antonio Fornié Casarrubios <
antonio.for...@gmail.com>:

> Sorry, I see what the problem is. I've been looking for other possible
> side effects. But this should only affect anything in ApiDispatcher after
> standardDispatchChain.dispatch(new DispatchTask(cmd, params));
> because the params used are not the same object processed in the
> dispatchChain. I'm going to change this properly, test it and upload it.
>
> Sorry again and thanks for the change.
>
> Antonio
>
>
> 2014-03-14 0:55 GMT+01:00 Min Chen <min.c...@citrix.com>:
>
> Fixed with commit d3fd66e9f555616530e483d1eacf2525556bf14e on master.
>>
>> Thanks
>> -min
>>
>> On 3/13/14 4:34 PM, "Min Chen" <min.c...@citrix.com> wrote:
>>
>> >Yes, that is problem. Parameter name is changed to lowercase, which will
>> >not be able to retrieve parameters from API job.
>> >
>> >Thanks
>> >-min
>> >
>> >On 3/13/14 4:31 PM, "Daan Hoogland" <daan.hoogl...@gmail.com> wrote:
>> >
>> >>It's half passed midnight here so you won't get an answer soon from
>> >>this side of the ocean.
>> >>
>> >>The line
>> >>at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:89)
>> >> is from juli last year. So I doubt if Antonio knows about it. How
>> >>does it involve the dispatcher refactoring?
>> >>
>> >>I noticed that the parameter name that is fetched is lowercase where
>> >>it used to be camelcase. Does this matter?
>> >>
>> >>On Fri, Mar 14, 2014 at 12:14 AM, Alena Prokharchyk
>> >><alena.prokharc...@citrix.com> wrote:
>> >>> Min is about to submit a change as a part of her checkin. Antonio, its
>> >>>due
>> >>> to Long/long auto boxing caused by your api validation stuff. Can you
>> >>> please check other places that could get potentially affected?
>> >>>
>> >>> Thanks,
>> >>> Alena.
>> >>>
>> >>> On 3/13/14, 4:10 PM, "Kelven Yang" <kelven.y...@citrix.com> wrote:
>> >>>
>> >>>>Anyone encounter this problem on master?
>> >>>>
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(163545706@qtp-538020828-6:ctx-afe77737 ctx-06c20804) Received
>> unknown
>> >>>>parameters for command listRegions. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-1342c426 ctx-07426dab) Received
>> unknown
>> >>>>parameters for command listZones. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-372e085d ctx-b4145c82) Received
>> unknown
>> >>>>parameters for command listPods. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-4debfd84 ctx-2bc17638) Received
>> unknown
>> >>>>parameters for command listClusters. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-d859137c ctx-796427ce) Received
>> unknown
>> >>>>parameters for command listHosts. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-28a609f4 ctx-928c994c) Received
>> unknown
>> >>>>parameters for command listStoragePools. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-2b402632 ctx-e9d04c3c) Received
>> unknown
>> >>>>parameters for command listImageStores. Unknown parameters : listall
>> >>>>type
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-b5b48d9b ctx-3fea144f) Received
>> unknown
>> >>>>parameters for command listSystemVms. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-77ae4d94 ctx-c39b828f) Received
>> unknown
>> >>>>parameters for command listHypervisors. Unknown parameters : listall
>> >>>>WARN  [c.c.a.d.ParamGenericValidationWorker]
>> >>>>(1770041501@qtp-538020828-3:ctx-8eb4acce ctx-f63fefa4) Received
>> unknown
>> >>>>parameters for command listDomains. Unknown parameters : viewall
>> >>>>INFO  [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-1:Job-3) Add
>> >>>>job-3
>> >>>>into job monitoring
>> >>>>ERROR [c.c.a.ApiAsyncJobDispatcher] (API-Job-Executor-1:Job-3)
>> >>>>Unexpected
>> >>>>exception while executing
>>
>> >>>>org.apache.cloudstack.api.command.admin.network.CreatePhysicalNetworkCm
>> >>>>d
>> >>>>java.lang.NumberFormatException: null
>> >>>>at java.lang.Long.parseLong(Long.java:404)
>> >>>>at java.lang.Long.valueOf(Long.java:540)
>> >>>>at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:89)
>> >>>>at
>>
>> >>>>com.cloud.api.ApiAsyncJobDispatcher.runJob(ApiAsyncJobDispatcher.java:1
>> >>>>0
>> >>>>0)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInCo
>> >>>>n
>> >>>>te
>> >>>>xt(AsyncJobManagerImpl.java:491)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(Mana
>> >>>>g
>> >>>>ed
>> >>>>ContextRunnable.java:49)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call
>> >>>>(
>> >>>>De
>> >>>>faultManagedContext.java:56)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWi
>> >>>>t
>> >>>>hC
>> >>>>ontext(DefaultManagedContext.java:103)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWit
>> >>>>h
>> >>>>Co
>> >>>>ntext(DefaultManagedContext.java:53)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.managed.context.ManagedContextRunnable.run(Manage
>> >>>>d
>> >>>>Co
>> >>>>ntextRunnable.java:46)
>> >>>>at
>>
>> >>>>org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(Asy
>> >>>>n
>> >>>>cJ
>> >>>>obManagerImpl.java:448)
>> >>>>at
>>
>> >>>>java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>> >>>>at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>> >>>>at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>> >>>>at
>>
>> >>>>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.ja
>> >>>>v
>> >>>>a:
>> >>>>1145)
>> >>>>at
>>
>> >>>>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.j
>> >>>>a
>> >>>>va
>> >>>>:615)
>> >>>>at java.lang.Thread.run(Thread.java:724)
>> >>>>INFO  [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-1:Job-3) Remove
>> >>>>job-3 from job monitoring
>> >>>>
>> >>>>Kelven
>> >>>
>> >>
>> >>
>> >>
>> >>--
>> >>Daan
>> >
>>
>>
>

Reply via email to