Michael Lim wrote:
> On 05/05/09 13:05, Peter Memishian wrote:
>>  > Erik and I were talking about having multiple -p
>>  > flags to our *adm commands, and Erik pointed out
>>  > that this may not be a good idea because it complicates
>>  > error-cases. e.g., if I do
>>  >  >   dladm set-linkprop -p p1=v1 -p badprop=badval -p p3=v3 link0
>>  >  > and "p1=v1" and "p3=v3" are syntactically correct,
>>  > what is the error code ($?) returned to the shell after your
>>  > fix for 6601421? And if $? is non-zero, are p1 and p3 set to v1 and 
>> v3?
>>  >  > Note that Girish and I tried this with zfs.. it would set as much
>>  > as it can, and also return an error code, which is confusing.
>>
>> Indeed.
>>   
> would it preferable to return p1 and p3 to the previous values,
> state which property couldn't be set and return an error?

Is there a case where restoring p1 and p3 might in fail?

The way to get sensible handling of failures is known as a scripting 
language. Thus if only one property can be set with each dladm 
invocation then the (shell or other) script knows the state and knows 
whether to bail out or ignore the error.

It seems hard to build that policy (whether to fail on first error or 
not; whether to restore; etc) into dladm.

    Erik



Reply via email to