Commit 1829c873 authored by Bernd Lietzow's avatar Bernd Lietzow

Merge branch 'addmirrorgroup-errors-v6' into 'v6'

ctl: improve error message for meta buddy group add failures

See merge request beegfs/projects0!836
parents a69b992e a9b44fdc
......@@ -229,7 +229,14 @@ int ModeAddMirrorBuddyGroup::execute()
else
{
auto addRes = addGroup(cfgPrimaryTargetID, cfgSecondaryTargetID, cfgGroupID);
if (addRes != FhgfsOpsErr_SUCCESS)
if (addRes == FhgfsOpsErr_NOTOWNER && nodeType == NODETYPE_Meta)
{
std::cerr << "Could not add buddy group: new group would own the root inode, but the root\n"
"inode is owned by the secondary of the new group. Only the primary of a\n"
"new group may own the root inode; try switching primary and secondary.\n";
return APPCODE_RUNTIME_ERROR;
}
else if (addRes != FhgfsOpsErr_SUCCESS)
{
std::cerr << "Could not add buddy group: " << FhgfsOpsErrTk::toErrString(addRes) << "\n";
retVal = APPCODE_RUNTIME_ERROR;
......
on main do
root_owner = (shell "#{$binaries[:ctl]} --getentryinfo --unmounted / \
| grep -P --only-matching '(?<=\\[ID: )\\d+'")[:stdout].strip
buddy = root_owner == "1" ? "2" : "1"
res = {}
shell? "sudo #{$binaries[:ctl]} --addmirrorgroup --nodetype=meta \
--primary=#{buddy} --secondary=#{root_owner}", status: res
raise if res[:return] == 0
raise if res[:stderr].index('try switching').nil?
shell "sudo #{$binaries[:ctl]} --addmirrorgroup --nodetype=meta \
--secondary=#{buddy} --primary=#{root_owner}"
end
hosts:
main:
- mgmtd
- meta
- meta
- storage
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment