libvirt-python issueshttps://gitlab.com/libvirt/libvirt-python/-/issues2024-01-03T14:08:00Zhttps://gitlab.com/libvirt/libvirt-python/-/issues/20Can’t add callback to non-blocking virStream with libvirt-python when using q...2024-01-03T14:08:00ZAustin S. HemmelgarnCan’t add callback to non-blocking virStream with libvirt-python when using qemu:///session connection.When trying to invoke the `virStream.eventAddCallback()` method on a non-blocking stream attached to the console of a running domain on a `qemu:///session` URI, it raises a `libvirt.libvirtError` exception with the message `this function...When trying to invoke the `virStream.eventAddCallback()` method on a non-blocking stream attached to the console of a running domain on a `qemu:///session` URI, it raises a `libvirt.libvirtError` exception with the message `this function is not supported by the connection driver: virStreamEventAddCallback`.
This seems surprising given that connecting to the same domain console on the same URI with `virsh console` works correctly, and that appears to use `virStreamEventAddCallback` internally.
Not sure if it’s relevant, but I also get equivalent errors for `virStreamEventRemoveCallback` (this throwing an error makes sense, because there is no callback on the stream, but the error message seems wrong in context) and `virStreamFinish`.
Blocking streams still work correctly.
Underlying libvirt version is 9.9.0. libvirt-python version is 9.10.0.
I have not yet checked if this affects older versions, or if it affects any other connection drivers.https://gitlab.com/libvirt/libvirt-python/-/issues/19signal handling with remote connections2023-12-21T16:44:51ZMichael Ablassmeiersignal handling with remote connectionshi there,
while implementing signal handling function in one of my programs using python-libvirt, i noticed that
the signal seems to be passed to the underlying qemu+ssh session. As such, once the program receives
the signal (SIGINT, fo...hi there,
while implementing signal handling function in one of my programs using python-libvirt, i noticed that
the signal seems to be passed to the underlying qemu+ssh session. As such, once the program receives
the signal (SIGINT, for example) the remote ssh session drops and its not possible to use the connection
anymore.
Here is a short example program that shows the issue:
```
import signal
from functools import partial
from time import sleep
import libvirt
virtClient = libvirt.open("qemu+ssh://root@cefix/session")
def catchme(signum, frame):
"""catch signal and attempt to use connection,
this will fail with:
python3 test.py
Enter passphrase for key '/home/abi/.ssh/id_rsa':
foo
foo
^Clibvirt: XML-RPC error : Cannot recv data: : Connection reset by peer
Traceback (most recent call last):
File "/home/abi/test.py", line 18, in <module>
sleep(4)
File "/home/abi/test.py", line 11, in catchme
virtClient.lookupByName("test")
File "/usr/lib/python3/dist-packages/libvirt.py", line 4981, in lookupByName
raise libvirtError('virDomainLookupByName() failed')
libvirt.libvirtError: Cannot recv data: : Connection reset by peer
"""
virtClient.lookupByName("test")
signal.signal(signal.SIGINT, catchme)
while True:
print("wait for SIGINT")
sleep(4)
```
the only workaround i came up is to re-establish the connection in the signal handling function
to do any post-processing steps required.https://gitlab.com/libvirt/libvirt-python/-/issues/8messed up file name in the pool directory will cause a crash2021-07-12T14:02:29Zxiaocangxiaocang@ogura.iomessed up file name in the pool directory will cause a crashI found that if there is a messed up file name in the pool directory, it will cause libvirt to report an error, so I suggest throwing out the pool name and the messed up file in the error message for easy troubleshooting.
reproduction
-...I found that if there is a messed up file name in the pool directory, it will cause libvirt to report an error, so I suggest throwing out the pool name and the messed up file in the error message for easy troubleshooting.
reproduction
------------
``` bash
$ sudo virt-install -n "fed34" \
--os-type=Linux --os-variant="fedora-unknown" \
--memory="24576" --vcpus="64" \
--network network="kern-test" \
--import \
--disk path="fed34-min2.qcow2" \
--wait 0
'utf-8' codec can't decode byte 0x9a in position 2: invalid start byte
```
vol-list like this:
``` bash
virsh # vol-list --details test
Name Path Type Capacity Allocation
---------------------------------------------------------------------------------------------------------------------------
.bash_history /home/test/.bash_history file 18.66 KiB 20.00 KiB
.bash_logout /home/test/.bash_logout file 18.00 B 4.00 KiB
.bash_profile /home/test/.bash_profile dir 0.00 B 0.00 B
܀\xff[W /home/test/܀\xff[W unknown unknown unknown
```https://gitlab.com/libvirt/libvirt-python/-/issues/7Install libvirt-python on Windows hit error2021-07-12T09:18:27ZLili DengInstall libvirt-python on Windows hit errorI already install pkgconfig, but keep see below error, thoughts?
```
pip install libvirt-python
Collecting libvirt-python
Using cached libvirt-python-7.5.0.tar.gz (217 kB)
Building wheels for collected packages: libvirt-python
Build...I already install pkgconfig, but keep see below error, thoughts?
```
pip install libvirt-python
Collecting libvirt-python
Using cached libvirt-python-7.5.0.tar.gz (217 kB)
Building wheels for collected packages: libvirt-python
Building wheel for libvirt-python (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\lildeng\appdata\local\programs\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"'; __file__='"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\lildeng\AppData\Local\Temp\pip-wheel-o2_zx5ei'
cwd: C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\
Complete output (25 lines):
running bdist_wheel
running build
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 337, in <module>
setup(name = 'libvirt-python',
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 144, in run
check_minimum_libvirt_version()
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 44, in check_minimum_libvirt_version
spawn([get_pkgcfg(),
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 40, in get_pkgcfg
raise Exception("pkg-config binary is required to compile libvirt-python")
Exception: pkg-config binary is required to compile libvirt-python
----------------------------------------
ERROR: Failed building wheel for libvirt-python
Running setup.py clean for libvirt-python
Failed to build libvirt-python
Installing collected packages: libvirt-python
Running setup.py install for libvirt-python ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\lildeng\appdata\local\programs\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"'; __file__='"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lildeng\AppData\Local\Temp\pip-record-hge094jq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lildeng\appdata\local\programs\python\python38\Include\libvirt-python'
cwd: C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\
Complete output (27 lines):
running install
running build
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 337, in <module>
setup(name = 'libvirt-python',
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\lildeng\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 144, in run
check_minimum_libvirt_version()
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 44, in check_minimum_libvirt_version
spawn([get_pkgcfg(),
File "C:\Users\lildeng\AppData\Local\Temp\pip-install-mhbszjmq\libvirt-python_966bac790eb445abb3713bc3e010e2e0\setup.py", line 40, in get_pkgcfg
raise Exception("pkg-config binary is required to compile libvirt-python")
Exception: pkg-config binary is required to compile libvirt-python
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\lildeng\appdata\local\programs\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"'; __file__='"'"'C:\\Users\\lildeng\\AppData\\Local\\Temp\\pip-install-mhbszjmq\\libvirt-python_966bac790eb445abb3713bc3e010e2e0\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\lildeng\AppData\Local\Temp\pip-record-hge094jq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\lildeng\appdata\local\programs\python\python38\Include\libvirt-python' Check the logs for full command output.
```