Skip to content

Commit

Permalink
only set LIBGUESTFS_HV for ppc64le on el7
Browse files Browse the repository at this point in the history
It appears the newer P9 hardware that we are utilizing that is running
a Fedora stack doesn't need this. Local testing seems to work fine.

Let's hack around this for now while we still have el7 clusters.
  • Loading branch information
dustymabe committed Aug 16, 2022
1 parent 970ebdc commit 008e04c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 13 additions & 1 deletion mantle/platform/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import (
"github.com/coreos/mantle/system"
"github.com/coreos/mantle/system/exec"
"github.com/pkg/errors"

"golang.org/x/sys/unix"
)

var (
Expand Down Expand Up @@ -658,10 +660,20 @@ func newGuestfish(diskImagePath string, diskSectorSize int) (*coreosGuestfish, e
guestfishArgs = append(guestfishArgs, "-a", diskImagePath)
cmd := exec.Command("guestfish", guestfishArgs...)
cmd.Env = append(os.Environ(), "LIBGUESTFS_BACKEND=direct")

// Hack to run with a wrapper on older P8 hardware running RHEL7
switch system.RpmArch() {
case "ppc64le":
cmd.Env = append(cmd.Env, "LIBGUESTFS_HV=/usr/lib/coreos-assembler/libguestfs-ppc64le-wrapper.sh")
u := unix.Utsname{}
if err := unix.Uname(&u); err != nil {
return nil, errors.Wrapf(err, "detecting kernel information")
}
if strings.Contains(fmt.Sprintf("%s", u.Release), "el7") {
plog.Infof("Detected el7. Running using libguestfs-ppc64le-wrapper.sh")
cmd.Env = append(cmd.Env, "LIBGUESTFS_HV=/usr/lib/coreos-assembler/libguestfs-ppc64le-wrapper.sh")
}
}

// make sure it inherits stderr so we see any error message
cmd.Stderr = os.Stderr
stdout, err := cmd.StdoutPipe()
Expand Down
6 changes: 5 additions & 1 deletion src/libguestfish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export LIBGUESTFS_BACKEND=direct

arch=$(uname -m)


# Hack to run with a wrapper on older P8 hardware running RHEL7
if [ "$arch" = "ppc64le" ] ; then
export LIBGUESTFS_HV="/usr/lib/coreos-assembler/libguestfs-ppc64le-wrapper.sh"
if [[ "$(uname -r)" =~ "el7" ]]; then
export LIBGUESTFS_HV="/usr/lib/coreos-assembler/libguestfs-ppc64le-wrapper.sh"
fi
fi

# http://libguestfs.org/guestfish.1.html#using-remote-control-robustly-from-shell-scripts
Expand Down

0 comments on commit 008e04c

Please sign in to comment.