From 72e3d8f0c1106dc5fa297bbd707000f606d8c192 Mon Sep 17 00:00:00 2001 From: grossmj Date: Thu, 5 Jan 2023 12:57:00 +0800 Subject: [PATCH] Fix tests after merge --- gns3server/controller/__init__.py | 4 ++-- gns3server/db/models/templates.py | 1 + gns3server/schemas/compute/qemu_nodes.py | 1 + gns3server/schemas/controller/templates/qemu_templates.py | 1 + tests/controller/test_controller.py | 5 ++--- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index a3e5fad3..81a7ed29 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -288,9 +288,9 @@ class Controller: except OSError as e: log.error(f"Cannot read Etag appliance file '{etag_appliances_path}': {e}") - # FIXME + # FIXME install builtin appliances only once, need to store "version" somewhere... #if parse_version(__version__) > parse_version(controller_settings.get("version", "")): - # self._appliance_manager.install_builtin_appliances() + # self._appliance_manager.install_builtin_appliances() self._appliance_manager.install_builtin_appliances() self._appliance_manager.load_appliances() diff --git a/gns3server/db/models/templates.py b/gns3server/db/models/templates.py index 3086a15c..05f09d13 100644 --- a/gns3server/db/models/templates.py +++ b/gns3server/db/models/templates.py @@ -203,6 +203,7 @@ class QemuTemplate(Template): kernel_command_line = Column(String) replicate_network_connection_state = Column(Boolean) create_config_disk = Column(Boolean) + tpm = Column(Boolean) on_close = Column(String) cpu_throttling = Column(Integer) process_priority = Column(String) diff --git a/gns3server/schemas/compute/qemu_nodes.py b/gns3server/schemas/compute/qemu_nodes.py index 3a10fe8b..45822437 100644 --- a/gns3server/schemas/compute/qemu_nodes.py +++ b/gns3server/schemas/compute/qemu_nodes.py @@ -205,6 +205,7 @@ class QemuBase(BaseModel): create_config_disk: Optional[bool] = Field( None, description="Automatically create a config disk on HDD disk interface (secondary slave)" ) + tpm: Optional[bool] = Field(None, description="Enable Trusted Platform Module (TPM)") on_close: Optional[QemuOnCloseAction] = Field(None, description="Action to execute on the VM is closed") cpu_throttling: Optional[int] = Field(None, ge=0, le=800, description="Percentage of CPU allowed for QEMU") process_priority: Optional[QemuProcessPriority] = Field(None, description="Process priority for QEMU") diff --git a/gns3server/schemas/controller/templates/qemu_templates.py b/gns3server/schemas/controller/templates/qemu_templates.py index 2de491e1..d872cb42 100644 --- a/gns3server/schemas/controller/templates/qemu_templates.py +++ b/gns3server/schemas/controller/templates/qemu_templates.py @@ -80,6 +80,7 @@ class QemuTemplate(TemplateBase): create_config_disk: Optional[bool] = Field( False, description="Automatically create a config disk on HDD disk interface (secondary slave)" ) + tpm: Optional[bool] = Field(False, description="Enable Trusted Platform Module (TPM)") on_close: Optional[QemuOnCloseAction] = Field("power_off", description="Action to execute on the VM is closed") cpu_throttling: Optional[int] = Field(0, ge=0, le=800, description="Percentage of CPU allowed for QEMU") process_priority: Optional[QemuProcessPriority] = Field("normal", description="Process priority for QEMU") diff --git a/tests/controller/test_controller.py b/tests/controller/test_controller.py index 45b1ce6c..885965e9 100644 --- a/tests/controller/test_controller.py +++ b/tests/controller/test_controller.py @@ -379,10 +379,9 @@ def test_appliances(controller, config, tmpdir): with open(str(tmpdir / "my_appliance2.gns3a"), 'w+') as f: json.dump(my_appliance, f) - #config.settings.Server.appliances_path = str(tmpdir) + config.settings.Server.appliances_path = str(tmpdir) controller.appliance_manager.install_builtin_appliances() - with patch("gns3server.config.Config.get_section_config", return_value={"appliances_path": str(tmpdir)}): - controller.appliance_manager.load_appliances() + controller.appliance_manager.load_appliances() assert len(controller.appliance_manager.appliances) > 0 for appliance in controller.appliance_manager.appliances.values(): assert appliance.asdict()["status"] != "broken"