"sev-guest" option was added to the 9.0 machines. So, the script has to
be able to get default values of properties of this type.
Unfortunatelly, some default values are set during instance
initialization but not during class initialization. Thus, they can't be
easily accessed.
Based on the above, "qom-list-properties" command was choosen for getting
default values, but now it always returns nothing usefull. Maybe, in the
future we will have a more appropriate command for "sev-guest".
Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
---
scripts/compare-machine-types.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/scripts/compare-machine-types.py b/scripts/compare-machine-types.py
index 2af3995eb8..dba9e03548 100755
--- a/scripts/compare-machine-types.py
+++ b/scripts/compare-machine-types.py
@@ -154,6 +154,26 @@ def get_prop(self, driver: str, prop_name: str) -> str:
return 'Unknown property'
+# A stub to print default values of all types whose parent is
+# 'confidential-guest-support'. Some properties have default values
+# but can't be accessed without an instance initialization (e.g.
+# "policy" of "sev-snp-guest").
+class QEMUConfidentialGuestSupport(QEMUObject):
+ def __init__(self, vm: QEMUMachine) -> None:
+ super().__init__(vm, 'confidential-guest-support')
+ self.cached: Dict[str, List[Dict[str, Any]]] = {}
+
+ def get_prop(self, driver: str, prop_name: str) -> str:
+ if driver not in self.cached:
+ self.cached[driver] = self.vm.cmd('qom-list-properties',
+ typename=driver)
+ for prop in self.cached[driver]:
+ if prop['name'] == prop_name:
+ return str(prop.get('default-value', 'No default value'))
+
+ return 'Unknown property'
+
+
def new_driver(vm: QEMUMachine, name: str, is_abstr: bool) -> Driver:
if name == 'object':
return QEMUObject(vm, 'object')
@@ -163,6 +183,8 @@ def new_driver(vm: QEMUMachine, name: str, is_abstr: bool) -> Driver:
return QEMUx86CPU(vm)
elif name == 'memory-backend':
return QEMUMemoryBackend(vm)
+ elif name == 'confidential-guest-support':
+ return QEMUConfidentialGuestSupport(vm)
else:
return Driver(vm, name, is_abstr)
# End of methods definition
--
2.34.1
On 23.10.25 19:58, Maksim Davydov wrote: > "sev-guest" option was added to the 9.0 machines. So, the script has to > be able to get default values of properties of this type. > Unfortunatelly, some default values are set during instance > initialization but not during class initialization. Thus, they can't be > easily accessed. > > Based on the above, "qom-list-properties" command was choosen for getting > default values, but now it always returns nothing usefull. Maybe, in the > future we will have a more appropriate command for "sev-guest". > > Signed-off-by: Maksim Davydov<davydov-max@yandex-team.ru> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> -- Best regards, Vladimir
© 2016 - 2025 Red Hat, Inc.