于 2011年09月21日 03:27, Eric Blake 写道:
On 09/20/2011 11:05 AM, Laine Stump wrote:
On 09/20/2011 04:38 AM, Osier Yang wrote:
If permissions (mode, uid, gid) are not specified, a new created vol
will get the permissions like:
mode = 0600
uid = -1
gid = -1
This will be a bit surprised if the user define the pool with a
non-root uid/gid, but the new created vol is still defined as
root/root.
This patch changes the behaviour so that the new created vol will
inherit the permissions of parent pool if permission are not
specified.
Should this behavior maybe be changed later on when the definition is
used, rather than during parsing? I tend to not like modifying the
incoming data as part of a parse (although I know we're already doing
that in some other places).
(Of course other people may have a different opinion, or there may be a
reason why my suggestion isn't feasible...)
I actually like the idea of keeping the user's data intact as long as
possible, so I agree with Laine on refactoring the patch to delay the
inheritance to the point of use when uid is still -1 (rather than
reassigning uid at the time of parse).
Agreed.
So I guess it's time to introduce some flags for virStorageVolumeCreateXML.
Such as:
typedef enum {
VIR_STORAGE_VOL_CREATE_INHERIT_PERMS_GRACEFUL (1 << 0),
VIR_STORAGE_VOL_CREATE_INHERIT_PERMS_FORCE (1 << 1),
} virStorageVolCreateFlags;
If *_INHERIT_PERMS_GRACEFULL is specified, the new created vol will
inherit permissions of parent's pool only when the perms are not specified.
E.g. A vol XML contains perms XML like:
<target>
<permissions>
<mode>0755</mode>
<gid>500</gid>
</permissions>
</target>
Then only *uid* will inherit from parent pool.
If *_INHERIT_PERMS_FORCE is specified, the new created vol will inherit
permissions of parent's pool anyway. This gives a choice for the user
who always want to inherite perms.
Thoughts?
Thanks
Osier
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list