From 2165efe72fc817ff71598d26c6a5a4a889a61928 Mon Sep 17 00:00:00 2001 From: Kunhui-Li Date: Wed, 15 Jun 2022 16:42:03 +0800 Subject: [PATCH] config_tools: fix the issue Service VM type is updated by UI automatically Currently, if I update Pre-Launched VM type to real-time, select PCPU ID and enable Real-time vCPU, then we update the name of sevice VM, finally, click the save button. we will see the type of service vm is updated to RTVM. It is unexpected. So this patch removes the logic of hiding service VM type, and only allows user selecting Standard VM type to fix the issue that the service vm type is updated by UI automatically. Tracked-On: #6690 Signed-off-by: Kunhui-Li --- .../packages/configurator/src/pages/Config.vue | 10 ---------- .../scenario_config/jsonschema/converter.py | 10 +++++++--- misc/config_tools/schema/VMtypes.xsd | 6 +++--- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue index bc3748b04..6d624859e 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue @@ -214,16 +214,6 @@ export default { this.currentFormData = this.scenario.vm[i] } } - if (this.currentFormData['load_order'] === 'SERVICE_VM') { - if (this.currentFormData.hasOwnProperty('vm_type')) { - delete this.schemas.ServiceVM.BasicConfigType.properties.vm_type - } else { - if (this.schemas.ServiceVM.BasicConfigType.properties.hasOwnProperty('vm_type') === false) { - this.schemas.ServiceVM.BasicConfigType.properties.vm_type = - {$ref: '#/definitions/BasicVMType', title: 'VM type', description: '

Select the VM type. A standard VM ('} - } - } - } }, switchTab(tabVMID) { this.activeVMID = tabVMID; diff --git a/misc/config_tools/scenario_config/jsonschema/converter.py b/misc/config_tools/scenario_config/jsonschema/converter.py index 8274c1bf0..47417b82a 100644 --- a/misc/config_tools/scenario_config/jsonschema/converter.py +++ b/misc/config_tools/scenario_config/jsonschema/converter.py @@ -189,15 +189,19 @@ class XS2JS: if 'xs:enumeration' in restriction: type_func = {"string": str, "integer": int}.get(js_st['type'], str) # enum + enum_elements = restriction['xs:enumeration'] + if not isinstance(enum_elements, list): + enum_elements = [enum_elements] + enum = [] - for enum_element in restriction['xs:enumeration']: + for enum_element in enum_elements: enum.append(type_func(enum_element['@value'])) js_st["enum"] = enum # enumNames - if enum and '@acrn:title' in restriction['xs:enumeration'][0].get('xs:annotation', {}): + if enum and '@acrn:title' in enum_elements[0].get('xs:annotation', {}): enum_names = [] - for enum_element in restriction['xs:enumeration']: + for enum_element in enum_elements: if 'xs:annotation' in enum_element and '@acrn:title' in enum_element.get('xs:annotation', {}): enum_names.append(enum_element['xs:annotation']['@acrn:title']) else: diff --git a/misc/config_tools/schema/VMtypes.xsd b/misc/config_tools/schema/VMtypes.xsd index 5caedefb6..e7feb48c0 100644 --- a/misc/config_tools/schema/VMtypes.xsd +++ b/misc/config_tools/schema/VMtypes.xsd @@ -22,13 +22,13 @@ Current supported VM types are: -- ``Real-time`` for time-sensitive applications. +- ``Real-time`` for time-sensitive applications (not applicable to the service VM). - ``Standard`` for general-purpose applications, such as human-machine interface (HMI). - - + +