@@ -301,6 +301,19 @@ var cephVolumeRawPartitionTestResult = `{
301301 }
302302}`
303303
304+ // ceph-volume raw list reports the device via an LVM symlink (/dev/rhel/ceph-data)
305+ // while the inventory RealPath is /dev/mapper/rhel-ceph--data.
306+ var cephVolumeRAWLVMSymlinkTestResult = `{
307+ "0": {
308+ "ceph_fsid": "4bfe8b72-5e69-4330-b6c0-4d914db8ab89",
309+ "device": "/dev/rhel/ceph-data",
310+ "osd_id": 0,
311+ "osd_uuid": "c03d7353-96e5-4a41-98de-830dfff97d06",
312+ "type": "bluestore"
313+ }
314+ }
315+ `
316+
304317func createPVCAvailableDevices () * DeviceOsdMapping {
305318 devices := & DeviceOsdMapping {
306319 Entries : map [string ]* DeviceOsdIDEntry {
@@ -2282,4 +2295,35 @@ func TestWipeDevicesFromOtherClusters(t *testing.T) {
22822295 context .Executor = executor
22832296 err = agent .WipeDevicesFromOtherClusters (context )
22842297 assert .NoError (t , err )
2298+
2299+ // `ceph-volume raw list` returns an LVM symlink path (/dev/rhel/ceph-data) while
2300+ // the device RealPath is /dev/mapper/rhel-ceph--data. The device should still be
2301+ // matched via DevLinks and zapped.
2302+ executor .MockExecuteCommandWithOutput = func (command string , args ... string ) (string , error ) {
2303+ logger .Infof ("%s %v" , command , args )
2304+ if slices .Contains (args , "raw" ) && slices .Contains (args , "list" ) {
2305+ return cephVolumeRAWLVMSymlinkTestResult , nil
2306+ }
2307+ return "" , errors .Errorf ("unknown command %s %s" , command , args )
2308+ }
2309+ executor .MockExecuteCommandWithCombinedOutput = func (command string , args ... string ) (string , error ) {
2310+ logger .Infof ("%s %v" , command , args )
2311+ devicePath := "/dev/mapper/rhel-ceph--data"
2312+ if slices .Contains (args , "zap" ) {
2313+ if ! slices .Contains (args , devicePath ) {
2314+ return "" , errors .Errorf ("expected device %s to be zapped but got %v" , devicePath , args )
2315+ }
2316+ return "" , nil
2317+ }
2318+ return "" , errors .Errorf ("unknown command %s %s" , command , args )
2319+ }
2320+ context = & clusterd.Context {
2321+ Devices : []* sys.LocalDisk {{
2322+ RealPath : "/dev/mapper/rhel-ceph--data" ,
2323+ DevLinks : "/dev/rhel/ceph-data /dev/disk/by-id/dm-name-rhel-ceph--data /dev/mapper/rhel-ceph--data" ,
2324+ }},
2325+ }
2326+ context .Executor = executor
2327+ err = agent .WipeDevicesFromOtherClusters (context )
2328+ assert .NoError (t , err )
22852329}
0 commit comments