Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ public static String getSnapshotPath(com.linbit.linstor.api.model.StoragePool sp
final String path;
switch (sp.getProviderKind()) {
case LVM_THIN:
// device-mapper doubles every dash in the VG and LV name, so the VG part needs escaping too
final String vgName = backingPool.split("/")[0];
path = String.format("/dev/mapper/%s-%s_%s_%s",
backingPool.split("/")[0], rscName.replace("-", "--"), suffix, snapshotName.replace("-", "--"));
vgName.replace("-", "--"), rscName.replace("-", "--"), suffix, snapshotName.replace("-", "--"));
break;
case ZFS:
case ZFS_THIN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ public void testGetSnapshotPath() {
Assert.assertEquals("/dev/mapper/storage-cs--cb32532a--dd8f--47e0--a81c--8a75573d3545_00000_snap3", snapPath);
}

{
// dashes in the volume group name must be escaped as well (GH issue #14011)
StoragePool spLVMThin = new StoragePool();
Properties lvmThinProps = new Properties();
lvmThinProps.put("StorDriver/StorPoolName", "linstor_pool-lvm-thin/thin");
spLVMThin.setProps(lvmThinProps);
spLVMThin.setProviderKind(ProviderKind.LVM_THIN);
String snapPath = LinstorUtil.getSnapshotPath(spLVMThin,
"cs-12fc4055-3985-4025-8eb5-d6fd53effe37", "cs-d7aea646-5f40-46a2-b9dc-77e41ea29336");
Assert.assertEquals(
"/dev/mapper/linstor_pool--lvm--thin-cs--12fc4055--3985--4025--8eb5--d6fd53effe37_00000_cs--d7aea646--5f40--46a2--b9dc--77e41ea29336",
snapPath);
}

{
StoragePool spZFS = new StoragePool();
Properties zfsProps = new Properties();
Expand Down
Loading