
I tried with the traceback. Here is the output: [('<stdin>', 3, '?', None), ('/usr/lib/python2.3/site-packages/libvirt.py', 268, 'lookupByID', "if ret is None:raise libvirtError('virDomainLookupByID() failed')")] [('<stdin>', 3, '?', None), ('/usr/lib/python2.3/site-packages/libvirt.py', 268, 'lookupByID', "if ret is None:raise libvirtError('virDomainLookupByID() failed')")] Thanks Omer On 6/27/07, Daniel P. Berrange <berrange@redhat.com> wrote:
On Wed, Jun 27, 2007 at 03:39:30PM +0200, Omer Khalid wrote:
Hi,
I have the following code working on libvirt 0.1.9:
######################################## conn = libvirt.openReadOnly(None) if conn == None: print 'Failed to open connection to the hypervisor' #sys.exit(1)
try: domains = conn.listDomainsID() num = conn.numOfDomains() except: print 'Failed to find the list of domains'
for i in range(num): try: dom0 = conn.lookupByID(domains[i]) domInfo = dom0.info() except: print "Unexpected error:", sys.exc_info()
##############################################
For legacy reason, I have to get it working on libvirt 0.1.8 but I am constantly getting the following error:
Unexpected error: (<class libvirt.libvirtError at 0xb7f49f2c>, < libvirt.libvirtError instance at 0xb7f4f2cc>, <traceback object at 0xb7f44c5c>)
Try adding an exception handler that prints out useful information rather than raw python object references for a start... Its impossible to debug this unless you get the text associated with the exception.
Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
-- ---------------------------------------------------------- CERN – European Organization for Nuclear Research, IT Department, CH-1211 Geneva 23, Switzerland Phone: +41 (0) 22 767 2224 Fax: +41 (0) 22 766 8683 E-mail : Omer.Khalid@cern.ch Homepage: http://cern.ch/Omer.Khalid