[libvirt] [PATCH v2] domain.rng vs. formatdomain.html#elementsUSB

The Relax-NG schema for domains regarding <hostdev> doesn't match what's implemented in src/conf/domain_conf.c#virDomainHostdevDefFormat(): The implementation only requires @type, but the schema currently either required none or all three attributes (@mode, @type, and @managed) to be defined together, because they are declared in the same <optional)-section. (@managed is currently even undocumented on <http://libvirt.org/formatdomain.html#elementsUSB>). Thus the following minimal <hostdev>-example fails to validate: <domain type='test'> <name>N</name> <memory>4096</memory> <bootloader>/bin/false</bootloader> <os> <type arch='x86_64' machine='xenpv'>linux</type> </os> <devices> <hostdev type='pci'> <source> <address bus='0x06' slot='0x00' function='0x0'/> </source> </hostdev> </devices> </domain> The schema is changed to match the current implementation: 1. @mode is optional (which defaults to 'subsystem') 2. @type is required 3. @managed is optional (which defaults to 'no') Signed-off-by: Philipp Hahn <hahn@univention.de> --- docs/schemas/domain.rng | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 8b215f3..21c4380 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1731,12 +1731,14 @@ <value>capabilities</value> </choice> </attribute> - <attribute name="type"> - <choice> - <value>usb</value> - <value>pci</value> - </choice> - </attribute> + </optional> + <attribute name="type"> + <choice> + <value>usb</value> + <value>pci</value> + </choice> + </attribute> + <optional> <attribute name="managed"> <choice> <value>yes</value> -- 1.7.1

The Relax-NG schema for domains regarding <hostdev> doesn't match what's implemented in src/conf/domain_conf.c#virDomainHostdevDefFormat(): The implementation only requires @type, but the schema currently either required none or all three attributes (@mode, @type, and @managed) to be defined together, because they are declared in the same <optional)-section. (@managed is currently even undocumented on <http://libvirt.org/formatdomain.html#elementsUSB>). Thus the following minimal <hostdev>-example fails to validate: <domain type='test'> <name>N</name> <memory>4096</memory> <bootloader>/bin/false</bootloader> <os> <type arch='x86_64' machine='xenpv'>linux</type> </os> <devices> <hostdev type='pci'> <source> <address bus='0x06' slot='0x00' function='0x0'/> </source> </hostdev> </devices> </domain> The schema is changed to match the current implementation: 1. @mode is optional (which defaults to 'subsystem') 2. @type is required 3. @managed is optional (which defaults to 'no') The documnetation is updated to mention @managed. Signed-off-by: Philipp Hahn <hahn@univention.de> --- docs/formatdomain.html.in | 7 ++++--- docs/schemas/domain.rng | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 84b1cab..0ec2045 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -953,7 +953,7 @@ <pre> ... <devices> - <hostdev mode='subsystem' type='pci'> + <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address bus='0x06' slot='0x02' function='0x0'/> </source> @@ -967,8 +967,9 @@ <dd>The <code>hostdev</code> element is the main container for describing host devices. For usb device passthrough <code>mode</code> is always "subsystem" and <code>type</code> is "usb" for an USB device and "pci" - for a PCI device.. - <dt><code>source</code></dt> + for a PCI device. When <code>managed</code> is "yes" for a PIC device, it + is detached from the host before being passed on to the guest.</dd> + <dt><code>source</code></dt> <dd>The source element describes the device as seen from the host. The USB device can either be addressed by vendor / product id using the <code>vendor</code> and <code>product</code> elements or by the device's diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index 8b215f3..21c4380 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -1731,12 +1731,14 @@ <value>capabilities</value> </choice> </attribute> - <attribute name="type"> - <choice> - <value>usb</value> - <value>pci</value> - </choice> - </attribute> + </optional> + <attribute name="type"> + <choice> + <value>usb</value> + <value>pci</value> + </choice> + </attribute> + <optional> <attribute name="managed"> <choice> <value>yes</value> -- 1.7.1

Hello Daniel, hello Eric, Ping? Am Dienstag 01 März 2011 11:23:20 schrieb Philipp Hahn:
The Relax-NG schema for domains regarding <hostdev> doesn't match what's implemented in src/conf/domain_conf.c#virDomainHostdevDefFormat(): The implementation only requires @type, but the schema currently either required none or all three attributes (@mode, @type, and @managed) to be defined together, because they are declared in the same <optional)-section. (@managed is currently even undocumented on <http://libvirt.org/formatdomain.html#elementsUSB>).
Thus the following minimal <hostdev>-example fails to validate: <domain type='test'> <name>N</name> <memory>4096</memory> <bootloader>/bin/false</bootloader> <os> <type arch='x86_64' machine='xenpv'>linux</type> </os> <devices> <hostdev type='pci'> <source> <address bus='0x06' slot='0x00' function='0x0'/> </source> </hostdev> </devices> </domain>
The schema is changed to match the current implementation: 1. @mode is optional (which defaults to 'subsystem') 2. @type is required 3. @managed is optional (which defaults to 'no')
The documnetation is updated to mention @managed.
What some more changes or how may I improve my contrinbution? Sincerely Philipp -- Philipp Hahn Open Source Software Engineer hahn@univention.de Univention GmbH Linux for Your Business fon: +49 421 22 232- 0 Mary-Somerville-Str.1 28359 Bremen fax: +49 421 22 232-99 http://www.univention.de/

On 03/01/2011 03:23 AM, Philipp Hahn wrote:
The Relax-NG schema for domains regarding <hostdev> doesn't match what's implemented in src/conf/domain_conf.c#virDomainHostdevDefFormat(): The implementation only requires @type, but the schema currently either required none or all three attributes (@mode, @type, and @managed) to be defined together, because they are declared in the same <optional)-section. (@managed is currently even undocumented on <http://libvirt.org/formatdomain.html#elementsUSB>).
Thanks again for taking this on (and sorry for my review backlog delay - it's been a couple weeks of chasing down nasty crashers, which stole my time).
The schema is changed to match the current implementation: 1. @mode is optional (which defaults to 'subsystem') 2. @type is required 3. @managed is optional (which defaults to 'no')
The documnetation is updated to mention @managed.
s/documnetation/documentation/
@@ -967,8 +967,9 @@ <dd>The <code>hostdev</code> element is the main container for describing host devices. For usb device passthrough <code>mode</code> is always "subsystem" and <code>type</code> is "usb" for an USB device and "pci"
As long as we're touching this - English is screwy, and the acronym USB is pronounced "you-ess-bee", the pronounced 'y' therefore matches with "a" rather than "an".
- for a PCI device.. - <dt><code>source</code></dt> + for a PCI device. When <code>managed</code> is "yes" for a PIC device, it + is detached from the host before being passed on to the guest.</dd> + <dt><code>source</code></dt>
Spurious whitespace change on that last line; worse, the TABs are now caught by 'make syntax-check'.
+++ b/docs/schemas/domain.rng @@ -1731,12 +1731,14 @@ <value>capabilities</value> </choice> </attribute> - <attribute name="type"> - <choice> - <value>usb</value> - <value>pci</value> - </choice> - </attribute> + </optional> + <attribute name="type"> + <choice> + <value>usb</value> + <value>pci</value> + </choice> + </attribute> + <optional> <attribute name="managed">
ACK with nits addressed, so I pushed it. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Not "Programmable Interrupt Controller" but "Peripheral Component Interconnect". Signed-off-by: Philipp Hahn <hahn@univention.de> --- docs/formatdomain.html.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d39aee0..f06b524 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -968,7 +968,7 @@ <dd>The <code>hostdev</code> element is the main container for describing host devices. For usb device passthrough <code>mode</code> is always "subsystem" and <code>type</code> is "usb" for a USB device and "pci" - for a PCI device. When <code>managed</code> is "yes" for a PIC + for a PCI device. When <code>managed</code> is "yes" for a PCI device, it is detached from the host before being passed on to the guest.</dd> <dt><code>source</code></dt> -- 1.7.1

On 03/14/2011 01:52 AM, Philipp Hahn wrote:
Not "Programmable Interrupt Controller" but "Peripheral Component Interconnect".
Signed-off-by: Philipp Hahn <hahn@univention.de> --- docs/formatdomain.html.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d39aee0..f06b524 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -968,7 +968,7 @@ <dd>The <code>hostdev</code> element is the main container for describing host devices. For usb device passthrough <code>mode</code> is always "subsystem" and <code>type</code> is "usb" for a USB device and "pci" - for a PCI device. When <code>managed</code> is "yes" for a PIC + for a PCI device. When <code>managed</code> is "yes" for a PCI
Thanks; pushed, and sorry for missing it on my first review. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
Philipp Hahn