Container bind mounts via api

Jaakko

New Member
Dec 1, 2016
4
0
1
35
Hi

I have nfs mount in a proxmox server. I would like to bind it to container via json api.

I have managed to bind the nfs directory into container by configuring it by hand into file /etc/pve/lxe/<vmid>.conf
And everything works fine.

When i try to create new container with mp0 mountpoint via api with curl:

curl --insecure --cookie "$(<cookie)" --header "$(<csrftoken)" -X POST\
--data-urlencode net0="name=eth0,bridge=vmbr0,gw=x.x.x.x,ip=x.x.x.x/24,tag=8,type=veth" \
--data-urlencode net1="name=eth1,bridge=vmbr0,tag=x,type=veth" \
--data-urlencode ostemplate="Datastore:vztmpl/xxx.tar.gz" \
--data-urlencode cpulimit=1 \
--data-urlencode memory=3000 \
--data-urlencode storage=Datastore \
--data-urlencode mp0="/mnt/pve/test,mp=/test" \
--data vmid=$id \
https://$APINODE:8006/api2/json/nodes/$TARGETNODE/lxc

it returns: {"data":null}

when i remove the line: --data-urlencode mp0="/mnt/pve/test,mp=/test" \
container is successfully created.

What i am doing wrong?
 
this is only possible for the root user, and you need to pass a rootfs as well if you define mount points. note that you can use "rootfs=Datastore:5" to allocate and use a new volume with 5 GB on storage Datastore