* xm, no such domain error code...
@ 2008-09-16 17:26 Shaun R.
2008-09-17 9:30 ` Ian Jackson
0 siblings, 1 reply; 3+ messages in thread
From: Shaun R. @ 2008-09-16 17:26 UTC (permalink / raw)
To: xen-devel
Right now xm will return 1 if you run `xm list non_existant_domain`
Wouldnt it be a better idea to have a specific error code for this error so
that scripts wrapping around xm can better determine if the domain does not
exist or if xm just failed for whatever reason?
~Shaun
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: xm, no such domain error code...
2008-09-16 17:26 xm, no such domain error code Shaun R.
@ 2008-09-17 9:30 ` Ian Jackson
2008-09-17 18:08 ` Shaun R.
0 siblings, 1 reply; 3+ messages in thread
From: Ian Jackson @ 2008-09-17 9:30 UTC (permalink / raw)
To: Shaun R.; +Cc: xen-devel
Shaun R. writes ("[Xen-devel] xm, no such domain error code..."):
> Right now xm will return 1 if you run `xm list non_existant_domain`
>
> Wouldnt it be a better idea to have a specific error code for this error so
> that scripts wrapping around xm can better determine if the domain does not
> exist or if xm just failed for whatever reason?
Yes. Probably the right thing is to keep 1 for general failure, since
it will be too hard to track down all of the places it is used. So we
should start new specific exit codes at 10 or 16 or something.
Would you care to prepare a suitable patch ? I haven't looked at the
code recently but perhaps you can transform the domain not found
exception into a specific exit code in a single place.
Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: xm, no such domain error code...
2008-09-17 9:30 ` Ian Jackson
@ 2008-09-17 18:08 ` Shaun R.
0 siblings, 0 replies; 3+ messages in thread
From: Shaun R. @ 2008-09-17 18:08 UTC (permalink / raw)
To: xen-devel
Not sure what happened to my reply, so here it is again, slightly modified.
I'll attempt to, I'm not too familiar with python.
>From what it looks like the exit code is actually already defined. If you
have a look at tools/python/xen/xend/XendClient.py you will find a macro
setup that sets ERROR_INVALID_DOMAIN to 3. This is also whats checked in
./tools/python/xen/xm/main.py
if ex.faultCode == XendClient.ERROR_INVALID_DOMAIN:
err("Domain '%s' does not exist." % ex.faultString)
else:
err(ex.faultString)
_usage(cmd_name)
The problem is that at the end of this function a generic "return False, 1"
is used... I think the easiest thing to do would be to just add a line after
thant err() function with "return False, ex.faultCode"
What do you think? I did this on my install and it worked perfect! 3 was
returned to $?
~Shaun Reitan
> Shaun R. writes ("[Xen-devel] xm, no such domain error code..."):
>> Right now xm will return 1 if you run `xm list non_existant_domain`
>>
>> Wouldnt it be a better idea to have a specific error code for this error
>> so
>> that scripts wrapping around xm can better determine if the domain does
>> not
>> exist or if xm just failed for whatever reason?
>
> Yes. Probably the right thing is to keep 1 for general failure, since
> it will be too hard to track down all of the places it is used. So we
> should start new specific exit codes at 10 or 16 or something.
>
> Would you care to prepare a suitable patch ? I haven't looked at the
> code recently but perhaps you can transform the domain not found
> exception into a specific exit code in a single place.
>
> Ian.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-17 18:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 17:26 xm, no such domain error code Shaun R.
2008-09-17 9:30 ` Ian Jackson
2008-09-17 18:08 ` Shaun R.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.