config_tools: add assertions for virtio gpu

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.

Tracked-On: #7970
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Kunhui-Li 2022-08-17 14:30:02 +08:00 committed by acrnsi-robot
parent ad17268c5e
commit 7c18e26044

View File

@ -14,4 +14,65 @@
</xs:annotation> </xs:annotation>
</xs:assert> </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(//gpu[display_type = 'Full screen']//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) &lt; 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) &lt; 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> </xs:schema>