Case for Runc

Added error handling for Runc, which does not work in cgroup v2.
Changed numbering of new errors.
This commit is contained in:
lunardunno 2025-03-22 16:07:35 +04:00
parent 106a1646b7
commit 2634af60a4
3 changed files with 5 additions and 1 deletions

View file

@ -467,6 +467,8 @@ ErrorCode ServerController::runContainerWorker(const ServerCredentials &credenti
return ErrorCode::ServerPortAlreadyAllocatedError;
if (stdOut.contains("is already in use by container"))
return ErrorCode::ServerPortAlreadyAllocatedError;
if (stdOut.contains("runc doesn't work on cgroups v2") )
return ErrorCode::ServerRuncNotWorkOnCgroupsV2;
if (stdOut.contains("cgroup mountpoint does not exist"))
return ErrorCode::ServerCgroupMountpointDoesNotExist;
if (stdOut.contains("invalid publish"))

View file

@ -58,7 +58,8 @@ namespace amnezia
ServerUserDirectoryNotAccessible = 208,
ServerUserNotAllowedInSudoers = 209,
ServerUserPasswordRequired = 210,
ServerCgroupMountpointDoesNotExist = 211,
ServerRuncNotWorkOnCgroupsV2 = 211,
ServerCgroupMountpointDoesNotExist = 212,
// Ssh connection errors
SshRequestDeniedError = 300,

View file

@ -26,6 +26,7 @@ QString errorString(ErrorCode code) {
case(ErrorCode::ServerUserDirectoryNotAccessible): errorMessage = QObject::tr("The server user's home directory is not accessible"); break;
case(ErrorCode::ServerUserNotAllowedInSudoers): errorMessage = QObject::tr("Action not allowed in sudoers"); break;
case(ErrorCode::ServerUserPasswordRequired): errorMessage = QObject::tr("The user's password is required"); break;
case(ErrorCode::ServerRuncNotWorkOnCgroupsV2): errorMessage = QObject::tr("Docker error: Runc dosn't work on cgroups v2"); break;
case(ErrorCode::ServerCgroupMountpointDoesNotExist): errorMessage = QObject::tr("Docker error: cgroup mountpoint does not exist"); break;
// Libssh errors