Bug 254146 - gmirror does not create a mirror or silently truncates its name
Summary: gmirror does not create a mirror or silently truncates its name
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.0-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-08 22:00 UTC by rashey
Modified: 2021-03-09 22:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rashey 2021-03-08 22:00:08 UTC
Issue 1: If a specified providers' names are too long to hardcode in metadata, gmirror does not create a mirror and does not return an error.

# gmirror label -h -b prefer data1 /dev/gpt/a12345678901234567890123456789012345 /dev/gpt/b12345678901234567890123456789012345
# echo $?
0
# gmirror list data1
gmirror: Class 'MIRROR' does not have an instance named 'data1'.

Issue 2: If a specified mirror name is too long, gmirror silently truncates it and does not return an error.

# gmirror label -h -b prefer m12345678901234567890 /dev/gpt/a1234567890 /dev/gpt/b1234567890
# echo $?
0
# gmirror status -s
mirror/m12345678901234  COMPLETE  gpt/a1234567890 (ACTIVE)
mirror/m12345678901234  COMPLETE  gpt/b1234567890 (ACTIVE)

In my case the maximum possible length for the provider name is 11 characters and for the mirror name is 15 characters.
Comment 1 Robert Wing freebsd_committer freebsd_triage 2021-03-09 18:35:39 UTC
(In reply to rashey from comment #0)

issue 1: 

As it is, the hardcoded value has a limit of 15 characters (as limited by the current metadata format)..this restriction extends to the providers name as well (only when hardcoding the name into the metadata though).

At the very least, this restriction should be documented. And maybe gmirror should print an error when hardcoding a providers name that's longer than hardcoded limit.

issue 2:

Similar problem here, the limit for a mirror name is 15 characters, also limited by the current metadata format. That's why the mirror name gets truncated.

This should also be documented. And possibly, gmirror should print error when trying to create mirror with a name longer than the mirror limit?

If there's any input/feedback on how gmirror should behave when encountering issue 1 and 2, would be worth hearing.
Comment 2 rashey 2021-03-09 22:18:56 UTC
(In reply to Robert Wing from comment #1)

I am agree with everything.

Additionally, it should be documented that the restriction also applies to provider type, in my case gpt/ which means 4 characters less for the provider name.

That is why I was unable to hardcode GPT label longer than 11 characters.