2

In the QEMU commandline you can set a L2 cache for a disk using l2-cache-size=10M
This option is not supported in Virsh XML but it should be able to use the XML element <qemu:commandline> but I cannot get it to work.

My disk element in my well-working XML:

<disk type='file' device='disk'>
   <driver name='qemu' type='qcow2' cache='none' io='native' disca zrd='unmap'/>
   <source file='/disk1.qcow2'/>
   <target dev='sda' bus='scsi'/>
   <boot order='1'/>
   <address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>

I've tried to transform this drive to this <qemu:commandline> element:

<qemu:commandline>
   <qemu:arg value='-device'/>
   <qemu:arg value='scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1,write-cache=on'/>
   <qemu:arg value='-drive'/>
   <qemu:arg value='file=/disk1.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0,cache=none,discard=unmap,aio=native,l2-cache-size=10M'/>
</qemu:commandline>

When I start the VM I get this error Block node is read-only:

error: Failed to start domain W10_LTSB
error: internal error: process exited while connecting to monitor: 2019-09-08T21:28:46.565810Z qemu-system-x86_64: -drive file=/mnt/970_DATA/VMs/W10_Ent_LTSB_template/disk1.qcow2,format=qcow2,if=none,id=drive-scsi0-0-0-0,cache=none,discard=unmap,aio=native,l2-cache-size=10M: Block node is read-only

1 Answer 1

1

libvirt doesn't support qemu commandline arguments. try providing a XML namespace declaration for the domain.

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

should possibly work!

more on this : https://libvirt.org/drvqemu.html#qemucommand

2
  • Sorry for not showing that, but I already did. If you don't you'll get and XML error (I did make the mistake to begin with :-P). So it seems I have another problem
    – MrCalvin
    Sep 9, 2019 at 6:17
  • 1
    I will try to convert both the old nd the new old XML file to QEMU cmdlineargs with virsh domxml-to-native qemu-argv domain.xml and compare, there must be a difference somewhere.
    – MrCalvin
    Sep 9, 2019 at 6:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .