[libvirt] [PATCH RESEND] libvirt: lxc: fix incorrect parameter of lxcContainerMountProcFuse

Gao feng gaofeng at cn.fujitsu.com
Fri Jan 11 01:59:07 UTC 2013


On 2013/01/11 07:36, Kamezawa Hiroyuki wrote:
> (2013/01/09 23:16), Michal Privoznik wrote:
>> On 09.01.2013 12:01, Gao feng wrote:
>>> when we has no host's src mapped to container.
>>> there is no .oldroot dir,so libvirt lxc will fail
>>> to start when mouting meminfo.
>>>
>>> in this case,the parameter srcprefix of function
>>> lxcContainerMountProcFuse should be NULL.and make
>>> this method handle NULL correctly.
>>>
>>> Signed-off-by: Gao feng <gaofeng at cn.fujitsu.com>
>>> ---
>>>   src/lxc/lxc_container.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
>>> index d234426..9f22923 100644
>>> --- a/src/lxc/lxc_container.c
>>> +++ b/src/lxc/lxc_container.c
>>> @@ -605,7 +605,7 @@ static int lxcContainerMountProcFuse(virDomainDefPtr def,
>>>
>>>       if ((ret = virAsprintf(&meminfo_path,
>>>                              "%s/%s/%s/meminfo",
>>> -                           srcprefix, LXC_STATE_DIR,
>>> +                           srcprefix ? srcprefix : "", LXC_STATE_DIR,
>>>                              def->name)) < 0)
>>>           return ret;
>>>
>>> @@ -2059,7 +2059,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef,
>>>           goto cleanup;
>>>
>>>       /* Mounts /proc/meminfo etc sysinfo */
>>> -    if (lxcContainerMountProcFuse(vmDef, "/.oldroot") < 0)
>>> +    if (lxcContainerMountProcFuse(vmDef, NULL) < 0)
>>>           goto cleanup;
>>>
>>>       /* Now we can re-mount the cgroups controllers in the
>>>
>>
>> Now pushed. Thanks.
>>
> 
> Isn't it better to add following implicitly ?
> 
>   <filesystem type='mount' accessmode='passthrough'>
>       <source dir='/'/>
>       <target dir='/'/>
>   </filesystem>
> 
> Then, non-chroot lxc container will run the same code path with chroot container.
> No ?
> 

I'm not quite understand what's the difference between passing host's root
to container and nothing being passed to container.

It seems one difference is if the /dev directory is shared between host and
container?

Thanks.




More information about the libvir-list mailing list