Libvirt
by Gk Gk
Hi All,
I am trying to collect memory, disk and network stats for a VM on kvm host.
It seems that the statistics are not matching what the OS inside the VM is
reporting. Why is this discrepancy ?
Is this a known bug of libvirt ? Also I heard that libvirt shows cumulative
figures for these measures ever since the VM was created. Also I tested by
creating a new vm and comparing the stats without a reboot . Even in this
case, the stats dont agree. Can someone help me here please ?
Thanks
Kumar
1 year
Unable to create a VM in a specific network namespace using the Domain XML descriptions and API for libvirt + QEMU over KVM
by Roberto Jacob Da Silva
I have a system where I spawn a single libvirt daemon process in the default network namespace.
Once the daemon is running, I create and start VMs using the virDomainDefineXML API (defines a VM or "domain" but does not boot it) followed by the virDomainCreate API (boot the VM).
Now, I am trying to create these VMs in generic network namespaces provided by the user e.g., /var/run/netns/<my-network-namespace>.
While searching the libvirt documentation (i.e., https://libvirt.org/formatdomain.html), I couldn't find any configuration options, which would support this network namespace specification via the domain XML APIs.
Is there any way to accomplish this with the domain XML APIs?
If not, what's the recommended approach to allow a libvirt client to request the libvirt server to create and boot VMs in distinct network namespaces?
1 year, 8 months
Re: ACLs problem on /dev/kvm
by Michal Prívozník
[Please keep the list CCed for benefit of the community]
On 2/27/23 16:58, Sánta, Márton (ext) wrote:
> Dear Michal,
>
> Thank you for your quick help, this worked for me but I would like to use the latest version if it is possible. Do you know how to upgrade my libvirt version in yocto? I tried to use devtool to upgrade v9.0.0 but there were some issues during the process and I had to do a lot of things manually (downloading the approprieta sources as during the update, the v8.1.0 sources were downloaded etc.) and I do not see what problems can it cause later on. What do you suggest?
Hey, unfortunately I have zero experience with yocto. I believe you need
to contact whoever maintains libvirt there and point them to the fix I
mention in my previous reply. Surely they have a way to backport patches.
Michal
1 year, 8 months
help regarding gsoc 2023
by Kshitiz Mhto
hello, i am 1st year student with good understanding of C programming along
with pythan and java. i would love to contribute to project "libvirt" and
interested in gsoc 2023 regardung the project [Metadata support for all
object schemas -- Suggested by: Daniel Berrange]. could anyone help on this?
1 year, 9 months
how to use exec:cat > /dev/null using libvirt
by Jiatong Shen
Hello community,
I am trying to inspect a migration failure using the steps described
here (
https://wiki.qemu.org/Features/Migration/Troubleshooting#:~:text=on%20gra....).
In the fourth step, it suggests using migrate 'exec:cat > /dev/null' to try
dumping vm state on the source node. Since the virtual machine is
controlled by libvirt, I suppose I could using the following command,
virsh qemu-monitor-command --hmp <instance-id> 'migrate "exec:cat >
/dev/nulll"
but it failed with 2023-02-24T02:56:07.347307Z qemu-system-x86_64: Unable
to write to command: Broken pipe
So my question is how to use this command using libvirt? Thank you very
much for the help.
--
Best Regards,
Jiatong Shen
1 year, 9 months
ACLs problem on /dev/kvm
by Sánta, Márton (ext)
Dear All,
I have started to work with libvirt a few weeks ago, but I have some problem with starting a virtual machine. Currently, I am using an embedded arm64 device with a Linux built with Yocto. I managed to install lbvirt 8.1.0 in the image and I have a qemu user and qemu and kvm groups in the system. I am using KVM hypervisor and I did the configuration in the qemu.conf and libvirtd.conf files, enabled all the sockets and services in the system. The xml based definition of the virtual machine is simple, but when I try to start it I get the error message: Failed to start domain 'XYZ' and Unable to set ACLs on /dev/kvm: Invalid argument. I cannot set ACLs on the /dev/kvm (owner is root, group is kvm but I have also tried to set it root:root) with the setfacl command, but I gave rwx access to user, group and others as well so everybody can use the device. I also uncommented the relevant lines in the qemu.conf file (cgroup_controllers = ... and cgroup_device_acl = ...) and I also found that devices controller is already mounted at /sys/fs/cgroup/devices. Can anybody help me with this issue? Did Anybody have similar problem? I can start a virtual machine with qemu-system-aarch64, but I would like to use the libvirt library to manage the machines.
Thank you in advance for an early reply.
Best regards,
Márton Sánta
This transmission is intended solely for the addressee and contains confidential information.
If you are not the intended recipient, please immediately inform the sender and delete the message and any attachments from your system.
Furthermore, please do not copy the message or disclose the contents to anyone unless agreed otherwise. To the extent permitted by law we shall in no way be liable for any damages, whatever their nature, arising out of transmission failures, viruses, external influence, delays and the like.
1 year, 9 months
there is no PCIe device after command "virsh nodedev-list"
by Martin Bayern
Hello,
I don't know if this is the right email list for this question, let me try.
I experienced a problem when I want to assign PCIe VF to my VMs, I can
use "lspci" to list the VF PCIe, even PF PCIe, but the command " virsh
nodedev-list"
doesn't print any PCIe bus device. I tried using "virsh edit --domain "
command and added the PCIe bus to the XML file, but when I start the VM,
the error message
shows an internal error, there is an invalid link to the device.
Meanwhile, I use virt-manager to see if I can add a PCIe host device,
but the host device shows "no device available".
my system is ARM64 based Nvidia platform, I have enabled IOMMU in the
kernel. do you know how can I figure out the root cause? is this the
ARM64 kernel issue or something else??
I posted this issue also in Nvidia forum:
https://forums.developer.nvidia.com/t/nvidia-orin-pcie-device-there-is-no...
thanks so much for your suggestions.
Martin
1 year, 9 months
Unable to set XATTR trusted.libvirt.security.dac Operation not supported
by Simon Fairweather
Running with Kernel 6.1.8
QEMU 7.1 libvirt 8.7
setting remeber_owner = 0 resolves the issue but was working ok on kernel
6.0.x.
root@computenode:~# cat /etc/libvirt/qemu.conf | grep reme
# Whether libvirt should remember and restore the original
remember_owner = 0
root@computenode:~#
Any known issues for this, is it likely to be QEMU/KVM?
1 year, 9 months
Installing Kali Linux (kali-linux-2022.4-installer-amd64.iso) using KVM virt-install tool
by Kaushal Shriyan
Hi,
I am trying to install kali-linux-2022.4-installer-amd64.iso (
https://www.kali.org/downloads/) using KVM virt-install tool
#virt-install --name=kalilinux --file=/linuxkvmaddgbdisk/kalilinux.img
--file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
--os-type=linux --os-variant=debian9 --graphics none
--location=/linuxkvmaddgbdisk/kali-linux-2022.4-installer-amd64.iso
--extra-args="console=ttyS0
Starting install...
Retrieving file .treeinfo...
| 0 B 00:00:00
Retrieving file content...
| 0 B 00:00:00
Retrieving file info...
| 104 B 00:00:00
Retrieving file info...
| 104 B 00:00:00
Retrieving file info...
| 104 B 00:00:00
ERROR Could not find an installable distribution at
'/linuxkvmaddgbdisk/kali-linux-2022.4-installer-amd64.iso': The URL could
not be accessed, maybe you mistyped?
The location must be the root directory of an install tree.
See virt-install man page for various distro examples.
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start kalilinux
otherwise, please restart y
#virt-install --name=kalilinux --file=/linuxkvmaddgbdisk/kalilinux.img
--file-size=50 --nonsparse --vcpu=2 --ram=4096 --network=bridge:br0
--os-type=linux --os-variant=debian9 --graphics none
--cdrom=/linuxkvmaddgbdisk/kali-linux-2022.4-installer-amd64.iso
--extra-args="console=ttyS0"
ERROR --extra-args only work if specified with --location. See the man
page for examples of using --location with CDROM media
# osinfo-query os | grep -i debian
debian1.1 | Debian GNU/Linux 1.1
| 1.1 | http://debian.org/debian/1.1
debian1.2 | Debian GNU/Linux 1.2
| 1.2 | http://debian.org/debian/1.2
debian1.3 | Debian GNU/Linux 1.3
| 1.3 | http://debian.org/debian/1.3
debian10 | Debian 10
| 10 | http://debian.org/debian/10
debian11 | Debian 11
| 11 | http://debian.org/debian/11
debian2.0 | Debian GNU/Linux 2.0
| 2.0 | http://debian.org/debian/2.0
debian2.1 | Debian GNU/Linux 2.1
| 2.1 | http://debian.org/debian/2.1
debian2.2 | Debian GNU/Linux 2.2
| 2.2 | http://debian.org/debian/2.2
debian3 | Debian GNU/Linux 3.0
| 3.0 | http://debian.org/debian/3
debian3.1 | Debian GNU/Linux 3.1
| 3.1 | http://debian.org/debian/3.1
debian4 | Debian GNU/Linux 4.0
| 4.0 | http://debian.org/debian/4
debian5 | Debian GNU/Linux 5.0
| 5.0 | http://debian.org/debian/5
debian6 | Debian 6.0
| 6.0 | http://debian.org/debian/6
debian7 | Debian 7
| 7 | http://debian.org/debian/7
debian8 | Debian 8
| 8 | http://debian.org/debian/8
debian9 | Debian 9
| 9 | http://debian.org/debian/9
debiantesting | Debian testing
| testing | http://debian.org/debian/testing
#
I did not find kali OS details to provide an option for* --os-variant= * When
I ran osinfo-query os | grep kali. It did not return anything.
Any help will be highly appreciated and I look forward to hearing from you.
Thanks in advance.
Best Regards,
Kaushal
1 year, 9 months
Attach a GPS in preboot mode
by lnj.sam@gmail.com
Hello everyone and best wishes for 2023 :)
I have an old *Garmin Drive Smart 50 GPS* and I want to be able to
attach it when it is in preboot mode to a VM hosted by a *Debian 11 host*.
From what I understand, the preboot mode allows us to flash a firmware
before the GPS actually starts (used among other things when the GPS is
soft bricked).
When I connect the GPS to the host it gives:
|root@host:~# journalctl -kf||
||# GPS in MTP storage mode (default when reset)||
||...||
||janv. 23 23:02:51 host kernel: usb 2-4: New USB device found,
idVendor=091e, idProduct=48db, bcdDevice= 0.01||
||janv. 23 23:02:51 host kernel: usb 2-4: New USB device strings: Mfr=1,
Product=2, SerialNumber=5||
||...||
||# GPS in mass storage mode||
||...||
||janv. 23 23:01:29 host kernel: usb 2-4: New USB device found,
idVendor=091e, idProduct=28db, bcdDevice= 5.09||
||janv. 23 23:01:29 host kernel: usb 2-4: New USB device strings: Mfr=0,
Product=0, SerialNumber=5||
||...||
||# GPS in preboot mode||
||...||
||janv. 23 23:09:05 host kernel: usb 2-4: New USB device found,
idVendor=091e, idProduct=0003, bcdDevice= 0.01||
||janv. 23 23:09:05 host kernel: usb 2-4: New USB device strings: Mfr=0,
Product=0, SerialNumber=0||
||janv. 23 23:09:13 host kernel: garmin_gps ttyUSB0: Garmin GPS usb/tty
converter now disconnected from ttyUSB0|
...
We see that *idVendor*, *idProduct*, *bcdDevice*, *Mfr*, *Product* and
*SerialNumber* vary according to the modes.We also see that the GPS is
seen as a *ttyUSB0* serial device.
I managed to attach the GPS in preboot mode, thanks to a script which
waits for the GPS to be detected in this mode (not detailed here so as
not to overload, but I can publish it if necessary) and which attaches
to a VM in running (*successfully tested on Debian 11 **and**Windows 7
guests*).
Here is the code that generates the XML before attaching it :
|...||
||echo "<serial type='dev'> \||
|| <source path='"$( \||
|| ls -1 /dev/tty* | grep -Ev "tty(|S?[0-9]+)$" \||
|| )"'/> \||
|| <target type='usb-serial'> \||
|| <vendor id='0x"$( \||
|| echo 091e \||
|| )"'/> \||
|| <product id='0x"$( \||
|| echo 28db \||
|| )"'/> \||
|| </target> \||
|| </serial>" > serial_device.xml||
||virsh attach-device vm-bullseye --file serial_device.xml &||
||...|
But once attached, this is what I see in the XML configuration of my VM
(from *virt-manager*) :
|<serial type="dev">||
|| <source path="/dev/ttyUSB1"/>||
|| <target type="usb-serial" port="1">||
|| <model name="usb-serial"/>||
|| </target>||
|| <alias name="serial1"/>||
|| <address type="usb" bus="0" port="4"/>||
||</serial>|
We see that libvirt has removed the *vendor/product id* from the XML.
Also here is what I get from a *Debian 11 guest* :
|root@vm-bullseye:~# journalctl -k -f||
||...||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: new full-speed USB
device number 2 using uhci_hcd||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: New USB device found,
idVendor=0403, idProduct=6001, bcdDevice= 4.00||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: New USB device strings:
Mfr=1, Product=2, SerialNumber=4||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Product: QEMU USB SERIAL||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Manufacturer: QEMU||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: SerialNumber:
1-0000:00:05.7-4||
||janv. 23 21:26:22 vm-bullseye kernel: usbcore: registered new
interface driver usbserial_generic||
||janv. 23 21:26:22 vm-bullseye kernel: usbserial: USB Serial support
registered for generic||
||janv. 23 21:26:22 vm-bullseye kernel: usbcore: registered new
interface driver ftdi_sio||
||janv. 23 21:26:22 vm-bullseye kernel: usbserial: USB Serial support
registered for FTDI USB Serial Device||
||janv. 23 21:26:22 vm-bullseye kernel: ftdi_sio 3-2:1.0: FTDI USB
Serial Device converter detected||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Detected FT232BM||
||janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: FTDI USB Serial Device
converter now attached to ttyUSB0||
||janv. 23 21:26:25 vm-bullseye kernel: usb 3-2: USB disconnect, device
number 2||
||janv. 23 21:26:25 vm-bullseye kernel: ftdi_sio ttyUSB0: FTDI USB
Serial Device converter now disconnected from ttyUSB0||
||janv. 23 21:26:25 vm-bullseye kernel: ftdi_sio 3-2:1.0: device
disconnected||
||...|
The guest sees the GPS well but
idVendor=*0403*, idProduct=*6001*, bcdDevice=4.00, Mfr=1, Product=2,
SerialNumber=4
... do not correspond to anything, and tools that expect GPS in preboot
mode do not see it.
My questions :
Q1 : Is it possible ?
Q2 : Am I doing it the right way ?
Q3 : Is there a method to pass such a device directly (pass-through) ?
Thank you in advance for the time you are going to devote to me :)
With Adelphity,
lnj
1 year, 9 months