Libvirt/Qemu error: detect_zeroes is not supported

Issues related to applications and software problems
Post Reply
UltimateByte
Posts: 4
Joined: 2021/10/26 16:04:52
Contact:

Libvirt/Qemu error: detect_zeroes is not supported

Post by UltimateByte » 2021/10/26 16:23:24

Hello,

Running a Centos 7 virtual host, I am trying to set VirtIO drive settings "detect_zeroes" and "discard" to "unmap" values.
I have been able to do that on my test machine running Debian 10 without any issue, from the virt-manager interface.
However, on my CentOS 7 server, the option isn't available from the virt-manager interface.
I couldn't explain this, especially since libvirt and qemu version both seems more up to date on CentOS 7 than Debian 10.

I went ahead and edited the VM's config with virsh like follows:

Code: Select all

<driver name='qemu' type='raw' cache='none' io='native' discard='unmap' detect_zeroes='unmap'/>
But this results in an error starting the VM:

Code: Select all

Error starting domain: unsupported configuration: detect_zeroes is not supported by this QEMU binary

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 125, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 82, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/domain.py", line 1506, in startup
    self._backend.create()
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1080, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirtError: unsupported configuration: detect_zeroes is not supported by this QEMU binary
This value seems to be accepted:

Code: Select all

discard='unmap' 
But this one has to be removed in order to start the VM:

Code: Select all

detect_zeroes='unmap'
I've been googling around and couldn't found any info about detect_zeroes prerequisites.
I tried "qcow2" disk image format but it doesn't seem to add these settings neither to the virt-manager interface.

Installed packages:

Code: Select all

# yum list installed | grep "libvirt\|qemu"
ipxe-roms-qemu.noarch                  20180825-3.git133f4c.el7        @base    
libvirt.x86_64                         4.5.0-36.el7_9.5                @updates 
libvirt-bash-completion.x86_64         4.5.0-36.el7_9.5                @updates 
libvirt-client.x86_64                  4.5.0-36.el7_9.5                @updates 
libvirt-daemon.x86_64                  4.5.0-36.el7_9.5                @updates 
libvirt-daemon-config-network.x86_64   4.5.0-36.el7_9.5                @updates 
libvirt-daemon-config-nwfilter.x86_64  4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-interface.x86_64 4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-lxc.x86_64       4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-network.x86_64   4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-nodedev.x86_64   4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-nwfilter.x86_64  4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-qemu.x86_64      4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-secret.x86_64    4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-storage.x86_64   4.5.0-36.el7_9.5                @updates 
libvirt-daemon-driver-storage-core.x86_64
libvirt-daemon-driver-storage-disk.x86_64
libvirt-daemon-driver-storage-gluster.x86_64
libvirt-daemon-driver-storage-iscsi.x86_64
libvirt-daemon-driver-storage-logical.x86_64
libvirt-daemon-driver-storage-mpath.x86_64
libvirt-daemon-driver-storage-rbd.x86_64
libvirt-daemon-driver-storage-scsi.x86_64
libvirt-daemon-kvm.x86_64              4.5.0-36.el7_9.5                @updates 
libvirt-glib.x86_64                    1.0.0-1.el7                     @anaconda
libvirt-libs.x86_64                    4.5.0-36.el7_9.5                @updates 
libvirt-python.x86_64                  4.5.0-1.el7                     @base    
qemu-img.x86_64                        10:1.5.3-175.el7_9.4            @updates 
qemu-kvm.x86_64                        10:1.5.3-175.el7_9.4            @updates 
qemu-kvm-common.x86_64                 10:1.5.3-175.el7_9.4            @updates

Maybe a missing package? Or something else?

I don't know what to look for at this point. Any help would be appreciated.

Thank you
Where there is a shell, there is a way.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by TrevorH » 2021/10/26 16:48:30

https://bugzilla.redhat.com/show_bug.cgi?id=1672682 says it has to use virtio-blk-pci but there is lots of info in there. And whether the patches that enabled it in "Advanced Virtualisation" made it into the non-advanced version is another question...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

UltimateByte
Posts: 4
Joined: 2021/10/26 16:04:52
Contact:

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by UltimateByte » 2021/10/26 17:25:26

Thank you for your answer.

Unfortunately, after further investigations, it appears I misunderstood/misread the package versions... The outcome doesn't look too good for me.
CentOS 7 has far older packages than Debian 10 actually.

Debian 10 uses virt-manager 2.0.0.
CentOS 7 uses virt-manager 1.5.0.

Support for "detect_zeroes" was added in virt-manager 2.0.0.

Source : https://github.com/virt-manager/virt-ma ... er/NEWS.md
Release 2.0.0 (October 15, 2018)
(...)
UI support for disk discard and detect_zeroes (Povilas Kanapickas, Lin Ma)
This can be workarounded by installing virt-manager on a more updated OS (like your desktop), such as Fedora (using Fedora 34 atm), then remote Qemu+SSH into your host.

However, this doesn't fix the issue starting the machine while "detect_zeroes" is enabled.
Therefore, the issue now comes down to be either from Qemu or libvirt version not having support for it.

Back to investigations, I found :
CentOS 7 uses Qemu version 1.5.3.
Debian 10 uses Qemu version 5.2.

Scrubbing the changelogs for Qemu, I found that Qemu started introducing zero writes in version 2.1.
Source: https://wiki.qemu.org/ChangeLog/2.1#Blo ... _and_tools
Zero writes by the guest can now be automatically translated to write zero requests. (drive option detect-zeroes)
As for the provided link, unfortunately, on CentOS 7, the following command doesn't return anything:

Code: Select all

# yum list available | grep -i virtio
Therefore, there doesn't seem to be any similar package for CentOS 7.

Overhaul, it seems to be a dead end trying to support this feature on a CentOS 7 host (and even more on many CentOS 7 hosts).

Thank you for your time and attention.
Hopefully this thread comes into Google to help others not wasting as many hours as I did lose.
Where there is a shell, there is a way.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by TrevorH » 2021/10/26 18:09:32

Not sure where you got virt-manager being required. That's a GUI that allows you to manage VMs. It is not libvirt and it is libvirt that needs to be 2.0.0 or higher and is - it's 4.5.0 on CentOS 7.

The bugzilla entry I pointed to says that you must use virtio-blk-pci for the "disk" and controller in question. That may not be the default type. I tried it on a VM that uses virtio-scsi and that errors with "error: unsupported configuration: detect_zeroes is not supported by this QEMU binary" so this is qemu problem by the looks of it, not a libvirt one.

Next step, there is a centos-release-qemu-ev.noarch package. Install that and you will get access to qemu-kvm-ev.x86_64 which is 2.12.0-44.1.el7_8.1 as part of that new repo.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

UltimateByte
Posts: 4
Joined: 2021/10/26 16:04:52
Contact:

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by UltimateByte » 2021/10/26 18:30:32

My message was a bit on the long end, but I already found out this was Qemu related in my previous answer.
Scrubbing the changelogs for Qemu, I found that Qemu started introducing zero writes in version 2.1.
Also, I can't recall saying virt-manager was "required" for this.
It's a convenient tool over editing XML files by hand, therefore, I would rather have it working with the desired options.

I should have mentioned it, but I too, tried on an SCSCI, because my reasearch pointed me to this being the first supporting zeroing. But just like your testing, it didn't work out. Which makes sense, as QEMU 1.5 didn't support zeroing. Anyway I wasn't thrilled by using the SCSI driver anyway, since it operates worse than VirtIO in my previous testings.

I probably should have mentioned it as well: Goal is to add TRIM support for SSD virtualization hosts on a server park. If disk image is plain, then TRIM won't work, therefore, SSD write speeds will be degraded over time.
But if it gets that tricky to do, the solution will more likely be to reinstall the hosts with distros that support these features natively, rather than editing XMLs ton non-standard values for this version, that don't even show up in the virt-manager graphical interface, and that isn't likely to work anyway, because of a way too obsolete Qemu version.

At this point, the only solution I can think of, would be to find alternatives repos allowing to update libvirt, qemu, and virt-manager. Seems unlikely to find anything like that, and even more unlikely, to have a safe upgrade path for such a particular scenario.
Where there is a shell, there is a way.

User avatar
TrevorH
Site Admin
Posts: 33191
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by TrevorH » 2021/10/26 21:31:22

Did you try the centos-release-qemu-ev yet? That gets you access to qemu-kvm-ev at 2.12.0-44.1.el7_8.1
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

UltimateByte
Posts: 4
Joined: 2021/10/26 16:04:52
Contact:

Re: Libvirt/Qemu error: detect_zeroes is not supported

Post by UltimateByte » 2021/10/26 22:27:41

Didn't give this point the attention it deserved, thank you for insisting.

That is something I need to try.
I'm unsure if it's easily and reliably doable to switch from regular Qemu to this one. That is something I'll have to test on a sandbox env, and report back.
Where there is a shell, there is a way.

Post Reply