[PATCH 0/3] schemas: Couple of nodedev related fixes

These three patches address the first three problems raised in https://bugzilla.redhat.com/show_bug.cgi?id=1999420 The fourth one is a bit different because I'm failing to find a path in the code that would allow empty <capability/> for vdpa. Michal Prívozník (3): schemas: Make <type/> for capscsi type optional schemas: Provide grammar for scsi_generic capabilities schemas: Allow <unique_id/> to be zero docs/schemas/nodedev.rng | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) -- 2.32.0

The <type/> element for <capability type='scsi'> part of nodedev XML is optional (see udevProcessSCSIDevice()) and as such might not be formatted into nodedev XML (see virNodeDeviceCapSCSIDefFormat()). Reflect this in our RNG. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/nodedev.rng | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 777227c38a..789b21b8da 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -496,9 +496,11 @@ <ref name="unsignedLong"/> </element> - <element name="type"> - <text/> - </element> + <optional> + <element name="type"> + <text/> + </element> + </optional> </define> <define name="capstorage"> -- 2.32.0

A nodedev can have 'scsi_generic' capabilities but corresponding RNG is missing. Fortunately, it's very simple - there's only one mandatory child element <char/>. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/nodedev.rng | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 789b21b8da..4ad6708b70 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -78,6 +78,7 @@ <ref name="capusbdev"/> <ref name="capusbinterface"/> <ref name="capnet"/> + <ref name="capscsigeneric"/> <ref name="capscsihost"/> <ref name="capscsitarget"/> <ref name="capscsi"/> @@ -421,6 +422,16 @@ </element> </define> + <define name="capscsigeneric"> + <attribute name="type"> + <value>scsi_generic</value> + </attribute> + + <element name='char'> + <text/> + </element> + </define> + <define name="capscsihost"> <attribute name="type"> <value>scsi_host</value> -- 2.32.0

The value of zero is valid <unique_id/> (see virNodeDeviceGetSCSIHostCaps()) but our RNG does not think so. Switching the type to 'unsignedInt' does allow value of zero. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- docs/schemas/nodedev.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 4ad6708b70..e089e66858 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -443,7 +443,7 @@ <optional> <element name="unique_id"> - <ref name="positiveInteger"/> + <ref name="unsignedInt"/> </element> </optional> -- 2.32.0

On a Thursday in 2021, Michal Privoznik wrote:
These three patches address the first three problems raised in
https://bugzilla.redhat.com/show_bug.cgi?id=1999420
The fourth one is a bit different because I'm failing to find a path in the code that would allow empty <capability/> for vdpa.
Michal Prívozník (3): schemas: Make <type/> for capscsi type optional schemas: Provide grammar for scsi_generic capabilities schemas: Allow <unique_id/> to be zero
docs/schemas/nodedev.rng | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Michal Privoznik