Bug 744546 - python version of libvirt produce segfault when connect second time
Summary: python version of libvirt produce segfault when connect second time
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-09 10:18 UTC by koder
Modified: 2011-10-10 08:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-10 08:18:26 UTC


Attachments (Terms of Use)

Description koder 2011-10-09 10:18:58 UTC
Description of problem:

Python bindings of libvirt generate segfault, when connect to hypervisor second time.

Version-Release number of selected component (if applicable):

libvirt.getVersion() == 8008

How reproducible:

python -c "import libvirt; libvirt.virConnect('qemu:///session');libvirt.virConnect('qemu:///session')"

Steps to Reproduce:

python -c "import libvirt; libvirt.virConnect('qemu:///session');libvirt.virConnect('qemu:///session')"
  
Actual results:
segfault

Expected results:
no segfault :)

Additional info:

uname -a:
Linux koder-laptop 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

qemu --version:
QEMU emulator version 0.14.0 (qemu-kvm-0.14.0), Copyright (c) 2003-2008 Fabrice Bellard

dpkg -l | grep kvm:
kvm  1:84+dfsg-0ubuntu16+0.14.0+noroms+0ubuntu4.4 
qemu 0.14.0+noroms-0ubuntu4.4                     
qemu-kvm   0.14.0+noroms-0ubuntu4.4

dpkg -l | grep libvirt:
libsys-virt-perl 0.2.4-1
libvirt-bin 0.8.8-1ubuntu6.5
libvirt0 0.8.8-1ubuntu6.5
libvirtodbc0 6.1.2+dfsg1-1ubuntu4
python-libvirt 0.8.8-1ubuntu6.5

Comment 1 Daniel Berrangé 2011-10-10 08:18:26 UTC
The 'libvirt.virConnect' constructor is expecting a python wrapper object for the 'virConnectPtr' C object instance. You are instead passing it a python string, hence the SEGV when it tries to use what it thinks is a virConnectPtr C object.

If you want to connect to libvirt use

  conn = libvirt.open("qemu:///session")


Note You need to log in before you can comment on or make changes to this bug.