GithubHelp home page GithubHelp logo

libvirt / libvirt Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 663.0 883.22 MB

Read-only mirror. Please submit merge requests / issues to https://gitlab.com/libvirt/libvirt

License: GNU Lesser General Public License v2.1

Emacs Lisp 0.01% Shell 0.72% Perl 0.46% Makefile 0.22% C 95.30% Augeas 0.07% Python 1.78% DTrace 0.02% RPC 0.01% Standard ML 0.02% Dockerfile 0.58% Meson 0.80% C++ 0.01%

libvirt's Introduction

GitLab CI Build Status

CII Best Practices

Translation status

Libvirt API for virtualization

Libvirt provides a portable, long term stable C API for managing the virtualization technologies provided by many operating systems. It includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.

For some of these hypervisors, it provides a stateful management daemon which runs on the virtualization host allowing access to the API both by non-privileged local users and remote users.

Layered packages provide bindings of the libvirt C API into other languages including Python, Perl, PHP, Go, Java, OCaml, as well as mappings into object systems such as GObject, CIM and SNMP.

Further information about the libvirt project can be found on the website:

https://libvirt.org

License

The libvirt C API is distributed under the terms of GNU Lesser General Public License, version 2.1 (or later). Some parts of the code that are not part of the C library may have the more restrictive GNU General Public License, version 2.0 (or later). See the files COPYING.LESSER and COPYING for full license terms & conditions.

Installation

Instructions on building and installing libvirt can be found on the website:

https://libvirt.org/compiling.html

Contributing

The libvirt project welcomes contributions in many ways. For most components the best way to contribute is to send patches to the primary development mailing list. Further guidance on this can be found on the website:

https://libvirt.org/contribute.html

Contact

The libvirt project has two primary mailing lists:

Further details on contacting the project are available on the website:

https://libvirt.org/contact.html

libvirt's People

Contributors

agx avatar andreabolognani avatar berrange avatar cbosdo avatar chenhanxiao avatar crobinso avatar danielhb avatar ebblake avatar elmarco avatar eskultety avatar fiuczy avatar iammattcoleman avatar janotomko avatar jfehlig avatar jferlan avatar jirkade avatar jonner avatar luyaohuang avatar markmc avatar nertpinx avatar novel avatar osier avatar photron avatar phrdina avatar pipo avatar qiankehan avatar rwmjones avatar stefanberger avatar veillard avatar zippy2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libvirt's Issues

Does libvirtd has strong ebtables dependency in yocto?

I had disabled ebtables in libvirt recipe in yocto as we are already enables iptables and enabling both getting clashed
And with ebtables disabled I started libvirt in host but its still dead, can someone please help

Below are few logs

libvirtd.service - Virtualization daemon Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled) Active: inactive (dead) since Tue 2022-03-15 23:23:14 UTC; 18min ago TriggeredBy: * libvirtd-admin.socket * libvirtd.socket * libvirtd-ro.socket Docs: man:libvirtd(8) https://libvirt.org Process: 423 ExecStart=/usr/sbin/libvirtd $LIBVIRTD_ARGS (code=exited, status=0/SUCCESS) Main PID: 425 (code=exited, status=0/SUCCESS)

532.658435] systemd[423]: libvirtd.service: Failed to connect stdout to the journal socket, ignoring: Connection refused [ 532.664903] audit: type=1400 audit(1647386594.294:325): avc: denied { read } for pid=423 comm="libvirtd" name="utmp" dev="tmpfs" ino=4029 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:initrc_var_run_0 [ 532.673371] audit: type=1400 audit(1647386594.302:326): avc: denied { execute } for pid=441 comm="libvirtd" name="daemon" dev="nvme0n1p2" ino=261 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:virt_et0 [ 532.674594] audit: type=1400 audit(1647386594.304:327): avc: denied { map } for pid=425 comm="libvirtd" path="/etc/passwd" dev="nvme0n1p2" ino=383 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t:0 [ 532.674641] audit: type=1400 audit(1647386594.304:328): avc: denied { map } for pid=425 comm="libvirtd" path="/etc/group" dev="nvme0n1p2" ino=19090 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t0 [ 532.674732] audit: type=1400 audit(1647386594.304:329): avc: denied { write } for pid=425 comm="libvirtd" name=".setrans-unix" dev="tmpfs" ino=18838 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:setr0 [ 532.674790] audit: type=1130 audit(1647386594.304:330): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=libvirtd comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 532.681362] audit: type=1400 audit(1647386594.310:331): avc: denied { execute } for pid=445 comm="libvirtd" name="daemon" dev="nvme0n1p2" ino=261 scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:virt_et0 [ 532.682942] systemd[1]: libvirtd.service: Succeeded.

libvirtd reports package received from server too large

libvirtd: 2022-12-07 07:05:31.013+0000: 28481: error : virNetMessageDecodeLength:150 : packet 218762502 bytes received from server too large, want 33554432 libvirtd: 2022-12-07 07:05:31.018+0000: 28481: error : virNetMessageDecodeLength:150 : packet 1195725852 bytes received from server too large, want 3355443 libvirtd: 2022-12-07 07:05:31.023+0000: 28481: error : virNetMessageDecodeLength:150 : packet 1330664517 bytes received from server too large, want 3355443 libvirtd: 2022-12-07 07:05:31.028+0000: 28481: error : virNetMessageDecodeLength:150 : packet 1330664517 bytes received from server too large, want 3355443 libvirtd: 2022-12-07 07:05:31.032+0000: 28481: error : virNetMessageDecodeLength:150 : packet -2147483612 bytes received from server too large, want 335544 libvirtd: 2022-12-07 07:05:36.039+0000: 28481: error : virNetSocketReadWire:1806 : End of file while reading data: Input/output error libvirtd: 2022-12-07 07:05:41.048+0000: 28481: error : virNetSocketReadWire:1806 : End of file while reading data: Input/output error libvirtd: 2022-12-07 07:05:41.050+0000: 28481: error : virNetMessageDecodeLength:150 : packet 1212501068 bytes received from server too large, want 3355443

libvirt version is 4.5.0
I have check the traffic flow and package , it was not large enough, i do not know what's happened

libvirtd start for error

logs

root@LAPTOP-LJCBFINI:/image/ubuntu# libvirtd
2022-02-24 09:02:29.814+0000: 12056: info : libvirt version: 6.0.0, package: 0ubuntu8.15 (Christian Ehrhardt <[email protected]> Thu, 18 Nov 2021 10:23:11 +0100)
2022-02-24 09:02:29.814+0000: 12056: info : hostname: LAPTOP-LJCBFINI
2022-02-24 09:02:29.814+0000: 12056: error : virNetlinkEventServiceStart:1040 : cannot add netlink membership: Invalid argument

Virtual machine log permissions

There is a need to collect logs of virtual machines in Elasticsearch, but the logs are created with 0600 privileges.

[pid 2898957] open("/var/log/libvirt/qemu/instance-00053eff.log", O_WRONLY|O_CREAT|O_APPEND, 0600) = 48
[pid 2898957] open("/var/log/libvirt/qemu/instance-00053eff.log", O_RDONLY) = 52

This is a problem, we collect logs not from the root user. I searched the section on flexible logging in qemu.conf, but I couldn't find it. I started looking for this in source codes (src/qemu/), but it is difficult for me. Tell me where in the code you can change the setting of the permissions to log files.

ninja build failing on rpc/rpc.c

the ninja -C build fails when trying to build

compilation terminated.
[18/326] Compiling C object src/rpc/libvirt_net_rpc_server.a.p/virnetdaemon.c.o
FAILED: src/rpc/libvirt_net_rpc_server.a.p/virnetdaemon.c.o
cc -Isrc/rpc/libvirt_net_rpc_server.a.p -Isrc/rpc -I../src/rpc -Isrc/util -I../src/util -Iinclude -I../include -Isrc -I../src -I. -I.. -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/libxml2 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O2 -g -fasynchronous-unwind-tables -fexceptions -fipa-pure-const -fno-common -Waddress -Waggressive-loop-optimizations -Walloc-size-larger-than=9223372036854775807 -Walloca -Warray-bounds=2 -Wattributes -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcast-align -Wcast-align=strict -Wno-cast-function-type -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeclaration-after-statement -Wdeprecated-declarations -Wdesignated-init -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-contains-nul -Wformat-extra-args -Wno-format-nonliteral -Wformat-overflow=2 -Wformat-security -Wno-format-truncation -Wformat-y2k -Wformat-zero-length -Wframe-address -Wframe-larger-than=4096 -Wfree-nonheap-object -Whsa -Wif-not-aligned -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-fallthrough=5 -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wmultistatement-macros -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnormalized=nfc -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverride-init -Wpacked-bitfield-compat -Wpacked-not-aligned -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wshift-overflow=2 -Wno-sign-compare -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wstringop-overflow=2 -Wstringop-truncation -Wsuggest-attribute=cold -Wno-suggest-attribute=const -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-suggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-enum -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-const-variable=2 -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -fstack-protector-strong -Wdouble-promotion -fPIC -pthread -DIN_LIBVIRT '-Dabs_top_builddir="/data/users/pdutt/tp2/libvirt/7.5.0/src/libvirt-7.5.0/build"' '-Dabs_top_srcdir="/data/users/pdutt/tp2/libvirt/7.5.0/src/libvirt-7.5.0"' -MD -MQ src/rpc/libvirt_net_rpc_server.a.p/virnetdaemon.c.o -MF src/rpc/libvirt_net_rpc_server.a.p/virnetdaemon.c.o.d -o src/rpc/libvirt_net_rpc_server.a.p/virnetdaemon.c.o -c ../src/rpc/virnetdaemon.c
In file included from ../src/rpc/virnetmessage.h:23,
from ../src/rpc/virnetserverprogram.h:24,
from ../src/rpc/virnetdaemon.h:28,
from ../src/rpc/virnetdaemon.c:26:
src/rpc/virnetprotocol.h:9:10: fatal error: rpc/rpc.h: No such file or directory
#include <rpc/rpc.h>

seems related to https://access.redhat.com/discussions/4780341

Windows Server 2016 VM totally freezes spontaneously during the day a couple of times for 1-5 minutes. There is no any logs in it during the freeze.

Hello, everybody.
Bare metal OS is Arch Linux.
Intel i9-11900K. RAM 64 GB.
libvirtd.
There is no way to connect to the VM, via spice on virt-manager as well. Seems like the VM is suspending.
Htop on the host during the time of the freeze shows 100% load of all eight cores dedicated to the VM.
Log files in /var/log/libvirt/qemu/ shows nothing, except logs of the start libvirt service (after host started).
Could anybody help me with a direction to dig?

What's the difference between host_tso and guest_tso

Libvirt could setting NIC driver-specific options.
I found two sub-elements under the element, such as:








I wonder what's the difference between and , I thought config effective for instance,
config effective for .... ?

libvirt 6.10.0 build error

Build type: native build

meson.build:429:27: ERROR: Expecting eol got id.
if host_machine.system() in [ 'linux', 'freebsd', 'windows' ]
^

virtqemud startup failure

log:
2023-02-10 06:41:01.751+0000: 24331: info : libvirt version: 8.6.0
2023-02-10 06:41:01.751+0000: 24331: info : hostname: node158
2023-02-10 06:41:01.751+0000: 24331: error : virPidFileAcquirePath:401 : Failed to acquire pid file '/var/run/libvirt/qemu/driver.pid': Resource temporarily unavailable
2023-02-10 06:41:01.752+0000: 24331: error : virStateInitialize:657 : Initialization of QEMU state driver failed: Failed to acquire pid file '/var/run/libvirt/qemu/driver.pid': Resource temporarily unavailable
2023-02-10 06:41:01.752+0000: 24331: error : daemonRunStateInit:610 : Driver state initialization failed

os: centos7.9
qemu: 7.1.0

monitor file descriptor leaks after destroy vm

Problem: monitor file descriptor leaks after destroy vm.
Libirt version: 7.2
Glib2 version: 2.56.0

The fd infos before create vm:
[root@localhost ~]# ss -ip|grep libvirt
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/lib/libvirt/qemu/domain-1-cloud_bm/monitor.sock 224856 * 224791
u_str ESTAB 0 0 * 223708 * 523924 users:(("libvirtd",pid=1719,fd=12))
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/run/libvirt/libvirt-sock 126462 * 125596

The fd infos after create vm:
[root@localhost ~]# ss -ip|grep libvirt
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/lib/libvirt/qemu/domain-1-cloud_bm/monitor.sock 224856 * 224791
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/lib/libvirt/qemu/domain-1-vm/monitor.sock 550709 * 550655 users:(("qemu-system-x86",pid=1771,fd=16))
u_str ESTAB 0 0 * 223708 * 523924 users:(("libvirtd",pid=1719,fd=12))
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/run/libvirt/libvirt-sock 126462 * 125596
u_str ESTAB 0 0 * 550655 * 550709 users:(("libvirtd",pid=1719,fd=20))

The fd info after deatroy vm:
[root@localhost ~]# ss -ip|grep libvirt
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/lib/libvirt/qemu/domain-1-cloud_bm/monitor.sock 224856 * 224791
u_str ESTAB 0 0 * 223708 * 523924 users:(("libvirtd",pid=1719,fd=12))
u_str ESTAB 0 0 /usr/share/jmnd/libvirt/var/run/libvirt/libvirt-sock 126462 * 125596
u_str ESTAB 202 0 * 550655 * 0 users:(("libvirtd",pid=1719,fd=20))

Then we can see the fd=20 remains.

Check the code and find that in qemuMonitorClose process mon->watch will be delayed to release using one idle source attached to monitor context which references to the vm eventThread context .
However the following qemuDomainObjStopWorker will remove eventThread context which may cause upper delayed funcation can't get chance to be executed.

Pls help to take a look, if I miss something, or it's indeed a bug?

thanks

void qemuProcessStop(...)
{
...
if (priv->mon) {
qemuMonitorClose(priv->mon); // Will call the qemuMonitorUnregister process.
priv->mon = NULL;
}
...
qemuDomainObjStopWorker(vm);
...
}

void
qemuMonitorUnregister(qemuMonitorPtr mon)
{
if (mon->watch) {
g_source_destroy(mon->watch);
vir_g_source_unref(mon->watch, mon->context);
mon->watch = NULL;
}
}

void vir_g_source_unref(GSource *src, GMainContext *ctx)
{
GSource *idle = g_idle_source_new();

g_source_set_callback(idle, virEventGLibSourceUnrefIdle, src, NULL);

g_source_attach(idle, ctx);

g_source_unref(idle);

}

Unable to delete a snapshot of images stored in a pool?

Dear libvirt team,

Hope you are doing well. We are trying to delete a snapshot and unable to do it.

Error is

virsh # snapshot-delete --domain Puppet_Server --snapshotname Puppet_Init_Foreman_Installed
error: Failed to delete snapshot Puppet_Init_Foreman_Installed
error: Requested operation is not valid: can't manipulate inactive snapshots of disk 'vda'

There are currently two snapshots

virsh # snapshot-list --domain Puppet_Server
 Name                            Creation Time               State
----------------------------------------------------------------------
 1675102515                      2023-01-30 18:15:15 +0000   shutoff
 Puppet_Init_Foreman_Installed   2021-12-22 02:07:19 +0000   shutoff

Google does not help a lot. However, came across this post which says Don't try to manipulate snapshots on network or unresolved volume backed storage.

with the commit

+        if (!virStorageSourceIsLocalStorage(def->disks[i]->src)) {
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           _("can't manipulate inactive snapshots of disk '%s'"),
+                           def->disks[i]->dst);
+            return -1;
+        }

Now, the image for the Domain (Puppet_Server) is on the local machine under a pool named vm_image

  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='vm_image' volume='Puppet_Server.image'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/vm_image/commoninit_Puppet_Server.iso'/>
      <target dev='hdd' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' target='0' unit='1'/>
    </disk>

Pool-dumpxml

virsh # pool-dumpxml --pool vm_image
<pool type='dir'>
  <name>vm_image</name>
  <uuid>5ec3b024-ff59-4c7e-a596-f1ee66b57bb6</uuid>
  <capacity unit='bytes'>939456974848</capacity>
  <allocation unit='bytes'>491372605440</allocation>
  <available unit='bytes'>448084369408</available>
  <source>
  </source>
  <target>
    <path>/var/lib/libvirt/images/vm_image</path>
    <permissions>
      <mode>0755</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

Is there a way to delete the snapshot using virsh? We tried deleting them using

qemu-img snapshot -d Puppet_Init_Foreman_Installed Puppet_Server.image

which deleted the snapshot but it still shows in virsh and we are unable to delete the Virtual machine.

Thank you for your support.

can't create virtual networks (pihole dnsmasq version parsing problem)

Could not start virtual network 'default': internal error: cannot parse /usr/bin/dnsmasq version number in 'Dnsmasq version pi-hole-2.81  Copyright (c) 2000-2020 Simon Kelley'

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/device/netlist.py", line 203, in _check_network_is_running
    netobj.start()
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/network.py", line 69, in start
    self._backend.create()
  File "/usr/lib/python3.8/site-packages/libvirt.py", line 3174, in create
    if ret == -1: raise libvirtError ('virNetworkCreate() failed', net=self)
libvirt.libvirtError: internal error: cannot parse /usr/bin/dnsmasq version number in 'Dnsmasq version pi-hole-2.81  Copyright (c) 2000-2020 Simon Kelley'

Libvirt doesn't support VirtualBox API version 7000004

dic 30 07:13:57 mst systemd[1]: Starting Virtualization daemon...
dic 30 16:09:50 mst libvirtd[3688]: libvirt version: 8.0.0, package: 1ubuntu7.3 (Christian Ehrhardt <[email protected]> Tue, 04 Oct 20>
dic 30 16:09:50 mst libvirtd[3688]: Libvirt doesn't support VirtualBox API version 7000004

Virtualbox 7.0.4 r154605 (Qt5.15.3)
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.6)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers

Can you fix it? Thanks

How to use virsh-commands without sudo

Hi altogether,

I used to run Lubuntu 18.04.5 (bionic) but now - after a fresh install - I am using Lubuntu 20.04.1 (focal).

I noticed a difference between those distro versions as far as virsh-commands are concerned:

With bionic I could use the command virsh list --all and it listed the available VMs alright. Now with focal I get an empty list.
sudo virsh list --all works as desired and lists the VMs.

Doing a bit of research I found on https://serverfault.com/questions/803283/how-do-i-list-virsh-networks-without-sudo :

If virsh finds the environment variable VIRSH_DEFAULT_CONNECT_URI set, it will try this URI by default. Use of this environment variable is, however, deprecated now that libvirt supports LIBVIRT_DEFAULT_URI itself.

On my system it seems none of those variables are set.

One of the possible solutions was:

it's easier to specify the connection string directly in virsh command (at least when writing a script).

This I tried and typed the following in my terminal:

rosika@rosika-10159 ~> LIBVIRT_DEFAULT_URI=qemu:///system virsh list --all
 Id   Name          State
------------------------------
 -    ubuntu18.04   shut off

rosika@rosika-10159 ~> LIBVIRT_DEFAULT_URI=qemu:///system virsh start ubuntu18.04
Domain ubuntu18.04 started

rosika@rosika-10159 ~> LIBVIRT_DEFAULT_URI=qemu:///system virsh list --all
 Id   Name          State
-----------------------------
 9    ubuntu18.04   running

rosika@rosika-10159 ~> LIBVIRT_DEFAULT_URI=qemu:///system virsh shutdown ubuntu18.04
Domain ubuntu18.04 is being shutdown

rosika@rosika-10159 ~> LIBVIRT_DEFAULT_URI=qemu:///system virsh list --all
 Id   Name          State
------------------------------
 -    ubuntu18.04   shut off

This way it works without sudo which is great.

I also noticed that setting the environment variable VIRSH_DEFAULT_CONNECT_URI=qemu:///system instead of LIBVIRT_DEFAULT_URI=qemu:///system still works.

As I´m using fish as my default shell it´s easy to retrieve the respective commands from fish_history. No need to memorize it or edit /etc/libvirt/libvirt.conf for that matter. So this would be a good solution for me.

My question is:

Is my method of doing it right? All I want to achieve is using virsh-commands without sudo.

Many thanks in advance.
Greetings from Rosika

Add meson options for commands to specify its path

Hi experts,

I found the meson options don't have the function that specify the commands' path which libvirt requires. How about I submit a patch like blow? If that's ok, I will start a pull request. Thanks!

`
diff --git a/meson.build b/meson.build
index 369548f127..6c93be8e4b 100644
--- a/meson.build
+++ b/meson.build
@@ -943,18 +943,24 @@ optional_programs = [
'udevadm',
]

+# if -Dxxx-path option is found, use that. Otherwise, check in $PATH,
+# /usr/sbin, /sbin, and fall back to the default from middle column.
foreach name : optional_programs

  • prog = find_program(name, required: false, dirs: libvirt_sbin_path)
    varname = name.underscorify()
  • if prog.found()
  • prog_path = prog.path()
  • prog_path = get_option(name + '-path')
  • if prog_path != ''
  • message('Using @1@ for @0@'.format(name, prog_path))
    else
  • prog_path = name
  • prog = find_program(name, required: false, dirs: libvirt_sbin_path)
  • if prog.found()
  •  prog_path = prog.path()
    
  • else
  •  prog_path = name
    
  • endif
  • set_variable('@0@_prog'.format(varname), prog)
    endif
  • conf.set_quoted(varname.to_upper(), prog_path)
    conf.set_quoted('@0@_PATH'.format(varname.to_upper()), prog_path)
  • set_variable('@0@_prog'.format(varname), prog)
    endforeach

diff --git a/meson_options.txt b/meson_options.txt
index e5d79c2b6b..f06f46c7bb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -102,3 +102,26 @@ option('numad', type: 'feature', value: 'auto', description: 'use numad to manag
option('pm_utils', type: 'feature', value: 'auto', description: 'use pm-utils for power management')
option('sysctl_config', type: 'feature', value: 'auto', description: 'Whether to install sysctl configs')
option('tls_priority', type: 'string', value: 'NORMAL', description: 'set the default TLS session priority string')
+
+
+option('addr2line-path', type : 'string', description : 'path to addr2line')
+option('augparse-path', type : 'string', description : 'path to augparse')
+option('dmidecode-path', type : 'string', description : 'path to dmidecode')
+option('dnsmasq-path', type : 'string', description : 'path to dnsmasq')
+option('ebtables-path', type : 'string', description : 'path to ebtables')
+option('flake8-path', type : 'string', description : 'path to flake8')
+option('ip-path', type : 'string', description : 'path to ip')
+option('ip6tables-path', type : 'string', description : 'path to ip6tables')
+option('iptables-path', type : 'string', description : 'path to iptables')
+option('iscsiadm-path', type : 'string', description : 'path to iscsiadm')
+option('mdevctl-path', type : 'string', description : 'path to mdevctl')
+option('mm-ctl-path', type : 'string', description : 'path to mm-ctl')
+option('modprobe-path', type : 'string', description : 'path to modprobe')
+option('ovs-vsctl-path', type : 'string', description : 'path to ovs-vsctl')
+option('pdwtags-path', type : 'string', description : 'path to pdwtags')
+option('radvd-path', type : 'string', description : 'path to radvd')
+option('rmmod-path', type : 'string', description : 'path to rmmod')
+option('scrub-path', type : 'string', description : 'path to scrub')
+option('tc-path', type : 'string', description : 'path to tc')
+option('udevadm-path', type : 'string', description : 'path to udevadm')
`

Change virsh backup-begin location

I have been looking all over the documentation and I can't seem to find a flag to set the location.
The default backup location, same directory as the qcow2 being backed up, is far from ideal.

ChatGPT suggested --target but this doesn't work.

Is there a way to set the backup location or can this feature request be added?

qemu+ssh:// connection has (somewhat) malformed sh invocation

https://github.com/libvirt/libvirt/blob/master/src/rpc/virnetclient.c 417 virNetClientSSHHelperCommand

Expands to

sh -c 'set -x; which virt-ssh-helper 1>/dev/null 2>&1; if test $? = 0; then     virt-ssh-helper qemu:///system; else    if 'nc' -q 2>&1 | grep "requires an
 argument" >/dev/null 2>&1; then ARG=-q0;else ARG=;fi;'nc' $ARG -U /var/run/libvirt/libvirt-sock; fi'

Which makes nc a non-safe path (conversely to the source code name), and also as a minor annoyance breaks under xonsh (which is why I saw this).

Problems with domain libvirt. Help me!!

Forgive my ignorance, I am a beginner in using libvirt, my question is:

libvirt manages VM with domain, but, when I am testing in a virtual machine that is running, and when I write the command virsh list --all, it sends me the virtual machines, but, if I write the command vmifs myserver 3 / mnt, it sends me the error that I must specify a domain or, I must write another name, and I have tried it and it sends me the same error, I have also tried with the command virt-ls -R -d guest /, and it sends me an error in the name of the domain.

Could you help me with how I can specify a domain in libvirt? I know that the domains are handled in XML format, but, while doing tests, nothing happens, and it keeps sending me the error. I put an xml that I did but, it does not recognize the domain, The command that I execute to start the VM is with QEMU.

default 5caf68c5-5b37-416b-9c9f-442ff5b11508 <title> Try this to see if it creates a domain </title> Something understandable for humans

I hope you can help me as I need help in this problem
Thank you!!!

why migration successfully aborted

hello all. | run 500 vm live migrate at one time on a 6 nodes environment, 12 vm live migrate is failed, the destination libvirt log show that it aborted migration and kill the vm at destination, why libvirt auto abort the live migration?

how to configure virsh capabilities output

I have two physical host,os system、system kernel、qemu rpm version、libvirt rpm version are the same,the CPU Model and CPU Flags of lscpu command output are the same too。
But the cpu feature of ”virsh capabilities“ output are slight differences,I confuse is there any configure could determine the cpu feature of "virsh capabilities"

please add alternative to firewalld

The issue.

There are operating systems that do not depend on D-Bus such as OpenBSD and derivatives, and in gnu/linux we have Hyperbola.

Would you be so kind to provide a compiler alternative to firewalld, for example by adding iproute as an alternative or something else that doesn't depend of D-Bus.

Regards. 😄

virsh error

os:Debian Gnu/Linux 11
libivrt:
ii libvirt-daemon 7.0.0-3 amd64 Virtualization daemon
ii libvirt-daemon-config-network 7.0.0-3 all Libvirt daemon configuration files (default network)
ii libvirt-daemon-config-nwfilter 7.0.0-3 all Libvirt daemon configuration files (default network filt>
ii libvirt-daemon-driver-lxc 7.0.0-3 amd64 Virtualization daemon LXC connection driver
ii libvirt-daemon-driver-qemu 7.0.0-3 amd64 Virtualization daemon QEMU connection driver
ii libvirt-daemon-driver-storage-gluster 7.0.0-3 amd64 Virtualization daemon glusterfs storage driver
ii libvirt-daemon-driver-storage-iscsi-direct 7.0.0-3 amd64 Virtualization daemon iSCSI (libiscsi) storage driver
ii libvirt-daemon-driver-storage-rbd 7.0.0-3 amd64 Virtualization daemon RBD storage driver
ii libvirt-daemon-driver-storage-zfs 7.0.0-3 amd64 Virtualization daemon ZFS storage driver
ii libvirt-daemon-driver-vbox 7.0.0-3 amd64 Virtualization daemon VirtualBox connection driver
ii libvirt-daemon-driver-xen 7.0.0-3 amd64 Virtualization daemon Xen connection driver
ii libvirt-daemon-system 7.0.0-3 amd64 Libvirt daemon configuration files
ii libvirt-daemon-system-systemd 7.0.0-3 all Libvirt daemon configuration files (systemd)
rc libvirt-daemon-system-sysv 7.0.0-3 all Libvirt daemon configuration files (sysv)
error:
18:42:16[root@localhost ~]# virsh --version
7.0.0
18:42:22[root@localhost ~]# virsh net-list --all
Name State Autostart Persistent

default inactive no yes
NatTo_wlp2s0 inactive no yes
NatToenp3s0 inactive no yes
publicnetwork inactive no yes
publicnetworkenp inactive no yes

18:42:34[root@localhost ~]# virsh net-start NatTo_wlp2s0
error: Failed to start network NatTo_wlp2s0
error: 内部错误:Failed to apply firewall rules /usr/sbin/iptables -w --table filter --list-rules: iptables v1.8.7 (nf_tables): table `filter' is incompatible, use 'nft' tool.
help me!!!! tanks!!!

Could not start virtual network 'default': Unable to find 'dnsmasq' binary in $PATH: No such file or directory

Problem

After defining virtual network through the command sudo virsh net-define $HOME/..../libvirt/etc/qemu/networks/default.xml, I then attempt to start the said network through the command sudo virsh net-start default. I get the following error "Could not start virtual network 'default': Unable to find 'dnsmasq' binary in $PATH: No such file or directory". This is an odd error as running which dnsmasq returns me the path of the program which, after verification, has its parent directory indeed being on my $PATH environment variable.

Traceback

Could not start virtual network 'default': Unable to find 'dnsmasq' binary in $PATH: No such file or directory

Traceback (most recent call last):
  File "/gnu/store/jvrzzf4bqc222b52nsc73wn21kr937qg-virt-manager-3.2.0/share/virt-manager/virtManager/device/netlist.py", line 203, in _check_network_is_running
    netobj.start()
  File "/gnu/store/jvrzzf4bqc222b52nsc73wn21kr937qg-virt-manager-3.2.0/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
    ret = fn(self, *args, **kwargs)
  File "/gnu/store/jvrzzf4bqc222b52nsc73wn21kr937qg-virt-manager-3.2.0/share/virt-manager/virtManager/object/network.py", line 69, in start
    self._backend.create()
  File "/gnu/store/ihpqsf1wk4l1ya6y63ram5hm39bxjqnr-python-libvirt-8.6.0/lib/python3.9/site-packages/libvirt.py", line 3508, in create
    raise libvirtError('virNetworkCreate() failed')
libvirt.libvirtError: Unable to find 'dnsmasq' binary in $PATH: No such file or directory

Operating System

GNU/Linux with GNU Guix distro

Other information

Running virsh --version outputs the version being 8.6.0

This is my first time opening an issue, and so if there's anything I am missing, or any additional information I should provide, or anything I misunderstood about the error output, feel free to correct me and let me know about it. Thank you.

libvirt adding 5 minutes to kernel load time

After I installed libvirt I got this message:

I: The initramfs will attempt to resume from /dev/sda2
I: (UUID=e80aefd7-f1c8-4dfe-b087-c57a23595291)
I: Set the RESUME variable to override this.

I was getting long boot times so I did this:

echo "RESUME=UUID=e80aefd7-f1c8-4dfe-b087-c57a23595291" | sudo tee /etc/initramfs-tools/conf.d/resume
sudo update-initramfs -u -k all
Then rebooted, I still get the long load time, this is the breakdown from systemd-analyze critical-chain:

graphical.target @5min 23.820s
└─multi-user.target @5min 23.820s
  └─libvirt-guests.service @5min 16.882s +9ms
    └─libvirtd.service @5min 14.796s +2.085s
      └─network.target @5min 14.775s
        └─NetworkManager.service @14.542s +2.761s
          └─dbus.service @14.521s
            └─basic.target @14.521s
              └─sockets.target @14.521s
                └─snapd.socket @14.520s +732us
                  └─sysinit.target @14.512s
                    └─apparmor.service @13.676s +836ms
                      └─local-fs.target @13.675s
                        └─run-user-121.mount @5min 16.094s
                          └─swap.target @13.434s
                            └─dev-disk-by\x2duuid-e80aefd7\x2df1c8\x2d4dfe\x2db087\x2dc57a
                              └─dev-disk-by\x2duuid-e80aefd7\x2df1c8\x2d4dfe\x2db087\x2dc5

Is there a way around it or is this just normal?

virtlogd.socket: references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlogd-sock → /run/libvirt$

Hi, experts
When I boot libvirt with systemd, there are many complains coming out, which are about path that use /run better than /var/run.
It might has been around for a long time, and will it be fix ?

005: systemd[1]: Set hostname to <intel-x86-64>. 006: systemd[1]: Initializing machine ID from random generator. 007: systemd[1]: /lib/systemd/system/virtlogd.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlogd-sock → /run/libvirt$ virtlogd-sock; please update the unit file accordingly. 007: systemd[1]: /lib/systemd/system/virtlogd-admin.socket:8: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlogd-admin-sock → $ run/libvirt/virtlogd-admin-sock; please update the unit file accordingly. 007: systemd[1]: /lib/systemd/system/virtlockd.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlockd-sock → /run/libvi$ t/virtlockd-sock; please update the unit file accordingly. 007: systemd[1]: /lib/systemd/system/virtlockd-admin.socket:8: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/virtlockd-admin-sock $ /run/libvirt/virtlockd-admin-sock; please update the unit file accordingly. 000: systemd[1]: /lib/systemd/system/libvirtd.socket:9: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/libvirt-sock → /run/libvirt/$ ibvirt-sock; please update the unit file accordingly. 000: systemd[1]: /lib/systemd/system/libvirtd-ro.socket:11: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/libvirt-sock-ro → /run/l$ bvirt/libvirt-sock-ro; please update the unit file accordingly. 000: systemd[1]: /lib/systemd/system/docker.socket:6: ListenStream= references a path below legacy directory /var/run/, updating /var/run/docker.sock → /run/docker.sock; please update the unit file accordingly. 002: systemd[1]: /lib/systemd/system/var-volatile-lib.service:13: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and $ onsider removing the setting altogether. 003: systemd[1]: /lib/systemd/system/var-volatile-srv.service:13: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and $ onsider removing the setting altogether. 003: systemd[1]: /lib/systemd/system/var-volatile-spool.service:13: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, an$ consider removing the setting altogether. 003: systemd[1]: /lib/systemd/system/var-volatile-cache.service:13: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, an$ consider removing the setting altogether. 002: systemd[1]: /lib/systemd/system/ovs-vswitchd.service:12: PIDFile= references a path below legacy directory /var/run/, updating /var/run/openvswitch/ovs-vswitchd.pid → /run$ openvswitch/ovs-vswitchd.pid; please update the unit file accordingly. 002: systemd[1]: /lib/systemd/system/ovsdb-server.service:10: PIDFile= references a path below legacy directory /var/run/, updating /var/run/openvswitch/ovsdb-server.pid → /run$ openvswitch/ovsdb-server.pid; please update the unit file accordingly. 003: systemd[1]: /lib/systemd/system/nfs-server.service:20: Standard output type syslog is obsolete, automatically updating to journal. Please update your unit file, and consid$ r removing the setting altogether. 003: systemd[1]: /lib/systemd/system/nagios-nsca.service:8: PIDFile= references a path below legacy directory /var/run/, updating /var/run/nsca.pid → /run/nsca.pid; please upda$ e the unit file accordingly. 003: systemd[1]: /lib/systemd/system/nagios-core.service:9: PIDFile= references a path below legacy directory /var/run/, updating /var/run/nagios/nagios.pid → /run/nagios/nagio$ .pid; please update the unit file accordingly. 003: systemd[1]: /lib/systemd/system/libvirtd.service:28: PIDFile= references a path below legacy directory /var/run/, updating /var/run/libvirtd.pid → /run/libvirtd.pid; pleas$ update the unit file accordingly. 003: systemd[1]: /lib/systemd/system/libvirtd-admin.socket:11: ListenStream= references a path below legacy directory /var/run/, updating /var/run/libvirt/libvirt-admin-sock → $ run/libvirt/libvirt-admin-sock; please update the unit file accordingly. 004: random: crng init done

Regards,
Yanfei

important bug: network interface is working whet is set up to be down

hello

that's my xml settings for network interface

link state is down, so this interface should not be running.

but if I start the vm it starts and working.

if I change setting at runtime all works as expected.

if I disable corresponding virtual network (default in this example) vm refuses to start when it should start anyway because interface is disabled therefore virtual network is not needed indeed.

archlinux, virtmanager 8.1.0

How do I start libvirtd in WSL2

I tried to start libvirt in WSL2 for libvirt development and testing, but I couldn't start libvirtd correctly.My computer already supports kvm, qemu, etc

root@ccfuncy ~
base ❯ dmesg | grep kvm
[    0.251483] kvm: already loaded the other module

root@ccfuncy ~
base ❯ grep -cw vmx /proc/cpuinfo
16

root@ccfuncy ~
base ❯ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

qemu ok

root@ccfuncy ~
base ❯ qemu-system-i386

but

root@ccfuncy ~
base ❯ libvirtd
2023-03-18 13:13:16.054+0000: 1926: info : libvirt version: 6.0.0, package: 0ubuntu8.16 (Marc Deslauriers <[email protected]> Wed, 20 Apr 2022 11:31:12 -0400)
2023-03-18 13:13:16.054+0000: 1926: info : hostname: ccfuncy
2023-03-18 13:13:16.054+0000: 1926: error : virPidFileAcquirePath:367 : Failed to acquire pid file '/run/libvirt/network/driver.pid': Resource temporarily unavailable
2023-03-18 13:13:16.054+0000: 1926: error : virStateInitialize:640 : Initialization of bridge state driver failed: Failed to acquire pid file '/run/libvirt/network/driver.pid': Resource temporarily unavailable
2023-03-18 13:13:16.054+0000: 1926: error : daemonRunStateInit:839 : Driver state initialization failed

How do I send a mouse event from a host to a guest?

Hello dear programmers!
My host Kubuntu20.04 KVM Guest Windows8.1
I can send a keyboard press from the host to the guest for example with this command:

virsh send-key GuestVM --codeset linux --holdtime 100 KEY_SPACE
virsh send-key GuestVM --codeset usb --holdtime 100 0x2c
virsh send-key GuestVM --codeset win32 --holdtime 100 0x2c

How do I send a mouse click, scroll and move?

I don’t understand why it doesn’t work? virsh send-key GuestVM --codeset win32 --holdtime 100 0x01

Can you implement this idea? Send mouse events to the guest via virsh like "virsh send-key".
maybe give a name "send-mouse" "send-mouse-key" "send-mouse-move" "send-mouse-scroll"

linux process table corrupts when starting a vm with pci pass-through

VM:

  <name>win10</name>
  <uuid>19286aa2-1562-4c56-869e-a53fc03e4444</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/10"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit="KiB">8388608</memory>
  <currentMemory unit="KiB">8388608</currentMemory>
  <vcpu placement="static">8</vcpu>
  <os firmware="efi">
    <type arch="x86_64" machine="pc-q35-7.1">hvm</type>
    <bootmenu enable="yes"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv mode="custom">
      <relaxed state="on"/>
      <vapic state="on"/>
      <spinlocks state="on" retries="8191"/>
    </hyperv>
    <vmport state="off"/>
  </features>
  <cpu mode="host-passthrough" check="none" migratable="on"/>
  <clock offset="localtime">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
    <timer name="hypervclock" present="yes"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
      <source dev="/dev/sda"/>
      <target dev="sda" bus="sata"/>
      <boot order="1"/>
      <address type="drive" controller="0" bus="0" target="0" unit="0"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw"/>
      <source file="/home/radiant/Downloads/Win10_22H2_English_x64.iso"/>
      <target dev="sdb" bus="sata"/>
      <readonly/>
      <address type="drive" controller="0" bus="0" target="0" unit="1"/>
    </disk>
    <controller type="usb" index="0" model="qemu-xhci" ports="15">
      <address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
    </controller>
    <controller type="pci" index="0" model="pcie-root"/>
    <controller type="pci" index="1" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="1" port="0x10"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="2" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="2" port="0x11"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
    </controller>
    <controller type="pci" index="3" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="3" port="0x12"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
    </controller>
    <controller type="pci" index="4" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="4" port="0x13"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
    </controller>
    <controller type="pci" index="5" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="5" port="0x14"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
    </controller>
    <controller type="pci" index="6" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="6" port="0x15"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
    </controller>
    <controller type="pci" index="7" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="7" port="0x16"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x6"/>
    </controller>
    <controller type="pci" index="8" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="8" port="0x17"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x7"/>
    </controller>
    <controller type="pci" index="9" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="9" port="0x18"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0" multifunction="on"/>
    </controller>
    <controller type="pci" index="10" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="10" port="0x19"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x1"/>
    </controller>
    <controller type="pci" index="11" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="11" port="0x1a"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x2"/>
    </controller>
    <controller type="pci" index="12" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="12" port="0x1b"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x3"/>
    </controller>
    <controller type="pci" index="13" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="13" port="0x1c"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x4"/>
    </controller>
    <controller type="pci" index="14" model="pcie-root-port">
      <model name="pcie-root-port"/>
      <target chassis="14" port="0x1d"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x5"/>
    </controller>
    <controller type="sata" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
    </controller>
    <controller type="virtio-serial" index="0">
      <address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
    </controller>
    <serial type="pty">
      <target type="isa-serial" port="0">
        <model name="isa-serial"/>
      </target>
    </serial>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
      <address type="virtio-serial" controller="0" bus="0" port="1"/>
    </channel>
    <input type="tablet" bus="usb">
      <address type="usb" bus="0" port="1"/>
    </input>
    <input type="mouse" bus="ps2"/>
    <input type="keyboard" bus="ps2"/>
    <graphics type="spice" autoport="yes">
      <listen type="address"/>
      <image compression="off"/>
    </graphics>
    <sound model="ich9">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
    </sound>
    <audio id="1" type="spice"/>
    <video>
      <model type="qxl" ram="65536" vram="65536" vgamem="16384" heads="1" primary="yes"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x0"/>
    </video>
    <hostdev mode="subsystem" type="pci" managed="yes">
      <source>
        <address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
      </source>
      <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
    </hostdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="2"/>
    </redirdev>
    <redirdev bus="usb" type="spicevmc">
      <address type="usb" bus="0" port="3"/>
    </redirdev>
    <memballoon model="virtio">
      <address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
    </memballoon>
  </devices>
</domain>```
neofetch:
![image](https://user-images.githubusercontent.com/69520693/209572172-ac6062e7-9192-4bdb-9732-b6d3e0e7c69d.png)
version:
![image](https://user-images.githubusercontent.com/69520693/209572296-d26bbf1d-96ce-4787-ac52-0b1af5f77ab9.png)

detailed symptoms after starting:
libvirt completely freezes (even SIGKILL doesnt remove it), using 12% cpu while some processes say its a zombie while it is not, shutting down from systemd did not solve the issue, as it says it is waiting for process to close, also it stops sysrq from acting (rebooting / powering off)

nc: unix connect failed

Hi, im running since a few hours into the following issue:

client: MacOS Big Sur: Python3 + python-libvirt / virsh also installed

if im trying to connect to a remote hypervisor i get the following error message

virsh -c qemu+ssh://root@Public_IP/system list --all

libvirtd is listening, i have absolutly no clue whats the issue, any idea ?

error: failed to connect to the hypervisor
error: End of file while reading data: nc: unix connect failed: No such file or directory: Input/output error

snapshot create as external file job blocked while the vm qemu process is killed with 7.0.0 version of the libvirt.

Hi,
We had one issue, virsh snapshot-create-as command create snapshot with external file while the vm is active.
So someone kill the qemu proccess of the vm, so the snapshot-create-as command blocked.
Is it one bug or exception to be processed and how fix it.
Thanks.

So we can not start the vm again as below logs of the libvirtd.
2021-08-13 07:35:26.093+0000: 2418940: warning : qemuDomainObjBeginJobInternal:953 : Cannot start job (none, none, start) for domain vm_6_135; current job is (none, none, snapshot) owned by (0 , 0 , 4340 remoteDispatchDomainSnapshotCreateXML (flags=0x280)) for (0s, 0s, 74645s)
2021-08-13 07:35:26.093+0000: 2418940: error : qemuDomainObjBeginJobInternal:975 : Timed out during operation: cannot acquire state change lock (held by monitor=remoteDispatchDomainSnapshotCreateXML)
2021-08-13 07:35:30.875+0000: 2418937: warning : qemuDomainObjBeginJobInternal:953 : Cannot start job (none, none, start) for domain vm_6_135; current job is (none, none, snapshot) owned by (0 , 0 , 4340 remoteDispatchDomainSnapshotCreateXML (flags=0x280)) for (0s, 0s, 74650s)
2021-08-13 07:35:30.875+0000: 2418937: error : qemuDomainObjBeginJobInternal:975 : Timed out during operation: cannot acquire state change lock (held by monitor=remoteDispatchDomainSnapshotCreateXML)

Some virsh commands become invalid when libvirt software functions are verified on KVM VMs.

see:

[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-240.el8.x86_64 #1 SMP Fri Sep 25 19:48:47 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# cat /etc/system-release
CentOS Linux release 8.3.2011
[root@localhost ~]# virsh list
 Id   Name   State
----------------------
 1    vm1    running
[root@localhost ~]# virsh change-media vm1 vda
error: No disk found whose source path or target is vda
[root@localhost ~]# virsh detach-device-alias vm1 vda
error: Failed to detach device with alias vda
error: internal error: no device found with alias vda
[root@localhost ~]# virsh domfsfreeze vm1
error: Unable to freeze filesystems
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh domfstrim vm1
error: Unable to invoke fstrim
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh domfsinfo vm1
error: Unable to get filesystem information
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh domfstrim vm1
error: Unable to invoke fstrim
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh domjobabort vm1
error: Requested operation is not valid: no job is active on the domain
[root@localhost ~]# virsh managedsave-edit vm1
error: Requested operation is not valid: domain does not have managed save image
[root@localhost ~]# virsh managedsave-dumpxml vm1
error: Requested operation is not valid: domain does not have managed save image
[root@localhost ~]# virsh managedsave-define vm1 /etc/libvirt/qemu/vm1.xml
error: Failed to update vm1 XML configuration
error: Requested operation is not valid: domain does not have managed save image
[root@localhost ~]# virsh managedsave-define vm1 /etc/libvirt/qemu/vm1.xml
error: Failed to update vm1 XML configuration
error: Requested operation is not valid: domain does not have managed save image
[root@localhost ~]# virsh metadata vm1 -9
error: metadata not found: Requested metadata element is not present
[root@localhost ~]# virsh migrate-postcopy vm1
error: Requested operation is not valid: post-copy can only be started while outgoing migration is in progress
[root@localhost ~]# virsh qemu-agent-command vm1 stop
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh set-lifecycle-action vm1 kvm shutoff
error: Invalid lifecycle type 'kvm'.
[root@localhost ~]# virsh set-user-password vm1 root root
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh undefine vm1
error: Failed to undefine domain vm1
error: Requested operation is not valid: cannot undefine domain with nvram
[root@localhost ~]# virsh guestvcpus vm1
error: Guest agent is not responding: QEMU guest agent is not connected
[root@localhost ~]# virsh setvcpu vm1 0 --enable
error: invalid argument: vcpu '0' is already in requested state
[root@localhost ~]# virsh allocpages --pagesize 1 --pagecount 1
error: operation failed: page size 1 is not available
[root@localhost ~]# virsh net-port-create default /etc/libvirt/qemu/networks/default.xml
error: Failed to create network from /etc/libvirt/qemu/networks/default.xml
error: XML error: unknown root element for network port
[root@localhost ~]# virsh net-port-dumpxml vbr 5
error: failed to get network 'vbr'
[root@localhost ~]# virsh net-port-delete vbr 5
error: failed to get network 'vbr'
[root@localhost ~]#  virsh nodedev-create /usr/wwx1024195/device.xml
error: Failed to create node device from /usr/wwx1024195/device.xml
error: internal error: no device capabilities for 'new device'

There are 255 commands in total. 44 failed commands (both aarch64 and x86_64 failed). Among them, 14 commands are not supported by the two platforms. Five commands about No IOThreads do not meet the requirements and are marked in blue. Therefore, a total of 19 commands are invalid, and the remaining 25 commands are error messages. Can you let me see it?

TPM Emulator is considered to have been created when tpm state folder exists

In qemuTPMEmulatorCreateStorage function,TPM Emulator is considered to have been created when the tpm state folder exists. When tpm state permanent file has been deleted and tpm state folder exists,it doesn‘t execute swtpm_setup and EK certificate isn't applied. So whether it needs to be modified to judge the existence of tpm permanent file to denote that the TPM Emulator has been created ?

libvirt/src/qemu/qemu_tpm.c

Lines 176 to 195 in 215b246

qemuTPMEmulatorCreateStorage(virDomainTPMDef *tpm,
bool *created,
uid_t swtpm_user,
gid_t swtpm_group)
{
const char *storagepath = tpm->data.emulator.storagepath;
g_autofree char *swtpmStorageDir = g_path_get_dirname(storagepath);
/* allow others to cd into this dir */
if (g_mkdir_with_parents(swtpmStorageDir, 0711) < 0) {
virReportSystemError(errno,
_("Could not create TPM directory %s"),
swtpmStorageDir);
return -1;
}
*created = false;
if (!virFileExists(storagepath))
*created = true;

libvirt/src/qemu/qemu_tpm.c

Lines 555 to 581 in 215b246

static virCommand *
qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
const char *vmname,
const unsigned char *vmuuid,
bool privileged,
uid_t swtpm_user,
gid_t swtpm_group,
bool incomingMigration)
{
g_autoptr(virCommand) cmd = NULL;
bool created = false;
g_autofree char *swtpm = virTPMGetSwtpm();
int pwdfile_fd = -1;
int migpwdfile_fd = -1;
const unsigned char *secretuuid = NULL;
if (!swtpm)
return NULL;
if (qemuTPMEmulatorCreateStorage(tpm, &created, swtpm_user, swtpm_group) < 0)
return NULL;
if (tpm->data.emulator.hassecretuuid)
secretuuid = tpm->data.emulator.secretuuid;
if (created &&
qemuTPMEmulatorRunSetup(tpm->data.emulator.storagepath, vmname, vmuuid,

Missing closing files

The file openning at g_autoptr(FILE) fp = fopen(file, "r"); is not closed?

libvirt/tests/testutils.c

Lines 224 to 271 in 1ee3314

virTestLoadFile(const char *file, char **buf)
{
g_autoptr(FILE) fp = fopen(file, "r");
struct stat st;
char *tmp;
int len, tmplen, buflen;
if (!fp) {
fprintf(stderr, "%s: failed to open: %s\n", file, g_strerror(errno));
return -1;
}
if (fstat(fileno(fp), &st) < 0) {
fprintf(stderr, "%s: failed to fstat: %s\n", file, g_strerror(errno));
return -1;
}
tmplen = buflen = st.st_size + 1;
*buf = g_new0(char, buflen);
tmp = *buf;
(*buf)[0] = '\0';
if (st.st_size) {
/* read the file line by line */
while (fgets(tmp, tmplen, fp) != NULL) {
len = strlen(tmp);
/* stop on an empty line */
if (len == 0)
break;
/* remove trailing backslash-newline pair */
if (len >= 2 && tmp[len-2] == '\\' && tmp[len-1] == '\n') {
len -= 2;
tmp[len] = '\0';
}
/* advance the temporary buffer pointer */
tmp += len;
tmplen -= len;
}
if (ferror(fp)) {
fprintf(stderr, "%s: read failed: %s\n", file, g_strerror(errno));
VIR_FREE(*buf);
return -1;
}
}
return 0;
}

how to define disk type of vhost-user-scsi in libvirt xml file

I used libvirt 7.2.0 , qemu 5.2.0

i wanna start domain with vhost-user-scsi disk , but libvirt disk bus seems to only support virtio , how to define vhost-user-scsi disk ?
codes as follow :
<disk type='vhostuser' device='disk'> <driver name='qemu' type='raw'/> <source type='unix' path='/opt/tmp/vhost.0'> <reconnect enabled='yes' timeout='10'/> </source> <target dev='sdb' bus='virtio'/> </disk>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.