Skip to content

Commit 9f40337

Browse files
authored
fix(cleaner): fix disk partition cannot be released after creating lvm (#662)
* fix the problem that the disk partition cannot be released after creating lvm Signed-off-by: liuminjian <liuminjian@chinatelecom.cn>
1 parent 8d7e515 commit 9f40337

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/cleaner/jobcontroller.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ func NewCleanupJob(bd *v1alpha1.BlockDevice, volMode VolumeMode, tolerations []v
104104
// wipefs erases the filesystem signature from the block
105105
// -a wipe all magic strings
106106
// -f force erasure
107-
args := fmt.Sprintf("(fdisk -o Device -l %[1]s "+
107+
108+
args := fmt.Sprintf(""+
109+
"(pvs -o pv_name,vg_name|grep %[1]s|awk '{print $2}'"+
110+
"| xargs -I {} sh -c 'dmsetup info -c -o name --noheadings|grep ^{}- "+
111+
"| xargs -t -I {} dmsetup remove {} ') && "+
112+
"(fdisk -o Device -l %[1]s "+
108113
"| grep \"^%[1]s\" "+
109114
"| xargs -I '{}' wipefs -fa '{}') "+
110115
"&& wipefs -fa %[1]s ",

0 commit comments

Comments
 (0)