[Devel] [PATCH VZ10 v4 0/3] Improvements for ve selftests

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 25 15:47:01 MSK 2026


This change adds helpers for creating and preserving various
namespaces and running functions inside them.
This appeared useful while implementing ve mount accounting
selftests - it required keeping mount namespace alive and
doing different things at different moments of time.

To make setns work with CLONE_NEWVE without starting VE,
the first patch changes the -EINVAL return to a warning message.

https://virtuozzo.atlassian.net/browse/VSTOR-144504

Feature: ve selftests

Changes in v4:
- Moved the ve_namespace patch to the front, before the selftest
  helpers that rely on it.
- ve_namespace: the warning follows the "CT: %s:" format of other
  ve.c messages and prints the VE state and the offender's comm/pid;
  the commit message now explains why the warning is kept.
- namespace management helpers: prepare_namespaces() leaves ctx
  empty on any failure (mask zeroed on entry, saved fds closed on
  error), so unconditional cleanup in callers is safe; fixed a
  comment typo.
- more helpers: dropped a stray blank line in run_in_ve().
- Collected Reviewed-by tags.
- Link to v3: http://lore.virtuozzo.com/20260909-ve-selftest-improv-v3-0-4b41980d9a45@virtuozzo.com

Changes in v3:
- Patch 1: wrap flag -> (flag) in macros, undef them after use.
- Patch 2: Fix comments in run_in_ve function.
- Link to v2: http://lore.virtuozzo.com/20260909-ve-selftest-improv-v2-0-aad0a25d6569@virtuozzo.com

Changes in v2:
- Patch 1: fixed JOIN_NS order in enter_namespaces, added proper
  cleanup in prepare_namespaces.
- Patch 2: increased buf size in write_u64_at, added range check in
  read_s32_at, separated setup failures in run_in_ve from fn setup
  failures.
- Patch 3: Removed kselftests mention.
- Link to v1: http://lore.virtuozzo.com/20260907-ve-selftest-improv-v1-0-a17847abbd48@virtuozzo.com

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
Vladimir Riabchun (3):
      ve_namespace: Allow entering non-running VE namespace
      selftests/ve: Add namespace management helpers
      selftests/ve: Add more helpers

 kernel/ve/ve_namespace.c                 |   4 +-
 tools/testing/selftests/ve/ve_selftest.h | 214 ++++++++++++++++++++++++++++++-
 2 files changed, 210 insertions(+), 8 deletions(-)
---
base-commit: f7ba712715849bef1a54e1f13fab79b094ccc0df
change-id: 20260907-ve-selftest-improv-2d043d021cae

Best regards,
--  
Konstantin Khorenko <khorenko at virtuozzo.com>



More information about the Devel mailing list