Hello,
I just encountered a situation, where a KVM instance was reported as "no
state" in virsh. This broke some code of mine, which was
using "lookupByUUID()" to lookup several VMs. The Python code did raise a
libvirt.libvirtError('virDomainLookupByUUID() failed',), where all
get_error_*() functions return None. This is because the generated libvirt.py
wrapper just raises libvirtError('%s() failed'), which makes deteting the
exact fault harder. My current code explicitly checks for get_error_code() ==
VIR_ERR_NO_DOMAIN.
On further investigation I also noticed that qemudDomainLookupByUUID() uses
qemuReportError() to reports the error condition, which doesn't associate
that error condition with the connection.
What's the most appropriate way to fix this:
1. Assume lookupBy*() only will ever report an invalid lookup key and catch
all libvirtErrors?
2. Parse the exception string?
3. Extend the generator to add additional information from annotations?
4. Replace the generated code with hand-extended code.
Any ideas? Thanks for your input.
Sincerely
Philipp
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/