[Users] Mount bind and NFS

Mathieu Blanc mathieu.blanc at smile.fr
Wed Jan 20 13:04:41 EST 2010


Hello,

I've a problem with the ctid.mount script and nfs.
I'll try to explain my problem despite my poor english :p (sorry for that)

I have 2 hosts on network 1 : host A & host B
These 2 hosts launch 2 VM : vm1 on host A & vm2 on host B

These 2 VM are on a network 2. They use veth. It's not possible for the
VM to access to the hosts. Network 1 & 2 are strictly separated.

Now, on host A, i've an NFS export : /mnt/nfs.
I mount this directory on host B in /mnt/nfs.

No problem with this, it works perfectly and it's not related to OpenVZ ;)

Now i'd like to access these directories inside my VM.
So i put <ctid_vm1>.mount on host A with :
mount --bind /mnt/nfs/hfdfsfsdfsd /var/lib/vz/root/vm1/var/hfhfhfhfhf

I put the same script on host B :
mount --bind /mnt/nfs/hfdfsfsdfsd /var/lib/vz/root/vm2/var/hfhfhfhfhf

I start the VM2, and it works perfectly. I can create inside my VM2 some
files in the /var/hfhfhfhfhf which, in fact, is on host A.

The problem is here :
vm2~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
[...]
192.168.2.4:/mnt/nfs
                     259505152 140153856 105509888  58% /var/hfhfhfhfhf

192.168.2.4 is the IP of host A.

Inside the VM, the mount --bind appears to be a nfs mount, and when i
want to shutdown the VM, the umount script does not work, because it
tries to connect to host A, which is not possible because vm2 and the
host A are not on the same network...
This is the umount.nfs script which is called (because the mount in the
vm2 is shown as a nfs mount) to umount it and it causes this problem.

vm2:~# strace -p 1394
Process 1394 attached - interrupt to quit
connect(3, {sa_family=AF_INET, sin_port=htons(111),
sin_addr=inet_addr("192.168.2.4")}, 16^C <unfinished ...>
Process 1394 detached

This connection is impossible in my case as i said...
After a timeout, the VM2 got signal 9 :)

So, what can i do ? My hosts and VM are separated and i have to share
/mnt/nfs beetween all my vm and hosts... I thought that mount --bind
would help me but it seems it's not the case :(

Is there a better architecture for my needs ? Or a openvz tricks that i
don't know ? Or maybe this is just a bug ?

I am on Debian Lenny HN :
hostB:~# uname -a
Linux hostB 2.6.26-2-openvz-amd64 [...]

If there is no solution, i'll bridge another card on the VM to put the
VM on the network A (network of the hosts) but if i could avoid this,
this would be great...

Thank you very much !

Mathieu


More information about the Users mailing list