Skip to content

Conversation

@rlmenge
Copy link
Contributor

@rlmenge rlmenge commented Nov 6, 2025

Description

This PR adds a comprehensive test suite for dm-cache functionality on Azure VMs, along with 11 new LISA tools for managing LVM and device mapper resources. This is a setup and integration test - it verifies dm-cache can be configured correctly and is operational, but it doesn't benchmark performance or stress-test the caching behavior.

This test verifies dm-cache by checking the module is loadable and then checking functionality by:

  1. Creating loopback devices to simulate slow origin and fast cache disks
  2. Setting up LVM physical volumes and volume groups
  3. Creating logical volumes for origin and cache pool
  4. Attaching cache pool to origin LV to enable caching
  5. Formatting and mounting the cached logical volume
  6. Verifying the dm-cache setup is working correctly

The test validates:
✅ Kernel support: dm-cache module loads
✅ Correct architecture: Cache on fast device, origin on slow device
✅ Cache attachment: LV has cache layout, not just plain linear
✅ Policy configuration: A valid cache policy (smq/mq/cleaner) is active
✅ Functional I/O: Can format, mount, and use the cached volume
✅ Device mapper integration: dmsetup can query cache status and configuration

What It's NOT Testing
❌ Performance: Doesn't measure if cache actually improves speed
❌ Cache hits/misses: Doesn't verify cache is being used for reads/writes
❌ Data integrity: Doesn't write/read specific data patterns
❌ Different cache modes: Only tests default mode (not explicitly testing writethrough vs writeback)

Test Suite
[dmcache.py]

  • Validates dm-cache setup and basic functionality on CBL Mariner/Azure Linux VMs
  • Creates loopback devices to simulate slow origin and fast cache disks
  • Sets up complete LVM stack (PVs, VGs, LVs) with cache-enabled logical volumes
  • Verifies cache policy configuration (smq/mq/cleaner)
  • Tests filesystem operations on cached volumes (format, mount, verify)
  • Includes comprehensive cleanup in finally block

New Tools Added
LVM Physical Volume Management

  • [losetup.py] - Loopback device management
  • [pvcreate.py] - Create LVM physical volumes
  • [pvremove.py]- Remove LVM physical volumes

LVM Volume Group Management

  • [vgcreate.py] - Create LVM volume groups
  • [vgremove.py]- Remove LVM volume groups
  • [vgs.py]- Query volume group information and status

LVM Logical Volume Management

  • [lvcreate.py] - Create logical volumes with support for cache pools
  • [lvremove.py]- Remove logical volumes
  • [lvconvert.py] - Attach cache pools to origin LVs
  • [lvs.py] - Query logical volume information and cache layout

Device Mapper Management

  • [dmsetup.py]- Query device mapper devices

Testing

Tested on local AzL3 VM running in hyperv
Test will PASS if the module is available and can be loaded or is already loaded
Test will SKIP if the module is unavailable
Test will fail if the the logical volumes cannot be created correctly or the policy is not correct

Dependencies

  • LVM2 tools (pvcreate, vgcreate, lvcreate, lvconvert, lvs, vgs, lvremove, vgremove, pvremove)
  • device-mapper utilities (dmsetup)
  • util-linux (losetup)

@rlmenge rlmenge marked this pull request as ready for review November 6, 2025 18:32
@rlmenge rlmenge requested a review from LiliDeng as a code owner November 6, 2025 18:32
@rlmenge rlmenge force-pushed the rlmenge/dmcache-rebase branch from bb462fc to 5b23a7b Compare November 6, 2025 22:37
@squirrelsc
Copy link
Member

@LiliDeng LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants