Date
1 - 2 of 2
[PATCH v5 5/5] config_tools: add assertions for virtio gpu
Yang, Yu-chu
From: Kunhui-Li <kunhuix.li@...>
1. In the full screen mode, a VM supports 4 virtual displays at most. 2. A vm supports 2 virtual windows at most. 3. The monitor ID cannot be duplicated in the full screen mode. 4. All the display elements are in DisplayConfiguration of VMType.xsd. It cannot be set as required. Using assertions to check if the sub-elements are set for any type of virtual display accordingly. - check if a display has been added and a display type is set. - check if monitor ID is set for full screen virtual display. - check if resolution and offsets are set for window virtual display. v4->v5 1. add explicit description of how to fix the error. 2. refine the assertion statement of monitor_id cannot be duplicated. 3. All the display elements are in DisplayConfiguration of VMType.xsd. It cannot be set as required. Using assertions to check if the sub-elements are set for any type of virtual display accordingly. - check if monitor ID is set for full screen virtual display. - check if resolution and offsets are set for window virtual display. - check if a display has been added and a display type is set. Tracked-On: #7970 Signed-off-by: Kunhui-Li <kunhuix.li@...> Signed-off-by: Yang,Yu-chu <yu-chu.yang@...> --- .../schema/checks/virtio_devices.xsd | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/misc/config_tools/schema/checks/virtio_devices.xsd b/misc/config_tools/schema/checks/virtio_devices.xsd index b7eac7d45..18ac4c5d1 100644 --- a/misc/config_tools/schema/checks/virtio_devices.xsd +++ b/misc/config_tools/schema/checks/virtio_devices.xsd @@ -14,4 +14,81 @@ </xs:annotation> </xs:assert> + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices] satisfies + $vm/virtio_devices/gpu/display_type + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>Add at least one virtual diaply in virtIO GPU device of VM "{$vm/name}".</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices] satisfies + $vm/virtio_devices/gpu/display_type/text() != '' + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>Select a display type of VM "{$vm/name}".</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices/gpu[display_type = 'Full screen']] satisfies + $vm/virtio_devices/gpu/displays/display/monitor_id/text() != '' + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}": monitor ID is required for "full screen" virtual display.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices/gpu[display_type = 'Window']] satisfies + $vm/virtio_devices/gpu/displays/display/window_resolutions/text() != '' + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}": window resolution is required for "window" virtual display.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices/gpu[display_type = 'Window']] satisfies + $vm/virtio_devices/gpu/displays/display/horizontal_offset/text() != '' + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}": horizontal offset (pixels) is required for "window" virtual displays.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices/gpu[display_type = 'Window']] satisfies + $vm/virtio_devices/gpu/displays/display/vertical_offset/text() != '' + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}" support 2 virtual windows at most. +Remove some of the virtual displays so that the total number does not exceed that limit.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm[./virtio_devices/gpu[display_type = 'Full screen']] satisfies + every $monitor_id in $vm/virtio_devices/gpu/displays/display/monitor_id satisfies + count($vm//monitor_id[./text()=$monitor_id]) = 1 + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>The monitor id "{$monitor_id}" has been assigned multiple times to VM "{$vm/name}". +Choose a different monitor id or remove some of the virtual displays which have the same monitor id.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm satisfies + count($vm/virtio_devices/gpu[display_type = 'Full screen']/displays/display) < 5 + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}" support 4 virtual displays at most in the full screen mode. +Remove some of the virtual displays so that the total number does not exceed that limit.</xs:documentation> + </xs:annotation> + </xs:assert> + + <xs:assert test="every $vm in /acrn-config/vm satisfies + count($vm/virtio_devices/gpu[display_type = 'Window']/displays/display) < 3 + "> + <xs:annotation acrn:severity="error" acrn:report-on="$vm"> + <xs:documentation>VM "{$vm/name}" support 2 virtual windows at most. +Remove some of the virtual displays so that the total number does not exceed that limit.</xs:documentation> + </xs:annotation> + </xs:assert> + </xs:schema> -- 2.25.1
|
|
Junjie Mao
toggle quoted messageShow quoted text
-----Original Message-----Since you only care about virtio-gpu, you may want to iterate over VM nodes that only with a ./virtio_devices/gpu node, as that node is not mandatory for all VMs. + $vm/virtio_devices/gpu/display_typeThe error message does not look consistent with the assertion. Also the presence of a virtio_devices/gpu node already requires a display_type node which is not attributed with minOccurs="0" in your schema. So the assertion above looks redundant to me. +Ditto, as the content of display_type is already constrained by the enumeration type in the schema. Assertions are meant to enhance the schema, not to duplicate what the schema has already specified. + <xs:annotation acrn:severity="error" acrn:report-on="$vm">Since monitor_id is used in fullscreen mode, should the assertion count the occurrences of the same monitor ID throughout all VMs instead? --- Best Regards Junjie Mao + ">
|
|