Skip to contentSkip to conversation

Map overrides

DISCUSSION Daniel Richard G. 2 participants 9 messages Jul 12, 2006 – Jul 13, 2006 Kernel automounter

lore
Share & tools
lore
#0 lore raw

[The "next-gen LDAP schema" problem will have to simmer for a while, but in the meantime, I've another little nut to crack on this list]

Map overrides. I'd like to have an indirect map that is normally pulled from LDAP/Hesiod/etc.---but not necessarily 100% of the time. Sometimes, a key will have to map to something other than the "canonical" location, and on a locally-visible-only basis at that.

Real-life example: Let's say I have a straightforward NFS-homedir setup, and a user "foo". So you'd typically see e.g.

fuzzball:/srv/users/foo on /nfshome/foo type nfs

But what if, for some reason, the workstation cannot contact the fuzzball server? (Assume no server replication.) Then, I'd like to create a temporary homedir, e.g.

	/nfshome/foo -> /var/tmphomedir/foo	(symlink)

so that the user can at least log in and check mail et al.

(There are other use cases, but this is probably the least convoluted one I can think of. Note: My scenario would be with AFS, but I used NFS above because it really shouldn't matter.)

Right now, I can sort-of get this behavior via a program map, one that returns the /var/*** path when necessary. Of course, if I want LDAP/Hesiod lookups to be the common case, then those have to be built into the program map as well, making autofs's built-in lookup code redundant. Right now, I can't say to autofs "First, check if program map A returns some special-case path; if not, then use whatever directory service B says."

This would be a sort of failover for maps, in general terms: if the first map doesn't succeed, try the second one, and so on. This is a bit iffy when you're talking about directory services failing, because that usually involves a longish timeout. But a program map can fail immediately, thereby making itself transparent at the top of such a failover stack.

First of all, is there a way to do this currently?

If not, should I expect any difficulty in implementing this? On the configuration side, I would think that extending the syntax to support this behavior should be straightforward: just allow multiple entries for the same mountpoint in auto.master.

--Daniel

Signature · 6 lines
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = [email protected]        ##  don't smell bad---    (/o|o\) /
EMAIL2 = [email protected]      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)
maintainer
#1 lore raw
Quoted 42 lines · Daniel Richard G.

[The "next-gen LDAP schema" problem will have to simmer for a while, but in the meantime, I've another little nut to crack on this list]

Map overrides. I'd like to have an indirect map that is normally pulled from LDAP/Hesiod/etc.---but not necessarily 100% of the time. Sometimes, a key will have to map to something other than the "canonical" location, and on a locally-visible-only basis at that.

Real-life example: Let's say I have a straightforward NFS-homedir setup, and a user "foo". So you'd typically see e.g.

fuzzball:/srv/users/foo on /nfshome/foo type nfs

But what if, for some reason, the workstation cannot contact the fuzzball server? (Assume no server replication.) Then, I'd like to create a temporary homedir, e.g.

	/nfshome/foo -> /var/tmphomedir/foo	(symlink)

so that the user can at least log in and check mail et al.

(There are other use cases, but this is probably the least convoluted one I can think of. Note: My scenario would be with AFS, but I used NFS above because it really shouldn't matter.)

Right now, I can sort-of get this behavior via a program map, one that returns the /var/*** path when necessary. Of course, if I want LDAP/Hesiod lookups to be the common case, then those have to be built into the program map as well, making autofs's built-in lookup code redundant. Right now, I can't say to autofs "First, check if program map A returns some special-case path; if not, then use whatever directory service B says."

This would be a sort of failover for maps, in general terms: if the first map doesn't succeed, try the second one, and so on. This is a bit iffy when you're talking about directory services failing, because that usually involves a longish timeout. But a program map can fail immediately, thereby making itself transparent at the top of such a failover stack.

Quoted 6 lines

First of all, is there a way to do this currently?

If not, should I expect any difficulty in implementing this? On the configuration side, I would think that extending the syntax to support this behavior should be straightforward: just allow multiple entries for the same mountpoint in auto.master.

This is done (not to well in v4) in the mount_nfs.c module as the mount syntax (at least in autofs maps not, mount itself) allows it.

It's not as simple to do as first appears.
To extend it to cater for multiple source formats would be really messy.

Perhaps one way to approach this would be to teach the hesoid lookup module to convert these entries into the format that mount_nfs.c can use to perform the selection. For example if one of the entries is localhost then autofs will perform a bind mount. We would probably need to teach mount_afs.c something similar. It's probably not sensible to mix AFS and NFS in the same entry anyway.

So no, not that simple.

Ian

#2 lore raw
Quoted 3 lines · Ian Kent

This is done (not to well in v4) in the mount_nfs.c module as the mount syntax (at least in autofs maps not, mount itself) allows it.

I should've been more clear: This would be completely apart from the replicated-server-selection mechanism. My example might not have been the best, as it presents this parallel that has to be disavowed.

Another scenario: Say that you have a (read-only) volume that's normally NFS-mounted. Imagine a framework that would allow you to copy that volume in its entirety to your local disk, and then have autofs "mount" the volume by symlinking the local copy. Whether it be to avoid network latency, or because you're on a laptop and want to go off-net.

So there's nothing going on here w.r.t. checking whether an NFS/AFS server is up. It's about overriding what autofs would usually do---to have a program map return the (special-case) local path, preempting the usual LDAP/Hesiod request. (And if and only if the program map gives no answer, go ahead and do the LDAP/Hesiod lookup.)

Quoted 2 lines

It's not as simple to do as first appears.
To extend it to cater for multiple source formats would be really messy.

My intuition was that it would involve extending struct master / master_mapent in some way, so that a single indirect map mountpoint could have multiple definitions. (Or perhaps the structure could stay the same--- it does appear to be in a linked list---and the restriction lifted on the uniqueness of indirect map mountpoints?)

I mean, what you would have in the configuration file is something like

/mit program,hesiod:/sbin/myprogmap
/mit ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

i.e. two entries that could be completely independent, and are no different syntactically from what exists now. Just that autofs would try them in order when resolving a key in /mit.

Quoted 5 lines

Perhaps one way to approach this would be to teach the hesoid lookup module to convert these entries into the format that mount_nfs.c can use to perform the selection. For example if one of the entries is localhost then autofs will perform a bind mount. We would probably need to teach mount_afs.c something similar.

Eeegh... I really wasn't thinking that the modules would have to be aware of this.

Quoted 1 line

It's probably not sensible to mix AFS and NFS in the same entry anyway.

Why not? :) Imagine a (public, read-only) volume that's normally AFS-mounted, but has an NFS backup. As NFS is dead easy to set up, it's a good option for emergency use.

Quoted 1 line

So no, not that simple.

I hope this is due to my not having conveyed the idea very well....

--Daniel

Signature · 6 lines
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = [email protected]        ##  don't smell bad---    (/o|o\) /
EMAIL2 = [email protected]      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)
maintainer
#3 lore raw
Quoted 15 lines · Daniel Richard G.
Quoted 3 lines · Ian Kent

This is done (not to well in v4) in the mount_nfs.c module as the mount syntax (at least in autofs maps not, mount itself) allows it.

I should've been more clear: This would be completely apart from the replicated-server-selection mechanism. My example might not have been the best, as it presents this parallel that has to be disavowed.

Another scenario: Say that you have a (read-only) volume that's normally NFS-mounted. Imagine a framework that would allow you to copy that volume in its entirety to your local disk, and then have autofs "mount" the volume by symlinking the local copy. Whether it be to avoid network latency, or because you're on a laptop and want to go off-net.

Quoted 5 lines

So there's nothing going on here w.r.t. checking whether an NFS/AFS server is up. It's about overriding what autofs would usually do---to have a program map return the (special-case) local path, preempting the usual LDAP/Hesiod request. (And if and only if the program map gives no answer, go ahead and do the LDAP/Hesiod lookup.)

OK. Maybe a multi-map entry in the master map will work for this.

Quoted 10 lines
Quoted 3 lines

It's not as simple to do as first appears.
To extend it to cater for multiple source formats would be really messy.

My intuition was that it would involve extending struct master / master_mapent in some way, so that a single indirect map mountpoint could have multiple definitions. (Or perhaps the structure could stay the same--- it does appear to be in a linked list---and the restriction lifted on the uniqueness of indirect map mountpoints?)

Quoted 4 lines

I mean, what you would have in the configuration file is something like

/mit program,hesiod:/sbin/myprogmap
/mit ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

/mit program,hesiod:/sbin/myprogmap -- ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

It should behave the way you need.

Quoted 11 lines

i.e. two entries that could be completely independent, and are no different syntactically from what exists now. Just that autofs would try them in order when resolving a key in /mit.

Quoted 5 lines

Perhaps one way to approach this would be to teach the hesoid lookup module to convert these entries into the format that mount_nfs.c can use to perform the selection. For example if one of the entries is localhost then autofs will perform a bind mount. We would probably need to teach mount_afs.c something similar.

Quoted 8 lines

Eeegh... I really wasn't thinking that the modules would have to be aware of this.

Quoted 1 line

It's probably not sensible to mix AFS and NFS in the same entry anyway.

Why not? :) Imagine a (public, read-only) volume that's normally AFS-mounted, but has an NFS backup. As NFS is dead easy to set up, it's a good option for emergency use.

In the same entry?
The Hesoid format can't have AFS and NFS for the same map entry can it?

Ian

#4 lore raw
Quoted 7 lines · Ian Kent
Quoted 6 lines

So there's nothing going on here w.r.t. checking whether an NFS/AFS server is up. It's about overriding what autofs would usually do---to have a program map return the (special-case) local path, preempting the usual LDAP/Hesiod request. (And if and only if the program map gives no answer, go ahead and do the LDAP/Hesiod lookup.)

Quoted 5 lines

OK. Maybe a multi-map entry in the master map will work for this.

/mit program,hesiod:/sbin/myprogmap -- ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

It should behave the way you need.

[I wasn't able to get autofs beta6 up and going to answer this, though a glance at the code implies that the answer is "no"...]

Is this implemented already? Or are you saying that you'd prefer this minor extension to the master map syntax instead of allowing redundant entries?

Quoted 6 lines
Quoted 3 lines

Why not? :) Imagine a (public, read-only) volume that's normally AFS-mounted, but has an NFS backup. As NFS is dead easy to set up, it's a good option for emergency use.

In the same entry?
The Hesoid format can't have AFS and NFS for the same map entry can it?

A single Hesiod record can't specify both, but it can handle one or the other. So if you had a situation that could return one of two possible records then this would work.

--Daniel

Signature · 6 lines
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = [email protected]        ##  don't smell bad---    (/o|o\) /
EMAIL2 = [email protected]      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)
maintainer
#5 lore raw
Quoted 12 lines · Daniel Richard G.
Quoted 11 lines · Ian Kent
Quoted 6 lines

So there's nothing going on here w.r.t. checking whether an NFS/AFS server is up. It's about overriding what autofs would usually do---to have a program map return the (special-case) local path, preempting the usual LDAP/Hesiod request. (And if and only if the program map gives no answer, go ahead and do the LDAP/Hesiod lookup.)

OK. Maybe a multi-map entry in the master map will work for this.

/mit program,hesiod:/sbin/myprogmap -- ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

Quoted 7 lines
Quoted 1 line

It should behave the way you need.

[I wasn't able to get autofs beta6 up and going to answer this, though a glance at the code implies that the answer is "no"...]

Is this implemented already? Or are you saying that you'd prefer this minor extension to the master map syntax instead of allowing redundant entries?

This is part of the original autofs implementation so it's definitely available in v4 and so must be carried through to v5 for backward compatibility.

And having a quick look at the code suggests that it could be made to function the way you require with some minor changes.

Ian

maintainer
#6 lore raw
Quoted 9 lines · Ian Kent
Quoted 8 lines · Daniel Richard G.
Quoted 7 lines · Ian Kent
Quoted 6 lines

So there's nothing going on here w.r.t. checking whether an NFS/AFS server is up. It's about overriding what autofs would usually do---to have a program map return the (special-case) local path, preempting the usual LDAP/Hesiod request. (And if and only if the program map gives no answer, go ahead and do the LDAP/Hesiod lookup.)

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

OK. Maybe a multi-map entry in the master map will work for this.

/mit program,hesiod:/sbin/myprogmap -- ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

However I think my syntax is wrong.
It should be
/mit multi:program,hesiod:/sbin/myprogmap -- ldap,hesiod://foo/ou=auto.indirect,dc=mit,dc=edu

Quoted 22 lines
Quoted 8 lines
Quoted 2 lines

It should behave the way you need.

[I wasn't able to get autofs beta6 up and going to answer this, though a glance at the code implies that the answer is "no"...]

Is this implemented already? Or are you saying that you'd prefer this minor extension to the master map syntax instead of allowing redundant entries?

This is part of the original autofs implementation so it's definitely available in v4 and so must be carried through to v5 for backward compatibility.

And having a quick look at the code suggests that it could be made to function the way you require with some minor changes.

Ian

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#7 lore raw
In reply to Ian Kent
Quoted 3 lines · Ian Kent

And having a quick look at the code suggests that it could be made to function the way you require with some minor changes.

So this is all in lookup_multi.c, eh? Interesting.

This looks like it should do the trick... but since I'm not yet up on all the subtleties, what sort of changes do you anticipate this needing?

--Daniel

Signature · 6 lines
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = [email protected]        ##  don't smell bad---    (/o|o\) /
EMAIL2 = [email protected]      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)
maintainer
#8 lore raw
Quoted 9 lines · Daniel Richard G.
Quoted 3 lines · Ian Kent

And having a quick look at the code suggests that it could be made to function the way you require with some minor changes.

So this is all in lookup_multi.c, eh? Interesting.

This looks like it should do the trick... but since I'm not yet up on all the subtleties, what sort of changes do you anticipate this needing?

The only thing I noticed in the brief look I had was that in the library initialization routine it gives up if it can't open a map which is not what we want. Changing it to succeed if at least one map works may be all that's needed.

Ian