Re: [PATCH v2] misc: add assert for vUART connection


chenli.wei
 

On 5/17/2022 11:12 AM, Junjie Mao wrote:
"chenli.wei" <chenli.wei@...> writes:

The current UI have no live-check to check whether a VM connect to
itself.

So we add an assert to the schema and return error when user connect a
VM to itself.

v1-->v2:
1. change the remind msg format

Signed-off-by: Chenli Wei <chenli.wei@...>
Reviewed-by: Junjie Mao <junjie.mao@...>

One minor comment below.

---
.../config_tools/schema/checks/vuart_config.xsd | 17 +++++++++++++++++
misc/config_tools/schema/datachecks.xsd | 1 +
2 files changed, 18 insertions(+)
create mode 100644 misc/config_tools/schema/checks/vuart_config.xsd

diff --git a/misc/config_tools/schema/checks/vuart_config.xsd b/misc/config_tools/schema/checks/vuart_config.xsd
new file mode 100644
index 000000000..f08d83c13
--- /dev/null
+++ b/misc/config_tools/schema/checks/vuart_config.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2022 Intel Corporation. -->
+<!-- SPDX-License-Identifier: BSD-3-Clause -->
+
+<xs:schema xml:id="root"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:acrn="https://projectacrn.org">
+
+ <xs:assert test="every $vuart_connection in /acrn-config//vuart_connection satisfies
+ every $vm_name in $vuart_connection/endpoint/vm_name/text() satisfies
+ count($vuart_connection/endpoint[./vm_name/text()=$vm_name]) = 1">
+ <xs:annotation acrn:severity="error" acrn:report-on="$vuart_connection/endpoint">
+ <xs:documentation>"{$vm_name}" can't connected to itself</xs:documentation>
Add "VM" before "{$vm_name}" to say explicitly that it is a VM.
Done

Join {acrn-dev@lists.projectacrn.org to automatically receive all group messages.