According to lxc.container.conf manual page lxc.hook.pre-start is "A hook to be run in the host's namespace".
But from what I see it's not quite so:
1. /etc/pve/lxc/125.conf contains the following line
Executing lxc-start -Fn 125 gives the following output:
Note that actual running of "/sbin/ip -4 a" produces no output. Looks like the mount script has been put into the container's network namespace, which is created but not set up yet.
I want to make my nfs mounting task a scalable solution. I do not want to edit fstab on each and every Proxmox host within my cluster (though their number is not so big). I just don't know how else can I do it.
Any ideas?
But from what I see it's not quite so:
1. /etc/pve/lxc/125.conf contains the following line
lxc.hook.pre-mount: /etc/pve/lxc/${LXC_NAME}.mount
2. /etc/pve/lxc/125.mount is a shell script:#!/bin/sh
share="10.1.9.254:/nfs/mail
mntpoint="/mnt/nfs/mail"
echo ip -4 a >&2
/sbin/ip -4 a >&2
/sbin/showmount -e 10.1.9.254 >&2
/sbin/mount.nfs4 -vo rw,soft,nosuid,noacl,nolock,nocto,noatime,nodiratime,noac $share $mntpoint
share="10.1.9.254:/nfs/mail
mntpoint="/mnt/nfs/mail"
echo ip -4 a >&2
/sbin/ip -4 a >&2
/sbin/showmount -e 10.1.9.254 >&2
/sbin/mount.nfs4 -vo rw,soft,nosuid,noacl,nolock,nocto,noatime,nodiratime,noac $share $mntpoint
Executing lxc-start -Fn 125 gives the following output:
ip -4 a
clnt_create: RPC: Port mapper failure - Unable to send: errno 101 (Network is unreachable)
/sbin/mount.nfs4 -vvvo rw,soft,nosuid,noacl,nolock,nocto,noatime,nodiratime,noac 10.1.9.254:/mnt/raidpool/nfs/mail /mnt/nfs/mail
mount.nfs4: mount(2): Permission denied
mount.nfs4: access denied by server while mounting 10.1.9.254:/mnt/raidpool/nfs/mail
lxc-start: conf.c: run_buffer: 342 Script exited with status 32
lxc-start: conf.c: do_rootfs_setup: 3805 failed to run pre-mount hooks for container '125'.
lxc-start: conf.c: lxc_setup: 3892 Error setting up rootfs mount after spawn
lxc-start: start.c: do_start: 736 failed to setup the container
lxc-start: sync.c: __sync_wait: 51 invalid sequence number 1. expected 2
lxc-start: start.c: __lxc_start: 1211 failed to spawn '125'
clnt_create: RPC: Port mapper failure - Unable to send: errno 101 (Network is unreachable)
/sbin/mount.nfs4 -vvvo rw,soft,nosuid,noacl,nolock,nocto,noatime,nodiratime,noac 10.1.9.254:/mnt/raidpool/nfs/mail /mnt/nfs/mail
mount.nfs4: mount(2): Permission denied
mount.nfs4: access denied by server while mounting 10.1.9.254:/mnt/raidpool/nfs/mail
lxc-start: conf.c: run_buffer: 342 Script exited with status 32
lxc-start: conf.c: do_rootfs_setup: 3805 failed to run pre-mount hooks for container '125'.
lxc-start: conf.c: lxc_setup: 3892 Error setting up rootfs mount after spawn
lxc-start: start.c: do_start: 736 failed to setup the container
lxc-start: sync.c: __sync_wait: 51 invalid sequence number 1. expected 2
lxc-start: start.c: __lxc_start: 1211 failed to spawn '125'
Note that actual running of "/sbin/ip -4 a" produces no output. Looks like the mount script has been put into the container's network namespace, which is created but not set up yet.
I want to make my nfs mounting task a scalable solution. I do not want to edit fstab on each and every Proxmox host within my cluster (though their number is not so big). I just don't know how else can I do it.
Any ideas?