Repository: dell/csi-baremetal
Pull request #549 (2021-09-23 14:38:28)

[ISSUE-548] Idempotent PrepareVolume procedure
## Purpose
### Issue #548 

- check existing FS before creating
- rename DetectFS to GetFSType
- fix updating volume health after drive goes to OFFLINE

## PR checklist
- [x] Add link to the issue
- [x] Choose PR label
- [x] New unit tests added
- [x] Modified code has meaningful comments
- [x] All TODOs are linked with the issues
- [ ] All comments are resolved

## Testing
Tested manually
Non-LVG volume:
```
Sep 23 12:17:35.849 [INFO] [VolumeManager] [Reconcile] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Processing for status CREATING
Sep 23 12:17:35.849 [INFO] [DriveProvisioner] [PrepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Processing for volume {pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e 5c2fb995-d7ff-45e4-8b5b-7b42ff1b5731 DRIVE HDD 8eb38e9e-3a74-4086-a600-2044d51f82d3 [] 105906176 FS xfs GOOD OPERATIVE CREATING IN_USE false {} [] 0}
Sep 23 12:17:35.857 [INFO] [DriveProvisioner] [PrepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Search device file for drive with S/N LOOPBACK2205308016
Sep 23 12:17:35.857 [INFO] [DriveProvisioner] [PrepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Create partition {/dev/loop41  1 gpt CSI 9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e false} on device /dev/loop41 and set UUID
Sep 23 12:17:35.857 [DEBU] [PartitionOperations] [PreparePartition] [9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Processing for partition utilwrappers.Partition{Device:"/dev/loop41", Name:"", Num:"1", TableType:"gpt", Label:"CSI", PartUUID:"9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e", Ephemeral:false}
Sep 23 12:17:35.906 [DEBU] [Executor] [partprobe -d -s /dev/loop41] [49.286616ms] [49286616] stdout: /dev/loop41: gpt partitions 1

Sep 23 12:17:35.953 [DEBU] [Executor] [sgdisk /dev/loop41 --info=1] [46.577147ms] [46577147] stdout: Partition GUID code: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 (Linux filesystem)
Partition unique GUID: 9EA8810C-5745-4FE7-8C3F-E34E25BF8B7E
First sector: 34 (at 17.0 KiB)
Last sector: 206814 (at 101.0 MiB)
Partition size: 206781 sectors (101.0 MiB)
Attribute flags: 0000000000000000
Partition name: 'CSI'

Sep 23 12:17:35.953 [INFO] [PartitionOperations] [PreparePartition] [9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Partition has already prepared.
Sep 23 12:17:35.953 [DEBU] [PartitionOperations] [SearchPartName] [9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Search partition number for device /dev/loop41 and uuid 9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e
Sep 23 12:17:36.103 [DEBU] [Executor] [partprobe /dev/loop41] [149.301095ms] [149301095] stdout: 
Sep 23 12:17:39.114 [DEBU] [PartitionOperations] [SearchPartName] [9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Got partition number p1
Sep 23 12:17:39.114 [INFO] [DriveProvisioner] [PrepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Partition was created successfully &{/dev/loop41 p1 1 gpt CSI 9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e false}
Sep 23 12:17:39.118 [DEBU] [Executor] [lsblk /dev/loop41p1 --output FSTYPE --noheadings] [3.944053ms] [3944053] stdout: xfs

Sep 23 12:17:39.118 [WARN] [DriveProvisioner] [PrepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] FS on /dev/loop41p1 with type xfs is already exist, skip creating
Sep 23 12:17:39.118 [ERRO] [VolumeManager] [prepareVolume] [pvc-9ea8810c-5745-4fe7-8c3f-e34e25bf8b7e] Unable to update volume status to CREATED: <nil>
```

LVG volume:
```
Sep 23 12:49:32.490 [INFO] [VolumeManager] [Reconcile] [pvc-81b77bda-7616-431a-b39d-6c806a469971] Processing for status CREATING
Sep 23 12:49:32.496 [INFO] [LVMProvisioner] [PrepareVolume] [pvc-81b77bda-7616-431a-b39d-6c806a469971] Processing for volume v1api.Volume{Id:"pvc-81b77bda-7616-431a-b39d-6c806a469971", Location:"5386f10f-29ea-49fe-bc33-ff862a4889dd", LocationType:"LVM", StorageClass:"HDDLVG", NodeId:"ecc5b853-5f78-496d-86c3-58214879415f", Owners:[]string(nil), Size:41943040, Mode:"FS", Type:"xfs", Health:"GOOD", OperationalStatus:"OPERATIVE", CSIStatus:"CREATING", Usage:"IN_USE", Ephemeral:false, XXX_NoUnkeyedLiteral:struct {}{}, XXX_unrecognized:[]uint8(nil), XXX_sizecache:0}
Sep 23 12:49:32.496 [INFO] [LVMProvisioner] [PrepareVolume] [pvc-81b77bda-7616-431a-b39d-6c806a469971] Creating LV pvc-81b77bda-7616-431a-b39d-6c806a469971 sizeof 40m in VG 5386f10f-29ea-49fe-bc33-ff862a4889dd
Sep 23 12:49:33.571 [ERRO] [Executor] [/sbin/lvm lvcreate --yes --name pvc-81b77bda-7616-431a-b39d-6c806a469971 --size 40m 5386f10f-29ea-49fe-bc33-ff862a4889dd] [1.074619665s] [1074619665] stdout: , stderr:   Logical Volume "pvc-81b77bda-7616-431a-b39d-6c806a469971" already exists in volume group "5386f10f-29ea-49fe-bc33-ff862a4889dd"
, Error: exit status 5
Sep 23 12:49:33.571 [DEBU] [LVMProvisioner] [PrepareVolume] [pvc-81b77bda-7616-431a-b39d-6c806a469971] Creating FS on /dev/5386f10f-29ea-49fe-bc33-ff862a4889dd/pvc-81b77bda-7616-431a-b39d-6c806a469971
Sep 23 12:49:33.577 [DEBU] [Executor] [lsblk /dev/5386f10f-29ea-49fe-bc33-ff862a4889dd/pvc-81b77bda-7616-431a-b39d-6c806a469971 --output FSTYPE --noheadings] [6.494411ms] [6494411] stdout: xfs

Sep 23 12:49:33.578 [WARN] [FSOperations] [CreateFSIfNotExist] FS on /dev/5386f10f-29ea-49fe-bc33-ff862a4889dd/pvc-81b77bda-7616-431a-b39d-6c806a469971 with type xfs is already exist, skip creating
Sep 23 12:49:33.578 [ERRO] [VolumeManager] [prepareVolume] [pvc-81b77bda-7616-431a-b39d-6c806a469971] Unable to update volume status to CREATED: <nil>
```


codecov[bot]: # [Codecov](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) Report
> Merging [#549](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) (221f99c) into [master](https://codecov.io/gh/dell/csi-baremetal/commit/8ace344a8c8a1338808d534a6f350a6e8eb0cb7f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) (8ace344) will **increase** coverage by `0.00%`.
> The diff coverage is `78.37%`.

> :exclamation: Current head 221f99c differs from pull request most recent head c2427cb. Consider uploading reports for the commit c2427cb to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/dell/csi-baremetal/pull/549/graphs/tree.svg?width=650&height=150&src=pr&token=4D8WVNWX5O&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell)](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell)

```diff
@@           Coverage Diff           @@
##           master     #549   +/-   ##
=======================================
  Coverage   60.32%   60.32%           
=======================================
  Files          60       60           
  Lines        5998     6017   +19     
=======================================
+ Hits         3618     3630   +12     
- Misses       2169     2174    +5     
- Partials      211      213    +2     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `60.32% <78.37%> (+<0.01%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell) | Coverage Δ | |
|---|---|---|
| [pkg/node/volumemgr.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL25vZGUvdm9sdW1lbWdyLmdv) | `68.28% <0.00%> (-0.31%)` | :arrow_down: |
| [.../provisioners/utilwrappers/partition\_operations.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL25vZGUvcHJvdmlzaW9uZXJzL3V0aWx3cmFwcGVycy9wYXJ0aXRpb25fb3BlcmF0aW9ucy5nbw==) | `87.20% <33.33%> (-1.95%)` | :arrow_down: |
| [...kg/node/provisioners/utilwrappers/fs\_operations.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL25vZGUvcHJvdmlzaW9uZXJzL3V0aWx3cmFwcGVycy9mc19vcGVyYXRpb25zLmdv) | `65.97% <86.36%> (+6.76%)` | :arrow_up: |
| [pkg/base/linuxutils/datadiscover/datadiscover.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL2Jhc2UvbGludXh1dGlscy9kYXRhZGlzY292ZXIvZGF0YWRpc2NvdmVyLmdv) | `84.84% <100.00%> (ø)` | |
| [pkg/base/linuxutils/fs/fs\_helper.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL2Jhc2UvbGludXh1dGlscy9mcy9mc19oZWxwZXIuZ28=) | `75.42% <100.00%> (-1.57%)` | :arrow_down: |
| [pkg/node/provisioners/drive\_provisioner.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL25vZGUvcHJvdmlzaW9uZXJzL2RyaXZlX3Byb3Zpc2lvbmVyLmdv) | `88.07% <100.00%> (ø)` | |
| [pkg/node/provisioners/lvm\_provisioner.go](https://codecov.io/gh/dell/csi-baremetal/pull/549/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell#diff-cGtnL25vZGUvcHJvdmlzaW9uZXJzL2x2bV9wcm92aXNpb25lci5nbw==) | `87.32% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell). Last update [8ace344...c2427cb](https://codecov.io/gh/dell/csi-baremetal/pull/549?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dell).


Patch:
diff --git a/docs/CODEOWNERS b/docs/CODEOWNERS
new file mode 100644
index 0000000..edbf730
--- /dev/null
+++ b/docs/CODEOWNERS
@@ -0,0 +1,7 @@
+# file is used to notify teams or individuals about
+# changes to directories or files of interest.
+#
+# See https://help.github.com/articles/about-codeowners/
+# for more info about the CODEOWNERS file.
+
+* @dell/csi-baremetal
diff --git a/pkg/base/linuxutils/datadiscover/datadiscover.go b/pkg/base/linuxutils/datadiscover/datadiscover.go
index efbc61a..1c3d48d 100644
--- a/pkg/base/linuxutils/datadiscover/datadiscover.go
+++ b/pkg/base/linuxutils/datadiscover/datadiscover.go
@@ -51,7 +51,7 @@ func (w *WrapDataDiscoverImpl) DiscoverData(device, serialNumber string) (*types
 		err        error
 	)
 
-	if fileSystem, err = w.fsHelper.DeviceFs(device); err != nil {
+	if fileSystem, err = w.fsHelper.GetFSType(device); err != nil {
 		return nil, err
 	}
 	if fileSystem != "" {
diff --git a/pkg/base/linuxutils/fs/fs_helper.go b/pkg/base/linuxutils/fs/fs_helper.go
index 6e0b5d2..c826721 100644
--- a/pkg/base/linuxutils/fs/fs_helper.go
+++ b/pkg/base/linuxutils/fs/fs_helper.go
@@ -54,10 +54,8 @@ const (
 	RmDirCmdTmpl = "rm -rf %s"
 	// WipeFSCmdTmpl cmd for wiping FS on device
 	WipeFSCmdTmpl = wipefs + "-af %s" //
-	// DetectFSCmdTmpl cmd for detecting FS on device
-	DetectFSCmdTmpl = "lsblk %s --output FSTYPE --noheadings"
-	// GetFSTypeCmdTmpl cmd for retrieving FS type
-	GetFSTypeCmdTmpl = wipefs + "%s --output TYPE --noheadings"
+	// GetFSTypeCmdTmpl cmd for detecting FS on device
+	GetFSTypeCmdTmpl = "lsblk %s --output FSTYPE --noheadings"
 	// MountInfoFile "/proc/mounts" path
 	MountInfoFile = "/proc/self/mountinfo"
 	// FindMntCmdTmpl find source device for target mount path cmd
@@ -78,13 +76,12 @@ type WrapFS interface {
 	RmDir(src string) error
 	CreateFS(fsType FileSystem, device string) error
 	WipeFS(device string) error
-	GetFSType(device string) (FileSystem, error)
+	GetFSType(device string) (string, error)
 	// Mount operations
 	IsMounted(src string) (bool, error)
 	FindMountPoint(target string) (string, error)
 	Mount(src, dst string, opts ...string) error
 	Unmount(src string) error
-	DeviceFs(device string) (string, error)
 }
 
 // WrapFSImpl is a WrapFS implementer
@@ -142,7 +139,7 @@ func (h *WrapFSImpl) MkDir(src string) error {
 	if _, _, err := h.e.RunCmd(cmd,
 		command.UseMetrics(true),
 		command.CmdName(strings.TrimSpace(fmt.Sprintf(MkDirCmdTmpl, "")))); err != nil {
-		return fmt.Errorf("failed to create dir %s: %v", src, err)
+		return fmt.Errorf("failed to create dir %s: %w", src, err)
 	}
 	return nil
 }
@@ -182,7 +179,7 @@ func (h *WrapFSImpl) RmDir(src string) error {
 	if _, _, err := h.e.RunCmd(cmd,
 		command.UseMetrics(true),
 		command.CmdName(strings.TrimSpace(fmt.Sprintf(RmDirCmdTmpl, "")))); err != nil {
-		return fmt.Errorf("failed to delete path %s: %v", src, err)
+		return fmt.Errorf("failed to delete path %s: %w", src, err)
 	}
 	return nil
 }
@@ -204,7 +201,7 @@ func (h *WrapFSImpl) CreateFS(fsType FileSystem, device string) error {
 	if _, _, err := h.e.RunCmd(cmd,
 		command.UseMetrics(true),
 		command.CmdName(strings.TrimSpace(fmt.Sprintf(MkFSCmdTmpl, "", "")))); err != nil {
-		return fmt.Errorf("failed to create file system on %s: %v", device, err)
+		return fmt.Errorf("failed to create file system on %s: %w", device, err)
 	}
 	return nil
 }
@@ -218,30 +215,11 @@ func (h *WrapFSImpl) WipeFS(device string) error {
 	if _, _, err := h.e.RunCmd(cmd,
 		command.UseMetrics(true),
 		command.CmdName(strings.TrimSpace(fmt.Sprintf(WipeFSCmdTmpl, "")))); err != nil {
-		return fmt.Errorf("failed to wipe file system on %s: %v", device, err)
+		return fmt.Errorf("failed to wipe file system on %s: %w", device, err)
 	}
 	return nil
 }
 
-// GetFSType returns FS type on the device or error
-func (h *WrapFSImpl) GetFSType(device string) (FileSystem, error) {
-	/*
-		Example of output:
-			~# wipefs /dev/mvg/lv1 --output TYPE --noheadings
-			   ext4
-	*/
-	cmd := fmt.Sprintf(GetFSTypeCmdTmpl, device)
-
-	stdout, _, err := h.e.RunCmd(cmd,
-		command.UseMetrics(true),
-		command.CmdName(strings.TrimSpace(fmt.Sprintf(GetFSTypeCmdTmpl, ""))))
-	if err != nil {
-		return "", fmt.Errorf("unable to retrieve FS type for device %s: %v", device, err)
-	}
-
-	return FileSystem(strings.TrimSpace(stdout)), nil
-}
-
 // IsMounted checks if the path is presented in /proc/self/mountinfo
 // Receives path as a string
 // Returns bool that represents mount status or error if something went wrong
@@ -251,7 +229,7 @@ func (h *WrapFSImpl) IsMounted(path string) (bool, error) {
 
 	procMounts, err := util.ConsistentRead(MountInfoFile, 5, time.Millisecond)
 	if err != nil || len(procMounts) == 0 {
-		return false, fmt.Errorf("unable to check whether %s mounted or no, error: %v", path, err)
+		return false, fmt.Errorf("unable to check whether %s mounted or no, error: %w", path, err)
 	}
 
 	// parse /proc/mounts content and search path entry
@@ -316,19 +294,19 @@ func (h *WrapFSImpl) Unmount(path string) error {
 	return err
 }
 
-// DeviceFs detect FS from the provided device using lsblk --output FSTYPE
+// GetFSType detect FS from the provided device using lsblk --output FSTYPE
 // Receives file path of the device as a string
 // Returns error if something went wrong
-func (h *WrapFSImpl) DeviceFs(device string) (string, error) {
+func (h *WrapFSImpl) GetFSType(device string) (string, error) {
 	var (
-		cmd    = fmt.Sprintf(DetectFSCmdTmpl, device)
+		cmd    = fmt.Sprintf(GetFSTypeCmdTmpl, device)
 		stdout string
 		err    error
 	)
 	if stdout, _, err = h.e.RunCmd(cmd,
 		command.UseMetrics(true),
-		command.CmdName(fmt.Sprintf(DetectFSCmdTmpl, ""))); err != nil {
-		return "", fmt.Errorf("failed to detect file system on %s: %v", device, err)
+		command.CmdName(fmt.Sprintf(GetFSTypeCmdTmpl, ""))); err != nil {
+		return "", fmt.Errorf("failed to detect file system on %s: %w", device, err)
 	}
 	return strings.TrimSpace(stdout), err
 }
diff --git a/pkg/mocks/linuxutils/fs_helper.go b/pkg/mocks/linuxutils/fs_helper.go
index 6313d1c..b97532b 100644
--- a/pkg/mocks/linuxutils/fs_helper.go
+++ b/pkg/mocks/linuxutils/fs_helper.go
@@ -27,8 +27,8 @@ type MockWrapFS struct {
 	mock.Mock
 }
 
-// DeviceFs is a mock implementations
-func (m *MockWrapFS) DeviceFs(device string) (string, error) {
+// GetFSType is a mock implementations
+func (m *MockWrapFS) GetFSType(device string) (string, error) {
 	args := m.Mock.Called(device)
 
 	return args.String(0), args.Error(1)
@@ -76,13 +76,6 @@ func (m *MockWrapFS) WipeFS(device string) error {
 	return args.Error(0)
 }
 
-// GetFSType is a mock implementations
-func (m *MockWrapFS) GetFSType(device string) (fs.FileSystem, error) {
-	args := m.Mock.Called(device)
-
-	return args.Get(0).(fs.FileSystem), args.Error(1)
-}
-
 // IsMounted is a mock implementations
 func (m *MockWrapFS) IsMounted(src string) (bool, error) {
 	args := m.Mock.Called(src)
diff --git a/pkg/mocks/provisioners/fs_operations.go b/pkg/mocks/provisioners/fs_operations.go
index 9649741..12025f5 100644
--- a/pkg/mocks/provisioners/fs_operations.go
+++ b/pkg/mocks/provisioners/fs_operations.go
@@ -16,7 +16,10 @@ limitations under the License.
 
 package provisioners
 
-import mocklu "github.com/dell/csi-baremetal/pkg/mocks/linuxutils"
+import (
+	"github.com/dell/csi-baremetal/pkg/base/linuxutils/fs"
+	mocklu "github.com/dell/csi-baremetal/pkg/mocks/linuxutils"
+)
 
 // MockFsOpts is a mock implementation of FSOperation interface from volumeprovisioner package
 type MockFsOpts struct {
@@ -43,3 +46,10 @@ func (m *MockFsOpts) UnmountWithCheck(path string) error {
 
 	return args.Error(0)
 }
+
+// CreateFSIfNotExist is a mock implementation
+func (m *MockFsOpts) CreateFSIfNotExist(fsType fs.FileSystem, device string) error {
+	args := m.Mock.Called(fsType, device)
+
+	return args.Error(0)
+}
diff --git a/pkg/node/provisioners/drive_provisioner.go b/pkg/node/provisioners/drive_provisioner.go
index b71701d..34a1267 100644
--- a/pkg/node/provisioners/drive_provisioner.go
+++ b/pkg/node/provisioners/drive_provisioner.go
@@ -48,7 +48,7 @@ const (
 type DriveProvisioner struct {
 	listBlk lsblk.WrapLsblk
 	// fsOps uses for operations with file systems
-	fsOps fs.WrapFS
+	fsOps uw.FSOperations
 	// partOps uses for operations with partitions
 	partOps uw.PartitionOperations
 
@@ -65,7 +65,7 @@ func NewDriveProvisioner(
 	log *logrus.Logger) *DriveProvisioner {
 	return &DriveProvisioner{
 		listBlk:   lsblk.NewLSBLK(log),
-		fsOps:     fs.NewFSImpl(e),
+		fsOps:     uw.NewFSOperationsImpl(e, log),
 		partOps:   uw.NewPartitionOperationsImpl(e, log),
 		k8sClient: k,
 		crHelper:  k8s.NewCRHelper(k, log),
@@ -119,10 +119,9 @@ func (d *DriveProvisioner) PrepareVolume(vol api.Volume) error {
 		ll.Errorf("Unable to prepare partition: %v", err)
 		return fmt.Errorf("unable to prepare partition for volume %v", vol)
 	}
-	ll.Infof("Partition was created successfully %v", partPtr)
+	ll.Infof("Partition was created successfully %+v", partPtr)
 
-	// create FS
-	return d.fsOps.CreateFS(fs.FileSystem(vol.Type), partPtr.GetFullPath())
+	return d.fsOps.CreateFSIfNotExist(fs.FileSystem(vol.Type), partPtr.GetFullPath())
 }
 
 // ReleaseVolume remove FS and partition based on vol attributes.
diff --git a/pkg/node/provisioners/lvm_provisioner.go b/pkg/node/provisioners/lvm_provisioner.go
index b33bcf8..1677c2b 100644
--- a/pkg/node/provisioners/lvm_provisioner.go
+++ b/pkg/node/provisioners/lvm_provisioner.go
@@ -29,13 +29,14 @@ import (
 	"github.com/dell/csi-baremetal/pkg/base/linuxutils/fs"
 	"github.com/dell/csi-baremetal/pkg/base/linuxutils/lvm"
 	"github.com/dell/csi-baremetal/pkg/base/util"
+	uw "github.com/dell/csi-baremetal/pkg/node/provisioners/utilwrappers"
 )
 
 // LVMProvisioner is a implementation of Provisioner interface
 // Work with volumes based on Volume Groups
 type LVMProvisioner struct {
 	lvmOps   lvm.WrapLVM
-	fsOps    fs.WrapFS
+	fsOps    uw.FSOperations
 	crHelper *k8s.CRHelper
 	log      *logrus.Entry
 }
@@ -44,7 +45,7 @@ type LVMProvisioner struct {
 func NewLVMProvisioner(e command.CmdExecutor, k *k8s.KubeClient, log *logrus.Logger) *LVMProvisioner {
 	return &LVMProvisioner{
 		lvmOps:   lvm.NewLVM(e, log),
-		fsOps:    fs.NewFSImpl(e),
+		fsOps:    uw.NewFSOperationsImpl(e, log),
 		crHelper: k8s.NewCRHelper(k, log),
 		log:      log.WithField("component", "LVMProvisioner"),
 	}
@@ -85,7 +86,7 @@ func (l *LVMProvisioner) PrepareVolume(vol api.Volume) error {
 	if vol.Mode == apiV1.ModeRAW {
 		return nil
 	}
-	return l.fsOps.CreateFS(fs.FileSystem(vol.Type), deviceFile)
+	return l.fsOps.CreateFSIfNotExist(fs.FileSystem(vol.Type), deviceFile)
 }
 
 // ReleaseVolume search volume group based on vol attributes, remove Logical Volume
diff --git a/pkg/node/provisioners/utilwrappers/fs_operations.go b/pkg/node/provisioners/utilwrappers/fs_operations.go
index 68031ec..653919c 100644
--- a/pkg/node/provisioners/utilwrappers/fs_operations.go
+++ b/pkg/node/provisioners/utilwrappers/fs_operations.go
@@ -35,6 +35,8 @@ type FSOperations interface {
 	MountFakeTmpfs(volumeID, dst string) error
 	// UnmountWithCheck unmount operation
 	UnmountWithCheck(path string) error
+	// CreateFSIfNotExist checks FS and creates one if not exist
+	CreateFSIfNotExist(fsType fs.FileSystem, device string) error
 	fs.WrapFS
 }
 
@@ -156,7 +158,9 @@ func (fsOp *FSOperationsImpl) MountFakeTmpfs(volumeID, dst string) error {
 		CMD example:
 			mount -t tmpfs -o size=1M,ro <volumeID> <dst>
 	*/
-	ll := fsOp.log.WithFields(logrus.Fields{"method": "FakeAttach"})
+	ll := fsOp.log.WithFields(logrus.Fields{
+		"method": "MountFakeTmpfs",
+	})
 
 	ll.Warningf("Simulate attachment")
 	_, err := os.Stat(dst)
@@ -172,3 +176,41 @@ func (fsOp *FSOperationsImpl) MountFakeTmpfs(volumeID, dst string) error {
 
 	return fsOp.Mount(volumeID, dst, "-t tmpfs -o size=1M,ro")
 }
+
+// CreateFSIfNotExist checks FS and creates one if not exist
+/*
+	CMD example:
+		lsblk <device> --output FSTYPE --noheadings
+		# Check output
+
+		mkfs.<fsType> <device>
+*/
+func (fsOp *FSOperationsImpl) CreateFSIfNotExist(fsType fs.FileSystem, device string) error {
+	ll := fsOp.log.WithFields(logrus.Fields{
+		"method": "CreateFSIfNotExist",
+	})
+
+	// check FS
+	existingFS, err := fsOp.GetFSType(device)
+	if err != nil {
+		ll.Errorf("Unable to check FS type on %s: %v", device, err)
+		return err
+	}
+	if fs.FileSystem(existingFS) == fsType {
+		ll.Warnf("FS on %s with type %s is already exist, skip creating", device, fs.FileSystem(existingFS))
+		return nil
+	}
+	if existingFS != "" {
+		ll.Errorf("device %s is not empty. Existing FS - %s", device, fsType)
+		return fmt.Errorf("device %s is not empty. Existing FS - %s", device, fsType)
+	}
+
+	// create FS
+	err = fsOp.CreateFS(fsType, device)
+	if err != nil {
+		ll.Errorf("Unable to create FS type %s on %s: %v", fsType, device, err)
+		return err
+	}
+
+	return nil
+}
diff --git a/pkg/node/provisioners/utilwrappers/partition_operations.go b/pkg/node/provisioners/utilwrappers/partition_operations.go
index f1c4307..5791793 100644
--- a/pkg/node/provisioners/utilwrappers/partition_operations.go
+++ b/pkg/node/provisioners/utilwrappers/partition_operations.go
@@ -110,6 +110,10 @@ func (d *PartitionOperationsImpl) PreparePartition(p Partition) (*Partition, err
 		}
 		if currUUID == p.PartUUID {
 			ll.Infof("Partition has already prepared.")
+			p.Name = d.SearchPartName(p.Device, p.PartUUID)
+			if p.Name == "" {
+				return nil, fmt.Errorf("unable to determine partition name after it being created: %w", err)
+			}
 			return &p, nil
 		}
 		return nil, fmt.Errorf("partition %v has already exist but have another UUID - %s", p, currUUID)
diff --git a/pkg/node/volumemgr.go b/pkg/node/volumemgr.go
index c2f9349..1c18742 100644
--- a/pkg/node/volumemgr.go
+++ b/pkg/node/volumemgr.go
@@ -914,6 +914,7 @@ func (m *VolumeManager) getProvisionerForVolume(vol *api.Volume) p.Provisioner {
 // handleDriveStatusChange removes AC that is based on unhealthy drive, returns AC if drive returned to healthy state,
 // mark volumes of the unhealthy drive as unhealthy.
 // Receives golang context and api.Drive that should be handled
+// TODO the method is called every rime after drive go to OFFLINE - https://github.com/dell/csi-baremetal/issues/550
 func (m *VolumeManager) handleDriveStatusChange(ctx context.Context, drive updatedDrive) {
 	cur := drive.CurrentState.Spec
 	prev := drive.PreviousState.Spec
@@ -965,6 +966,11 @@ func (m *VolumeManager) handleDriveStatusChange(ctx context.Context, drive updat
 	// Set disk's health status to volume CR
 	volumes, _ := m.cachedCrHelper.GetVolumesByLocation(ctx, cur.UUID)
 	for _, vol := range volumes {
+		// skip if health is not changed
+		if vol.Spec.Health == cur.Health {
+			ll.Infof("Volume %s status is already %s", vol.Name, cur.Health)
+			continue
+		}
 		ll.Infof("Setting updated status %s to volume %s", cur.Health, vol.Name)
 		// save previous health state
 		prevHealthState := vol.Spec.Health


Test patch:
diff --git a/pkg/base/linuxutils/datadiscover/datadiscover_test.go b/pkg/base/linuxutils/datadiscover/datadiscover_test.go
index 7e5b808..73cbe1a 100644
--- a/pkg/base/linuxutils/datadiscover/datadiscover_test.go
+++ b/pkg/base/linuxutils/datadiscover/datadiscover_test.go
@@ -22,7 +22,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("xfs", nil).Times(1)
+		fs.On("GetFSType", device).Return("xfs", nil).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
 		assert.Nil(t, err)
 		assert.True(t, discoverResult.HasData)
@@ -34,7 +34,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return(" ", nil).Times(1)
+		fs.On("GetFSType", device).Return(" ", nil).Times(1)
 		part.On("DeviceHasPartitionTable", device).Return(true, nil).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
 		assert.Nil(t, err)
@@ -47,7 +47,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("", nil).Times(1)
+		fs.On("GetFSType", device).Return("", nil).Times(1)
 		part.On("DeviceHasPartitionTable", device).Return(false, nil).Times(1)
 		part.On("DeviceHasPartitions", device).Return(true, nil).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
@@ -62,7 +62,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("", nil).Times(1)
+		fs.On("GetFSType", device).Return("", nil).Times(1)
 		part.On("DeviceHasPartitionTable", device).Return(false, nil).Times(1)
 		part.On("DeviceHasPartitions", device).Return(false, nil).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
@@ -77,7 +77,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("", errors.New("error")).Times(1)
+		fs.On("GetFSType", device).Return("", errors.New("error")).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
 		assert.NotNil(t, err)
 		assert.Nil(t, discoverResult)
@@ -89,7 +89,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("", nil).Times(1)
+		fs.On("GetFSType", device).Return("", nil).Times(1)
 		part.On("DeviceHasPartitionTable", device).Return(false, errors.New("error")).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
 		assert.NotNil(t, err)
@@ -102,7 +102,7 @@ func Test_DiscoverData(t *testing.T) {
 			lvm          = mocklu.MockWrapLVM{}
 			discoverData = NewDataDiscover(&fs, &part, &lvm)
 		)
-		fs.On("DeviceFs", device).Return("", nil).Times(1)
+		fs.On("GetFSType", device).Return("", nil).Times(1)
 		part.On("DeviceHasPartitionTable", device).Return(false, nil).Times(1)
 		part.On("DeviceHasPartitions", device).Return(false, errors.New("error")).Times(1)
 		discoverResult, err := discoverData.DiscoverData(device, serialNumber)
diff --git a/pkg/base/linuxutils/fs/fs_helper_test.go b/pkg/base/linuxutils/fs/fs_helper_test.go
index 60f6b9f..01aa6e1 100644
--- a/pkg/base/linuxutils/fs/fs_helper_test.go
+++ b/pkg/base/linuxutils/fs/fs_helper_test.go
@@ -188,28 +188,6 @@ func TestWipeFS(t *testing.T) {
 	assert.NotNil(t, err)
 }
 
-func TestGetFSType(t *testing.T) {
-	var (
-		e          = &mocks.GoMockExecutor{}
-		fh         = NewFSImpl(e)
-		device     = "/dev/sda"
-		cmd        = fmt.Sprintf(GetFSTypeCmdTmpl, device)
-		expectedFS = "xfs"
-		currentFS  FileSystem
-		err        error
-	)
-
-	e.OnCommand(cmd).Return(expectedFS, "", nil).Times(1)
-	currentFS, err = fh.GetFSType(device)
-	assert.Nil(t, err)
-	assert.Equal(t, FileSystem(expectedFS), currentFS)
-
-	// cmd failed
-	e.OnCommand(cmd).Return("", "", testError).Times(1)
-	_, err = fh.GetFSType(device)
-	assert.NotNil(t, err)
-}
-
 func TestMount(t *testing.T) {
 	var (
 		e   = &mocks.GoMockExecutor{}
@@ -249,26 +227,26 @@ func TestUnmount(t *testing.T) {
 	assert.NotNil(t, err)
 }
 
-func Test_DeviceHasFs(t *testing.T) {
+func Test_GetFSType(t *testing.T) {
 	var (
 		e    = &mocks.GoMockExecutor{}
 		fh   = NewFSImpl(e)
 		path = "/dev/sda"
-		cmd  = fmt.Sprintf(DetectFSCmdTmpl, path)
+		cmd  = fmt.Sprintf(GetFSTypeCmdTmpl, path)
 	)
 
 	e.OnCommand(cmd).Return("", "", nil).Times(1)
-	hasData, err := fh.DeviceFs(path)
+	hasData, err := fh.GetFSType(path)
 	assert.Nil(t, err)
 	assert.Equal(t, "", hasData)
 
 	e.OnCommand(cmd).Return("xfs", "", testError).Times(1)
-	hasData, err = fh.DeviceFs(path)
+	hasData, err = fh.GetFSType(path)
 	assert.NotNil(t, err)
 	assert.Equal(t, "", hasData)
 
 	e.OnCommand(cmd).Return("xfs", "", nil).Times(1)
-	hasData, err = fh.DeviceFs(path)
+	hasData, err = fh.GetFSType(path)
 	assert.Nil(t, err)
 	assert.Equal(t, "xfs", hasData)
 }
diff --git a/pkg/node/provisioners/drive_provisioner_test.go b/pkg/node/provisioners/drive_provisioner_test.go
index 38b8ddc..dc6e6c3 100644
--- a/pkg/node/provisioners/drive_provisioner_test.go
+++ b/pkg/node/provisioners/drive_provisioner_test.go
@@ -38,7 +38,7 @@ import (
 func setupTestDriveProvisioner() (dp *DriveProvisioner,
 	mockLsblk *mocklu.MockWrapLsblk,
 	mockPH *mockProv.MockPartitionOps,
-	mockFS *mocklu.MockWrapFS) {
+	mockFS *mockProv.MockFsOpts) {
 	fakeK8s, err := k8s.GetFakeKubeClient(testNs, testLogger)
 	if err != nil {
 		panic(err)
@@ -48,7 +48,7 @@ func setupTestDriveProvisioner() (dp *DriveProvisioner,
 	dp = NewDriveProvisioner(&command.Executor{}, fakeK8s, logger)
 	mockLsblk = &mocklu.MockWrapLsblk{}
 	mockPH = &mockProv.MockPartitionOps{}
-	mockFS = &mocklu.MockWrapFS{}
+	mockFS = &mockProv.MockFsOpts{}
 
 	dp.listBlk = mockLsblk
 	dp.partOps = mockPH
@@ -89,7 +89,7 @@ func TestDriveProvisioner_PrepareVolume_Success(t *testing.T) {
 		mock.MatchedBy(func(d *drivecrd.Drive) bool { return d.Name == testDriveCR.Name })).
 		Return(device, nil)
 	mockPH.On("PreparePartition", part).Return(&expectedPart, nil)
-	mockFS.On("CreateFS", fs.FileSystem(testVolume2.Type), expectedPart.GetFullPath()).
+	mockFS.On("CreateFSIfNotExist", fs.FileSystem(testVolume2.Type), expectedPart.GetFullPath()).
 		Return(nil)
 
 	err = dp.PrepareVolume(testVolume2)
@@ -134,7 +134,7 @@ func TestDriveProvisioner_PrepareVolume_Fail(t *testing.T) {
 	// CreateFS failed
 	mockPH.On("PreparePartition", mock.Anything).
 		Return(&uw.Partition{}, nil).Once()
-	mockFS.On("CreateFS", fs.FileSystem(testVolume2.Type), mock.Anything).Return(errTest)
+	mockFS.On("CreateFSIfNotExist", fs.FileSystem(testVolume2.Type), mock.Anything).Return(errTest)
 
 	err = dp.PrepareVolume(testVolume2)
 	assert.Error(t, err)
diff --git a/pkg/node/provisioners/lvm_provisioner_test.go b/pkg/node/provisioners/lvm_provisioner_test.go
index c7485f6..a56a588 100644
--- a/pkg/node/provisioners/lvm_provisioner_test.go
+++ b/pkg/node/provisioners/lvm_provisioner_test.go
@@ -58,7 +58,7 @@ func TestLVMProvisioner_PrepareVolume_Success(t *testing.T) {
 		Return(nil).Times(1)
 
 	devFile := fmt.Sprintf("/dev/%s/%s", testVolume1.Location, testVolume1.Id)
-	fsOps.On("CreateFS", fs.FileSystem(testVolume1.Type), devFile).
+	fsOps.On("CreateFSIfNotExist", fs.FileSystem(testVolume1.Type), devFile).
 		Return(nil).Times(1)
 
 	err := lp.PrepareVolume(testVolume1)
@@ -91,7 +91,7 @@ func TestLVMProvisioner_PrepareVolume_Fail(t *testing.T) {
 		Return(nil).Times(1)
 
 	devFile := fmt.Sprintf("/dev/%s/%s", testVolume1.Location, testVolume1.Id)
-	fsOps.On("CreateFS", fs.FileSystem(testVolume1.Type), devFile).
+	fsOps.On("CreateFSIfNotExist", fs.FileSystem(testVolume1.Type), devFile).
 		Return(errTest).Times(1)
 
 	err = lp.PrepareVolume(testVolume1)
diff --git a/pkg/node/provisioners/utilwrappers/fs_operations_test.go b/pkg/node/provisioners/utilwrappers/fs_operations_test.go
index 1af955d..7698812 100644
--- a/pkg/node/provisioners/utilwrappers/fs_operations_test.go
+++ b/pkg/node/provisioners/utilwrappers/fs_operations_test.go
@@ -170,3 +170,85 @@ func TestFSOperationsImpl_MountWithCheck_Fail(t *testing.T) {
 	assert.NotNil(t, err)
 	assert.Equal(t, unmountErr, err)
 }
+
+func TestFSOperationsImpl_CreateFSIfNotExist_NoFS(t *testing.T) {
+	var (
+		fsOps  = NewFSOperationsImpl(&command.Executor{}, logrus.New())
+		wrapFS = &mocklu.MockWrapFS{}
+		path   = "/some/path"
+		fsType = "xfs"
+		err    error
+	)
+	fsOps.WrapFS = wrapFS
+
+	wrapFS.On("GetFSType", path).Return("", nil).Once()
+	wrapFS.On("CreateFS", fs.FileSystem(fsType), path).Return(nil).Once()
+
+	err = fsOps.CreateFSIfNotExist(fs.FileSystem(fsType), path)
+	assert.Nil(t, err)
+}
+
+func TestFSOperationsImpl_CreateFSIfNotExist_FSExists(t *testing.T) {
+	var (
+		fsOps  = NewFSOperationsImpl(&command.Executor{}, logrus.New())
+		wrapFS = &mocklu.MockWrapFS{}
+		path   = "/some/path"
+		fsType = "xfs"
+		err    error
+	)
+	fsOps.WrapFS = wrapFS
+
+	wrapFS.On("GetFSType", path).Return(fsType, nil).Once()
+
+	err = fsOps.CreateFSIfNotExist(fs.FileSystem(fsType), path)
+	assert.Nil(t, err)
+}
+
+func TestFSOperationsImpl_CreateFSIfNotExist_OtherFS(t *testing.T) {
+	var (
+		fsOps  = NewFSOperationsImpl(&command.Executor{}, logrus.New())
+		wrapFS = &mocklu.MockWrapFS{}
+		path   = "/some/path"
+		fsType = "xfs"
+		err    error
+	)
+	fsOps.WrapFS = wrapFS
+
+	wrapFS.On("GetFSType", path).Return("other_FS", nil).Once()
+
+	err = fsOps.CreateFSIfNotExist(fs.FileSystem(fsType), path)
+	assert.NotNil(t, err)
+}
+
+func TestFSOperationsImpl_CreateFSIfNotExist_CheckError(t *testing.T) {
+	var (
+		fsOps  = NewFSOperationsImpl(&command.Executor{}, logrus.New())
+		wrapFS = &mocklu.MockWrapFS{}
+		path   = "/some/path"
+		fsType = "xfs"
+		err    error
+	)
+	fsOps.WrapFS = wrapFS
+
+	wrapFS.On("GetFSType", path).Return("", errors.New("some_error")).Once()
+
+	err = fsOps.CreateFSIfNotExist(fs.FileSystem(fsType), path)
+	assert.NotNil(t, err)
+}
+
+func TestFSOperationsImpl_CreateFSIfNotExist_CreateError(t *testing.T) {
+	var (
+		fsOps  = NewFSOperationsImpl(&command.Executor{}, logrus.New())
+		wrapFS = &mocklu.MockWrapFS{}
+		path   = "/some/path"
+		fsType = "xfs"
+		err    error
+	)
+	fsOps.WrapFS = wrapFS
+
+	wrapFS.On("GetFSType", path).Return("", nil).Once()
+	wrapFS.On("CreateFS", fs.FileSystem(fsType), path).Return(errors.New("some_error")).Once()
+
+	err = fsOps.CreateFSIfNotExist(fs.FileSystem(fsType), path)
+	assert.NotNil(t, err)
+}
diff --git a/pkg/node/provisioners/utilwrappers/parttiion_operations_test.go b/pkg/node/provisioners/utilwrappers/parttiion_operations_test.go
index f5d774a..c1a6c0a 100644
--- a/pkg/node/provisioners/utilwrappers/parttiion_operations_test.go
+++ b/pkg/node/provisioners/utilwrappers/parttiion_operations_test.go
@@ -39,7 +39,7 @@ var (
 
 	testPart1 = Partition{
 		Device:    testDevice1,
-		Name:      "",
+		Name:      "some_name",
 		Num:       DefaultPartitionNumber,
 		TableType: partitionhelper.PartitionGPT,
 		Label:     DefaultPartitionLabel,
@@ -71,6 +71,10 @@ func TestDriveProvisioner_PreparePartition_Success(t *testing.T) {
 		Return(true, nil).Once()
 	mockPH.On("GetPartitionUUID", testPart1.Device, testPart1.Num).
 		Return(testPart1.PartUUID, nil).Once()
+	mockPH.On("SyncPartitionTable", testPart1.Device).
+		Return(nil).Once()
+	mockPH.On("GetPartitionNameByUUID", testPart1.Device, testPart1.PartUUID).
+		Return(testPart1.Name, nil).Once()
 
 	currentPPtr, err = partOps.PreparePartition(testPart1)
 	assert.Nil(t, err)