Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add --yes to lvcreate #62

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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