Skip to content

incus: Add checks before starting sshSFTPserver#2974

Merged
stgraber merged 3 commits intolxc:mainfrom
J0nasDotDev:add-file-mount-checks
Feb 26, 2026
Merged

incus: Add checks before starting sshSFTPserver#2974
stgraber merged 3 commits intolxc:mainfrom
J0nasDotDev:add-file-mount-checks

Conversation

@J0nasDotDev
Copy link
Copy Markdown
Contributor

@J0nasDotDev J0nasDotDev commented Feb 25, 2026

Summary

Fix incus file mount and incus storage volume file mount in SSH SFTP listener mode to fail early when the entity (instance, storage pool, or storage volume) does not exist.
Previously, these commands could start the listener process even non-existent entities, resulting in confusing runtime behavior.

Resolves: #2944

Description

The sshSFTPServer doesn't require the entity directly as a parameter, they are used indirectly through the sftpConn lambda function.

These changes try to get the entity before calling sshSFTPServer and fail early if the entity does not exist.

Note: sftpConn is only called after an SSH connection, and sshSFTPServer doesn't return an error if sftpConn fails.

I also updated the help texts to clarify the listener behavior when the target path is omitted.

Behavior after changes

> incus file mount xxxxxx
Error: Failed to fetch instance "xxxxxx" in project "default": Instance not found
> incus storage volume file mount xxxxxx yyyyyy
Error: Storage pool not found
> incus storage volume file mount default yyyyyy
Error: Storage pool volume not found 

@J0nasDotDev J0nasDotDev force-pushed the add-file-mount-checks branch 2 times, most recently from 3609937 to 6335141 Compare February 25, 2026 17:11
@J0nasDotDev J0nasDotDev marked this pull request as ready for review February 25, 2026 17:33
@J0nasDotDev J0nasDotDev marked this pull request as draft February 25, 2026 18:59
@J0nasDotDev J0nasDotDev marked this pull request as ready for review February 25, 2026 19:34
@J0nasDotDev J0nasDotDev marked this pull request as draft February 25, 2026 19:51
@J0nasDotDev J0nasDotDev force-pushed the add-file-mount-checks branch from 41d7f7a to 64bfdc2 Compare February 25, 2026 19:53
@J0nasDotDev J0nasDotDev marked this pull request as ready for review February 25, 2026 20:46
@J0nasDotDev
Copy link
Copy Markdown
Contributor Author

@stgraber FYI, I updated the translation templates 64bfdc2, so normally the CI should pass.

@stgraber stgraber force-pushed the add-file-mount-checks branch from 64bfdc2 to bdd4811 Compare February 26, 2026 01:22
@stgraber stgraber changed the title cmd/incus: Add checks before starting sshSFTPserver incus: Add checks before starting sshSFTPserver Feb 26, 2026
@stgraber stgraber merged commit 6d1bb85 into lxc:main Feb 26, 2026
54 of 56 checks passed
@J0nasDotDev J0nasDotDev deleted the add-file-mount-checks branch March 19, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

incus file mount and incus storage volume file mount don’t perform enough checks

2 participants