Skip to content

Commit

Permalink
fix(cleaner): fix disk partition cannot be released after creating lvm (
Browse files Browse the repository at this point in the history
#662)

* fix the problem that the disk partition cannot be released after creating lvm

Signed-off-by: liuminjian <[email protected]>
  • Loading branch information
liuminjian authored Jan 19, 2022
1 parent 8d7e515 commit 9f40337
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/cleaner/jobcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ func NewCleanupJob(bd *v1alpha1.BlockDevice, volMode VolumeMode, tolerations []v
// wipefs erases the filesystem signature from the block
// -a wipe all magic strings
// -f force erasure
args := fmt.Sprintf("(fdisk -o Device -l %[1]s "+

args := fmt.Sprintf(""+
"(pvs -o pv_name,vg_name|grep %[1]s|awk '{print $2}'"+
"| xargs -I {} sh -c 'dmsetup info -c -o name --noheadings|grep ^{}- "+
"| xargs -t -I {} dmsetup remove {} ') && "+
"(fdisk -o Device -l %[1]s "+
"| grep \"^%[1]s\" "+
"| xargs -I '{}' wipefs -fa '{}') "+
"&& wipefs -fa %[1]s ",
Expand Down

0 comments on commit 9f40337

Please sign in to comment.