Mount-Points: documentation incomplete, behaviour surprising

Bug #143144 reported by Dieter Maurer
12
Affects Status Importance Assigned to Milestone
Zope 2
Fix Released
Medium
Unassigned

Bug Description

The "mount-point" documentation says:

   The mount point is the slash-separated path to which this database will be mounted within the Zope application server.

This is at least incomplete. In fact, the mount-point spec has the form "virtual_path [: real_path]". "virtual_path" describes the path in the mounting Zope instance and "real_path" the path in the mounted storage. Furthermore,
"real_path" allows a special syntax to specify a non-standard root.

Unfortunately, the default "real_path" is equal to "virtual_path". If "virtual_path" is non-trivial, this
leads to a very strange (and mount position dependent)
structure in the storage.

At least, the documentation needs to be completed.

If possible, "real_path" should get a more senseful
default value. Unfortunately, the most natural
value "/" will not work. Thus, maybe, it is not possible.

Tags: bugday
Revision history for this message
Andreas Jung (ajung) wrote :

Status: Pending => Accepted

 Supporters added: ajung

Revision history for this message
Andreas Jung (ajung) wrote :

SVN trunk: updated the docs in zopeschema.xml for the extended notation.

No idea about the default value '/'...maybe Tim or some other ZODB can comment on this.

Revision history for this message
Andreas Jung (ajung) wrote :

SVN trunk: updated the docs in zopeschema.xml for the extended notation.

No idea about the default value '/'...maybe Tim or some other ZODB guru can comment on this.

Revision history for this message
Tim Peters (tim-one) wrote :

Sorry, Andreas, I don't know anything about mount points. Shane or Jim are the best hopes for that.

Revision history for this message
Florent Guillaume (efge) wrote :

On the contrary, in my use cases having real_path default to virtual_path is exactly what I want: It means that if I see the mounted storage directly, on its own, then the would-be-mounted objects still have the same paths.

So the default makes sense for me, and it does not for you. We can't both win :-)

Proposing to close this entry.

Revision history for this message
Andreas Jung (ajung) wrote :

Status: Accepted => Wontfix

Revision history for this message
Jean Jordaan (jean-jordaan) wrote :

I propose changing the text in zopeschema.xml to something like the following to make it more closely match the code:

       The mount point is the slash-separated path to an object in the
       database to be mounted within the Zope application server. By default,
       the object will be mounted at the same path in Zope (i.e. '/foo/bar'
       in the database will be mounted at '/foo/bar' in Zope). The object can
       be mounted at a different point using the 'virtual_path:real_path'
       syntax (e.g. 'mount-point /baz:/foo/bar' will mount the object at
       '/foo/bar' in the database to '/baz' in Zope). It is also possible to
       specify the root that should be used in the mounted database by using
       the syntax 'virtual_path:~real_root:real_path'. The root defaults to
       'Application' and should not normally be changed.

Revision history for this message
Jean Jordaan (jean-jordaan) wrote :

After some more trying out virtual mount points, it looks as if they are half baked and shouldn't be used.
For example, they don't work with getPhysicalPath and so break Plone's URLTool. I have this in my config:

mount-point /mnt_clme:/clme

During a ZEXP import I get a KeyError on 'clme'. This is what investigation shows:

(Pdb) url_tool
<URLTool at /clme/CLME/portal_url used for
/clme/CLME/online-forums/livestock-and-environmnet/794325627/794761425>
(Pdb) url_tool.getPortalPath()
'/clme/CLME'

(Pdb) start_path
'/clme/CLME/portal_skins'
(Pdb) context.restrictedTraverse(start_path + '/custom')
*** KeyError: 'clme'
(Pdb) context.restrictedTraverse('/mnt_clme/CLME/portal_skins' + '/custom')
<Folder at /clme/CLME/portal_skins/custom>

(Pdb) self.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.mnt_clme
<Folder at /clme>
(Pdb) self.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.aq_parent.mnt_clme.getPhysicalPath()
('', 'clme')

The same is reflected in the sort order of the mount points in the ZMI: sorting is according to 'clme' (the underlying object), not 'mnt_clme' (the mount name).

This is with Zope 2.9.8

Changed in zope2:
status: Won't Fix → New
Revision history for this message
Jean Jordaan (jean-jordaan) wrote :

From Dylan Jay on http://plone.org/support/forums/general#nabble-td3390613|a3390613 :

Not only are virtual mount points a little known feature but it has an even less known caveat. The last part of the virtual path and real path needs to be the same name. ie

"mount-point /mnt/clme:/clme" is ok but "mount-point /mnt_clme:/clme" isn't.

Revision history for this message
Jean Jordaan (jean-jordaan) wrote :

Revised text for zopeschema.xml:

       The mount point is the slash-separated path to an object in the
       database that will be mounted within the Zope application server.
       By default, the object will be mounted at the same path in Zope (i.e.
       '/foo/bar' in the database will be mounted at '/foo/bar' in Zope).

       The object can be mounted at a different point using the
       'virtual_path:real_path' syntax (e.g.
       'mount-point /foo/bar:/bar' will mount the object at '/bar'
       in the database to '/foo/bar' in Zope). The name of the mount point
       ('bar') must be the same as the mounted object.

       It is also possible to specify the root that should be used in the
       mounted database by using the syntax
       'virtual_path:~real_root:real_path'. The root defaults to 'Application'
       and should not normally be changed.

Revision history for this message
Dieter Maurer (d.maurer) wrote :

The newly proposed documentation is almost perfect.

In my view, there is only one more aspect that could be improved: The term "mount-point" emphasizes the mounting application while the proposal puts the mounted object in the first place. I therefore suggest to slightly modify the first paragraph to: "The mount point is a slash-separated path to a 'Products.ZODBMountPoint.Mount.MountPoint' instance in Zope. If such an instance exists, it can mount an object (the mounted object) into Zope. By default, this object is located by the same path. ...."

Tres Seaver (tseaver)
Changed in zope2:
status: New → Triaged
tags: added: bugday
removed: bug zope
Changed in zope2:
assignee: Andreas Jung (ajung) → Jens Vagelpohl (jens-dataflake)
Revision history for this message
Jens Vagelpohl (dataflake-deactivatedaccount-deactivatedaccount) wrote :

The documentation update including Dieter's final suggestion have now been merged in.

Zope 2.12 branch: http://svn.zope.org/?rev=112553&view=rev

Zope trunk: http://svn.zope.org/?rev=112554&view=rev

Changed in zope2:
status: Triaged → Fix Committed
Changed in zope2:
milestone: none → 2.12.7
Changed in zope2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.