[libvirt] [PATCH 2/4] Avoid LXC pivot root in the root source is still /

Eric Blake eblake at redhat.com
Mon May 14 22:26:30 UTC 2012


On 05/11/2012 10:48 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> If the LXC config has a filesystem
> 
>   <filesystem>
>      <source dir='/'/>
>      <target dir='/'/>
>   </filesystem>
> 
> then there is no need to go down the pivot root codepath.
> We can simply use the existing root as needed.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/lxc/lxc_container.c |   17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 

> @@ -1192,10 +1201,14 @@ static int lxcContainerSetupMounts(virDomainDefPtr vmDef,
>      if (lxcContainerResolveSymlinks(vmDef) < 0)
>          return -1;
>  
> -    if (root)
> +    /* If the user has specified a dst '/' with a source of '/'
> +     * then we don't really want to go down the pivot root
> +     * path, as we're just tuning the existing root
> +     */
> +    if (root && root->src && STRNEQ(root->src, "/"))

Do we want to handle users that spell things as "///" instead of "/"?
But that's a corner case that doesn't affect this change.

ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120514/635a9907/attachment-0001.sig>


More information about the libvir-list mailing list