Skip to content

No route for a group's VDI config (start.conf.<group>.vdi) #38

Description

@TomlDev

A group's VDI settings live in /srv/linbo/start.conf.<group>.vdi, and no route reads or writes it. linuxmuster-webui7 has both:

@get(r'/api/lmn/linbo4/vdi/(?P<name>.+)')
def handle_api_get_vdi_image(self, http_context, name=None):
    path = os.path.join(self.LINBO_PATH, name)
    if os.path.exists(path):
        with LMNFile(path, 'r') as settings:
            vdiSettings = settings.read()
    else:
        vdiSettings = None
    return vdiSettings

@post(r'/api/lmn/linbo4/vdi/(?P<name>.+)')
def handle_api_post_vdi_image(self, http_context, name=None):
    path = os.path.join(self.LINBO_PATH, name)
    if os.path.exists(path):
        data = http_context.json_body()
        with open(path, 'w') as settings:
            json.dump(data, settings, indent=4)
        os.chmod(path, 0o755)

That is what backs the third tab of the group editor — the one that shows VM name, BIOS type, OS type, hostname, IP, MAC, bridge, cores, memory, disk size, storage pool and the reserved VMIDs. The tab is hidden when the file is absent (ng:hide="vdiconfig == null").

GET /v1/vdi/groups returns a subset of the same data — activated, ostype, cores, memory, minimum_vms, maximum_vms, prestarted_vms — but it reads through edulution_linbo_vdi.device_store, is read-only, and does not carry the network or storage fields.

LMNFile already handles the format: ConfigLoader claims .yml and .vdi, and lmnfile.py deliberately excludes *.vdi from the start.conf handler, so the file is recognised as its own kind.

Suggestion

GET /v1/linbo/startconfs/{group_id}/vdi     -> the parsed config, 404 if absent
PUT /v1/linbo/startconfs/{group_id}/vdi     -> write it

Two details worth deciding rather than inheriting:

  • webui7's POST writes only if os.path.exists(path) and returns nothing when the file is missing, so a VDI config cannot be created through the UI and a failed write is silent. A PUT that creates the file, or an explicit 404, would be an improvement over the current behaviour.
  • webui7 writes json.dump(...) while reading through the YAML loader. JSON is valid YAML, so this works, but writing the same format it reads would be tidier.

We are building the LINBO group editor in edulution-ui and this is the one tab we cannot implement. Happy to prepare the PR if the shape is right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions