Bugfixes, dont stop if fs already mounted in jail

This commit is contained in:
yo 2022-07-10 16:29:26 +02:00
parent 3dae685fc4
commit 1cb7c5fec7

View File

@ -222,16 +222,21 @@ func jailZfsDatasets(jail *Jail) error {
}
// Mount from inside jail if mountpoint is set
cmd = fmt.Sprintf("zfs get -H -o value mountpoint %s/%s", jail.JID, jail.Zpool, d)
cmd = fmt.Sprintf("zfs get -H -o value mountpoint %s/%s", jail.Zpool, d)
out, err = executeCommand(cmd)
if err != nil {
return errors.New(fmt.Sprintf("Error getting zfs dataset %s mountpoint: %v: out", d, err, out))
return errors.New(fmt.Sprintf("Error getting zfs dataset %s/%s mountpoint: %v: %s", jail.Zpool, d, err, out))
}
if len(out) > 0 && out != "-" && (false == strings.EqualFold(out, "none")) {
cmd = fmt.Sprintf("zfs mount %s", jail.Zpool, d)
//cmd = fmt.Sprintf("zfs mount %s/%s", jail.Zpool, d)
cmd = fmt.Sprintf("zfs mount -a")
out, err = executeCommandInJail(jail, cmd)
if err != nil {
return errors.New(fmt.Sprintf("Error mounting zfs dataset %s: %v: out", d, err, out))
// If already mounted, continue processing
if ! strings.HasSuffix(out, "filesystem already mounted\n") {
//return errors.New(fmt.Sprintf("Error mounting zfs dataset %s/%s: %v: %s", jail.Zpool, d, err, out))
return errors.New(fmt.Sprintf("Error executing \"zfs mount -a\" from inside jail: %v: %s", err, out))
}
}
}
}