use multipass compatible instance names
Metadata
Current evaluation
Fixed by merged PR #712, which normalizes Multipass instance names using LXD-compatible hostname validation and truncation.
Resolution: closed resolved
Reason: PR #712, titled "fix: use Multipass-compatible instance names," merged and explicitly resolves #226. It reuses LXD's validation logic to ensure Multipass names are valid and remain consistent with their 63-character hostname truncation.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Overview
Craft-providers should ensure that Multipass instance names are compliant with Multipass's naming convention before creating an instance.
### Details
Multipass's naming conventions are simple. If it's a valid hostname, then it is a valid Multipass instance name. There is no maximum length.
See Multipass [source](https://github.com/canonical/multipass/blob/0c58deb74c38bfc364311cae38b4b14b3646fec9/src/utils/utils.cpp#L190-L195):
```cpp
bool mp::utils::valid_hostname(const std::string& name_string)
{
QRegExp matcher("^([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\\-]*[a-zA-Z0-9])");
return matcher.exactMatch(QString::fromStdString(name_string));
}
```
The hostname of multipass will be truncated to the first 63 characters of the name. Craft-providers should truncate the name so the hostname will match.
### Related
LXD has stricter naming restrictions (primarily a 63 character maximum). Craft-providers>=1.4 ensured LXD instance names were compliant with [this PR](https://github.com/canonical/craft-providers/pull/134).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #712, which normalizes Multipass instance names using LXD-compatible hostname validation and truncation. | |
| qwen/qwen3.6-35b-a3b | — | closed resolved | Fixed in craft-providers#712 by normalizing Multipass instance names to comply with Multipass's hostname naming convention, reusing LXD's validation logic. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
craft-providers#712
(confidence 100%)
Merged PR implementing Multipass-compatible instance-name normalization.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #712 fix: use Multipass-compatible instance names | craft-providers | merged | Merged PR #712 as commit e52ea2d, normalizing Multipass instance names with LXD-compatible logic to fix #226 and unblock charmcraft#2058. | |
| #930 fix multipass list instances not listing by instance name | craft-providers | merged | Merged PR #930 fixed Multipass instance listing so instances could be found correctly by instance name. | |
| #1767077 Container names are inconsistent lxd vs multipass | snapcraft (launchpad) | open | LXD and Multipass now use the same snapcraft-prefixed build instance name; the old mismatch could not be reproduced and appears resolved by the shared provider naming path. |