2

This is the only way I have found to pass arguments to qemu:

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

Unfortunately the url http://libvirt.org/schemas/domain/qemu/1.0 now simply returns a 404 page, and libvirt automatically trims this part off. I can't seem to find any information on an alternative as even the libvirt website advises adding this broken schema!

Is there is another way to enable evdev pass-though without qemu arguments?

EDIT:

I solved this using the solution marked below, but one important thing to note is that virsh will always trim off xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0' unless there is a valid <qemu:[whatever]> tag somewhere in the domain.

Alex Baldwin
  • 123
  • 1
  • 4
  • No, that post is outdated, the virsh import functionality has since been deprecated and does not work for this purpose, another solution posted there is exactly where I run into the problem mentioned above. – Alex Baldwin Jun 06 '20 at 21:49

1 Answers1

3

Even if the URL of the namespace is a 404, using it in a domain configuration does work, and is documented on the libvirt homepage:

Additionally, the following XML additions allow fine-tuning of the command line given to qemu when starting a domain (Since 0.8.3). In order to use the XML additions, it is necessary to issue an XML namespace request (the special xmlns:name attribute) that pulls in http://libvirt.org/schemas/domain/qemu/1.0; typically, the namespace is given the name of qemu. With the namespace in place, it is then possible to add an element <qemu:commandline> under domain, with the following sub-elements repeated as often as needed:

qemu:arg

Add an additional command-line argument to the qemu process when starting the domain, given by the value of the attribute value.

qemu:env

Add an additional environment variable to the qemu process when starting the domain, given with the name-value pair recorded in the attributes name and optional value.

This is also tested in various places in libvirt:

I tested this solution on a kvm domain by changing the beginning of the definition to

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <qemu:commandline>
    <qemu:arg value='-unknown'/>
    <qemu:arg value='parameter'/>
  </qemu:commandline>

in virsh -c qemu:///system edit <domain>. On subsequent edits, those changes still exist (the new elements are moved to the end of the document, though).

Starting the domain also fails with qemu complaining about an unknown parameter:

↪ virsh -c qemu:///system start <domain>
error: Failed to start domain <domain>
error: Interner Fehler: qemu unexpectedly closed the monitor: qemu-system-x86_64: -unknown: invalid option

Note that an XML namespace does not need to be a URL that resolves to something ... usable.

AdminBee
  • 21,637
  • 21
  • 47
  • 71
Wieland
  • 6,353
  • 3
  • 28
  • 31