This changes the contract of the existing virDomainGetID call so that
it is guaranteed to return the ID provided that the @domain parameter
is not NULL or corrupted.
This should be compatible with all preceeding versions of libvirt,
since all they have ever done is to check the @domain parameter and
return the dom->id field.
However it might not be forwards compatible with future versions: At
the moment there is an odd distinction between the local and remote
case. In the local case, the dom->id field is set to -1 when the
domain goes (mostly anyhow, not always). In the remote case it is not
set, because this is not known.
In practice, this never really matters. All significant libvirt
callers grab a new virDomain object from the remote end each time,
thus getting an updated ID. virDomain objects seem to be individually
very short-lived.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
Read my OCaml programming blog:
http://camltastic.blogspot.com/
Fedora now supports 64 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora