mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-05 23:01:15 +02:00
appliance: close the v8 gaps for Docker vendor appliances
DockerPropertiesV8 now accepts custom_adapters (already available to v1-6 top-level appliances and to Qemu v8 properties), so port-named Docker appliances (XRd, SR Linux) can move to the v8 format without losing their interface naming. Appliance.type resolves the node type from the v8 settings template_type (default set first) instead of misclassifying every v8 appliance as qemu, and _get_default_symbol applies the docker guest symbol to v8 Docker guest appliances.
This commit is contained in:
4 files changed
+149
-1
No files matched your search
@@ -71,6 +71,17 @@ class Appliance:
|
||||
@property
|
||||
def type(self):
|
||||
|
||||
if self._data.get("registry_version", 0) >= 8:
|
||||
# registry version 8: the node type comes from the settings template_type,
|
||||
# the default settings take precedence over the other sets
|
||||
settings_list = self._data.get("settings") or []
|
||||
for settings in settings_list:
|
||||
if settings.get("default"):
|
||||
return settings.get("template_type", "qemu")
|
||||
if settings_list:
|
||||
return settings_list[0].get("template_type", "qemu")
|
||||
return "qemu"
|
||||
|
||||
if "iou" in self._data:
|
||||
return "iou"
|
||||
elif "dynamips" in self._data:
|
||||
|
||||
@@ -362,7 +362,14 @@ class ApplianceManager:
|
||||
symbol_theme = controller.symbols.theme
|
||||
category = appliance["category"]
|
||||
if category == "guest":
|
||||
if "docker" in appliance:
|
||||
if appliance.get("registry_version", 0) >= 8:
|
||||
# registry version 8: look for a Docker settings set instead of a top-level block
|
||||
settings_types = [
|
||||
settings.get("template_type") for settings in appliance.get("settings") or []
|
||||
]
|
||||
if "docker" in settings_types:
|
||||
return controller.symbols.get_default_symbol("docker_guest", symbol_theme)
|
||||
elif "docker" in appliance:
|
||||
return controller.symbols.get_default_symbol("docker_guest", symbol_theme)
|
||||
elif "qemu" in appliance:
|
||||
return controller.symbols.get_default_symbol("qemu_guest", symbol_theme)
|
||||
|
||||
@@ -481,6 +481,7 @@ class DockerPropertiesV8(BaseModel):
|
||||
extra_volumes: Optional[List[str]] = Field(
|
||||
None, title='Additional directories to make persistent'
|
||||
)
|
||||
custom_adapters: Optional[List[CustomAdapterItem]] = Field(None, title='Custom adapters')
|
||||
extra_configs: Optional[List[ExtraConfig]] = Field(
|
||||
None, title='Configuration files injected into the container (bind-mounted read-only)'
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user