Skip to content

Commit

Permalink
Merge pull request #62 from metal-stack/fix-lvcreate
Browse files Browse the repository at this point in the history
fix: add --yes to lvcreate
  • Loading branch information
mwennrich authored Mar 7, 2024
2 parents a73c85d + 4e54428 commit 1c4fea2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cmd/provisioner/createlv.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func mountLV(lvname, vgname, directory string) (string, error) {
}

// --make-shared is required that this mount is visible outside this container.
mountArgs := []string{"--make-shared", "-t", "ext4", lvPath, mountPath}
mountArgs := []string{"--make-shared", "--type", "ext4", lvPath, mountPath}
klog.Infof("mountlv command: mount %s", mountArgs)
cmd = exec.Command("mount", mountArgs...)
out, err = cmd.CombinedOutput()
Expand Down Expand Up @@ -234,7 +234,7 @@ func vgactivate() {
if err != nil {
klog.Infof("unable to scan for volumegroups:%s %v", out, err)
}
cmd = exec.Command("vgchange", "-ay")
cmd = exec.Command("vgchange", "--activate","y")
_, err = cmd.CombinedOutput()
if err != nil {
klog.Infof("unable to activate volumegroups:%s %v", out, err)
Expand All @@ -261,7 +261,7 @@ func createVG(name string, devicesPattern []string) (string, error) {
}
tags := []string{"vg.metal-stack.io/csi-lvm"}

args := []string{"-v", name}
args := []string{"--verbose", name}
args = append(args, physicalVolumes...)
for _, tag := range tags {
args = append(args, "--addtag", tag)
Expand Down Expand Up @@ -296,7 +296,7 @@ func createLVS(ctx context.Context, vg string, name string, size uint64, lvmType
return "", fmt.Errorf("size must be greater than 0")
}

args := []string{"-v", "-n", name, "-W", "y", "-L", fmt.Sprintf("%db", size)}
args := []string{"--verbose", "--name", name, "--wipesignatures", "y", "--yes", "--size", fmt.Sprintf("%db", size)}

pvs, err := pvCount(vg)
if err != nil {
Expand Down Expand Up @@ -330,7 +330,7 @@ func createLVS(ctx context.Context, vg string, name string, size uint64, lvmType
}

func pvCount(vgname string) (int, error) {
cmd := exec.Command("vgs", vgname, "--noheadings", "-o", "pv_count")
cmd := exec.Command("vgs", vgname, "--noheadings", "--options", "pv_count")
out, err := cmd.CombinedOutput()
if err != nil {
return 0, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/provisioner/revivelvs.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func reviveLVs(c *cli.Context) error {
return nil
}
}
cmd := exec.Command("lvchange", "-ay", vgName)
cmd := exec.Command("lvchange", "--activate","y", vgName)
out, err := cmd.CombinedOutput()
if err != nil {
klog.Infof("unable to activate logical volumes:%s %v", out, err)
Expand Down

0 comments on commit 1c4fea2

Please sign in to comment.