16 Commits

Author SHA1 Message Date
YueGuobin
13548deae8
feat: forbid deleting templates and images still used by projects
Deleting a template with prune_images, deleting an image, or pruning
orphan images only checked template references — a project node still
pointing at the image (e.g. via hda_disk_image_backing_file) was left
with a dangling reference and the project could no longer be opened.

- Add controller helpers scanning every known project (opened projects
  via in-memory nodes, closed projects via their .gns3 file) for
  template and image usage; unreadable topologies are skipped
- Guard DELETE /templates/{id}, DELETE /templates/{id}?prune_images,
  DELETE /images/{path} and /images/prune with a 409 listing the
  project names
- Run all template-delete checks before any mutation so a refused
  deletion cannot leave the template gone while its images survive
2026-08-31 22:30:42 +08:00
YueGuobin
8a8314ab29
fix: dedupe and report automatic template creation from images
install_appliances_from_image relied on the name+version pair check in
TemplatesService, so the same appliance reached through a second image
(the CSR1000v case) created a second template sharing the name. The auto
path now skips when any template with the same name exists, whatever the
version, and returns a manifest of created and skipped candidates;
POST /images/install replies 200 with that manifest instead of an empty
204, and the image_install MCP tool surfaces it.
2026-08-26 00:04:57 +08:00
grossmj
4606613673
Fix image handling 2026-03-05 12:38:28 +08:00
grossmj
90cf73e434
Fix tests 2025-04-18 13:38:01 +07:00
grossmj
08693871ae
Support to create templates based on image checksums. 2025-01-03 21:35:14 +07:00
grossmj
ac4c5f5985
Improve tests for pruning images 2025-01-03 19:56:41 +07:00
grossmj
4758431c76
Improvements for built-in disks
* Checksum is updated in the database for updated disks.
* It is not possible to prune them.
2025-01-02 23:10:51 +07:00
grossmj
689d476b71
Fix tests 2024-04-28 18:03:06 +07:00
grossmj
674381f1be Fix tests 2023-09-25 21:08:23 +10:00
grossmj
93449c942f Fix tests 2022-12-22 09:24:17 +08:00
grossmj
9b39bfb845 Detect image type instead of requesting it from user 2022-03-20 16:20:17 +10:00
grossmj
16fcf6141e Fix tests 2021-12-08 00:43:54 +10:30
grossmj
04934691df Appliance management refactoring:
* Install an appliance based on selected version
* Each template have unique name and version
* Allow to download an appliance file
2021-10-18 18:04:30 +10:30
grossmj
d606553e20 Allow images to be stored in subdirs and used by templates. 2021-08-30 16:53:41 +09:30
grossmj
4d9e4e1059 Add prune images endpoint.
Use many-to-many relationship between images and templates.
2021-08-20 15:58:41 +09:30
grossmj
515bd50261 Start refactoring for images management 2021-06-06 16:52:47 +09:30