From b1d225c2096635d1cf5e3af95c1a1eed6f09d1a9 Mon Sep 17 00:00:00 2001 From: Alexandr Stefurishin Date: Thu, 31 Oct 2024 14:22:21 +0300 Subject: [PATCH] adjust llv reconciler with new objects schema Signed-off-by: Alexandr Stefurishin --- .../src/internal/controller/llv/reconciler.go | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/images/agent/src/internal/controller/llv/reconciler.go b/images/agent/src/internal/controller/llv/reconciler.go index a6d71084..7ffbcf61 100644 --- a/images/agent/src/internal/controller/llv/reconciler.go +++ b/images/agent/src/internal/controller/llv/reconciler.go @@ -18,7 +18,6 @@ import ( "github.com/google/go-cmp/cmp" k8serr "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/resource" - "k8s.io/apimachinery/pkg/types" "k8s.io/utils/strings/slices" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -266,32 +265,7 @@ func (r *Reconciler) reconcileLLVCreateFunc( // volume is a clone r.log.Debug(fmt.Sprintf("[reconcileLLVCreateFunc] Snapshot (for source %s) LV %s of the LVMLogicalVolume %s will be created in Thin-pool %s with size %s", llv.Spec.Source.Name, llv.Spec.ActualLVNameOnTheNode, llv.Name, llv.Spec.Thin.PoolName, llvRequestSize.String())) - var sourceVgName, sourceVolumeName string - if llv.Spec.Source.Kind == "LVMLogicalVolume" { - sourceLlv := &v1alpha1.LVMLogicalVolume{} - if err = r.cl.Get(ctx, types.NamespacedName{Name: llv.Spec.Source.Name}, sourceLlv); err != nil { - r.log.Error(err, fmt.Sprintf("[reconcileLLVCreateFunc] unable to find source LVMLogicalVolume %s", llv.Spec.Source.Name)) - return false, err - } - - sourceVolumeName = sourceLlv.Spec.ActualLVNameOnTheNode - sourceVgName = sourceLlv.Spec.LVMVolumeGroupName - - // TODO snapshots: validate source llv - } else if llv.Spec.Source.Kind == "LVMLogicalVolumeSnapshot" { - sourceSnapshot := &v1alpha1.LVMLogicalVolumeSnapshot{} - if err = r.cl.Get(ctx, types.NamespacedName{Name: llv.Spec.Source.Name}, sourceSnapshot); err != nil { - r.log.Error(err, fmt.Sprintf("[reconcileLLVCreateFunc] unable to find source LVMLogicalVolumeSnapshot %s", llv.Spec.Source.Name)) - return false, err - } - sourceVolumeName = sourceSnapshot.Spec.ActualLVNameOnTheNode - sourceVgName = sourceSnapshot.Spec.LVMVolumeGroupName - // TODO snapshots: validate source snapshot - } else { - return false, fmt.Errorf("source kind is not supported: %s", llv.Spec.Source.Kind) - } - cmd, err = utils.CreateThinLogicalVolumeSnapshot(llv.Spec.ActualLVNameOnTheNode, sourceVgName, sourceVolumeName) - + cmd, err = utils.CreateThinLogicalVolumeSnapshot(llv.Spec.ActualLVNameOnTheNode, llv.Spec.LVMVolumeGroupName, llv.Spec.Source.Name) } } r.log.Debug(fmt.Sprintf("[reconcileLLVCreateFunc] runs cmd: %s", cmd))