1<?xml version="1.0"?>
2<!-- Copyright (C) 2022 Intel Corporation. -->
3<!-- SPDX-License-Identifier: BSD-3-Clause -->
4<xs:schema xml:id="root"
5           xmlns:xs="http://www.w3.org/2001/XMLSchema"
6           xmlns:acrn="https://projectacrn.org">
7
8  <xs:assert test="count(/acrn-config/vm[.//load_order = 'SERVICE_VM']) &lt; 2">
9    <xs:annotation acrn:severity="error" acrn:report-on="//vm[.//load_order = 'SERVICE_VM']">
10      <xs:documentation>There may be at most one Service VM, but more than one was configured. Verify only one VM's VM type is set to SERVICE_VM. </xs:documentation>
11    </xs:annotation>
12  </xs:assert>
13
14  <xs:assert test="every $pre_vm in /acrn-config/vm[.//load_order = 'PRE_LAUNCHED_VM'] satisfies
15                   every $svm in /acrn-config/vm[.//load_order = 'SERVICE_VM'] satisfies
16                   $pre_vm/@id &lt; $svm/@id">
17    <xs:annotation acrn:severity="error" acrn:report-on="$pre_vm">
18      <xs:documentation>This pre-launched VM "{$pre_vm/name}" (ID: {$pre_vm/@id}) must have a VM ID value less than the service VM (ID: {$svm/@id}). Adjust the VM ID values to fix this.</xs:documentation>
19    </xs:annotation>
20  </xs:assert>
21
22  <xs:assert test="every $post_vm in /acrn-config/vm[.//load_order = 'POST_LAUNCHED_VM'] satisfies
23                   every $svm in /acrn-config/vm[.//load_order = 'SERVICE_VM'] satisfies
24                   $post_vm/@id &gt; $svm/@id">
25    <xs:annotation acrn:severity="error" acrn:report-on="$post_vm">
26      <xs:documentation>This post-launched VM "{$post_vm/name}" (ID: {$post_vm/@id}) must have a VM ID value greater than the service VM (ID: {$svm/@id}). Adjust the VM ID values to fix this.</xs:documentation>
27    </xs:annotation>
28  </xs:assert>
29
30  <xs:assert test="count(vm[load_order = 'PRE_LAUNCHED_VM' and vm_type = 'RTVM']) &lt;= 1">
31    <xs:annotation acrn:severity="warning" acrn:report-on="//vm[load_order = 'PRE_LAUNCHED_VM']/vm_type[text() = 'RTVM']">
32      <xs:documentation>ACRN supports at most one pre-launched RTVM. Multiple pre-launched VMs {//vm[load_order = 'PRE_LAUNCHED_VM' and vm_type = 'RTVM']/name} are defined as RTVMs. Adjust the VM type of these VMs to Standard to fix this.</xs:documentation>
33    </xs:annotation>
34  </xs:assert>
35
36  <xs:assert test="count(distinct-values(vm[vm_type = 'RTVM']/load_order)) &lt;= 1">
37    <xs:annotation acrn:severity="warning" acrn:report-on="//vm/vm_type[text() = 'RTVM']">
38      <xs:documentation>Pre-launched RTVM(s) {//vm[load_order = 'PRE_LAUNCHED_VM' and vm_type = 'RTVM']/name} and post-launched RTVMs {//vm[load_order = 'POST_LAUNCHED_VM' and vm_type = 'RTVM']/name} may not coexist. Adjust the VM type of these VMs to Standard to fix this.</xs:documentation>
39    </xs:annotation>
40  </xs:assert>
41
42</xs:schema>
43