From 489dcfcdf6ddcb0467d3be673c2683593b7cf1a1 Mon Sep 17 00:00:00 2001 From: Akhil Mohan Date: Wed, 21 Apr 2021 19:51:19 +0530 Subject: [PATCH] fix(Idempotent): make volume provisioning idempotent (#10) Signed-off-by: Akhil Mohan Co-authored-by: praveengt --- pkg/device/device-util.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/device/device-util.go b/pkg/device/device-util.go index e55288fe..ea9787d8 100644 --- a/pkg/device/device-util.go +++ b/pkg/device/device-util.go @@ -77,8 +77,9 @@ func CreateVolume(vol *apis.DeviceVolume) error { return err } if len(pList) > 0 { - klog.Errorf("Partition %s already exist", partitionName) - return errors.New("Already exist") + klog.Infof("Partition %s already exist, Skipping creation", partitionName) + // Making Volume creation Idempotent + return nil } disk, start, err := findBestPart(diskMetaName, capacityMiB) if err != nil {