[Libvir] libvirt 0.1.8 Help

Daniel P. Berrange berrange at redhat.com
Wed Jun 27 13:48:32 UTC 2007


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  -=| 




More information about the libvir-list mailing list