From 75e234c55915b90816e565ab36fc586bfbed2959 Mon Sep 17 00:00:00 2001 From: Alexandr Stefurishin Date: Thu, 3 Oct 2024 13:13:21 +0300 Subject: [PATCH] fix commands Signed-off-by: Alexandr Stefurishin --- images/agent/src/pkg/controller/lvm_logical_volume_watcher.go | 2 +- images/agent/src/pkg/utils/commands.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/images/agent/src/pkg/controller/lvm_logical_volume_watcher.go b/images/agent/src/pkg/controller/lvm_logical_volume_watcher.go index c8b5b47d..5c9b0d5c 100644 --- a/images/agent/src/pkg/controller/lvm_logical_volume_watcher.go +++ b/images/agent/src/pkg/controller/lvm_logical_volume_watcher.go @@ -272,7 +272,7 @@ func reconcileLLVCreateFunc( if err = cl.Get(ctx, types.NamespacedName{Namespace: llv.Namespace, Name: llv.Spec.Source}, sourceLlv); err != nil { log.Error(err, fmt.Sprintf("[reconcileLLVCreateFunc] unable to find source LogicalVolume %s (%s)", llv.Spec.Source, llv.Namespace)) } else { - cmd, err = utils.CreateThinLogicalVolumeSnapshot(sourceLlv) + cmd, err = utils.CreateThinLogicalVolumeSnapshot(sourceLlv.Spec.ActualLVNameOnTheNode, lvg.Spec.ActualVGNameOnTheNode, sourceLlv) } } } diff --git a/images/agent/src/pkg/utils/commands.go b/images/agent/src/pkg/utils/commands.go index fdfab8be..10192eb2 100644 --- a/images/agent/src/pkg/utils/commands.go +++ b/images/agent/src/pkg/utils/commands.go @@ -273,8 +273,8 @@ func CreateThinPoolFullVGSpace(thinPoolName, vgName string) (string, error) { return cmd.String(), nil } -func CreateThinLogicalVolumeSnapshot(sourceLlv *v1alpha1.LVMLogicalVolume) (string, error) { - args := []string{"lvcreate", "-s", "-n", sourceLlv.Name, "-y"} +func CreateThinLogicalVolumeSnapshot(name string, vgName string, sourceLlv *v1alpha1.LVMLogicalVolume) (string, error) { + args := []string{"lvcreate", "-s", "-n", name, fmt.Sprintf("%s/%s", vgName, sourceLlv.Name), "-y"} extendedArgs := lvmStaticExtendedArgs(args) cmd := exec.Command(internal.NSENTERCmd, extendedArgs...)