<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE>
BLOCKQUOTE {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
BODY {
LINE-HEIGHT: 1.5; FONT-FAMILY: ΢ÈíÑźÚ; COLOR: #000000; FONT-SIZE: 10.5pt
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.7601.17514"></HEAD>
<BODY style="MARGIN: 10px">
<DIV>
<DIV>Hi Alex,</DIV>
<DIV>I noticed you did lots of work about lxc-enter-namespace function. There is
one thing really confusing me and I really want to consult with you about
it.</DIV>
<DIV> </DIV>
<DIV>When I execute lxc-enter-namespace to get disk space info for lxc container
under different libvirt version, It return different execution results. Details
are as following:</DIV>
<DIV> </DIV>
<DIV>Under libvirt of version 1.0.2 with unbuntu host OS:</DIV>
<DIV>
</DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<DIV style="FONT-SIZE: 8pt"># disk space info of Host</DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc-gq:~$ df
-hl
</DIV>
<DIV style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV style="FONT-SIZE: 8pt">/dev/loop7
20G 16G 3.2G 84% /</DIV>
<DIV
style="FONT-SIZE: 8pt">udev
2.0G 12K 2.0G 1% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
791M 300K 791M 1% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">none
5.0M 4.0K 5.0M 1% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">none
2.0G 0 2.0G 0% /run/shm</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
2.0G 0 2.0G 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/nbd5
93M 1.6M 87M 2% /home/ubuntu/test</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc-gq:~$ vir version</DIV>
<DIV style="FONT-SIZE: 8pt">Compiled against library: libvirt 1.0.2</DIV>
<DIV style="FONT-SIZE: 8pt">Using library: libvirt 1.0.2</DIV>
<DIV style="FONT-SIZE: 8pt">Using API: LXC 1.0.2</DIV>
<DIV style="FONT-SIZE: 8pt">Running hypervisor: LXC 3.8.0</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc-gq:~$ vir list</DIV>
<DIV style="FONT-SIZE: 8pt">Id
Name
State</DIV>
<DIV
style="FONT-SIZE: 8pt">----------------------------------------------------</DIV>
<DIV style="FONT-SIZE: 8pt">3241
instance-0000004b
running</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"># disk space info of instance</DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc-gq:~$ vir lxc-enter-namespace
3241 /bin/df -hl </DIV>
<DIV style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV style="FONT-SIZE: 8pt">/dev/nbd1
1.4G 956M 329M 75% /</DIV>
<DIV
style="FONT-SIZE: 8pt">devfs
64K 8.0K 56K 13% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
64K 0 64K 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">none
396M 12M 384M 3% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">none
5.0M 0 5.0M 0% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">none
2.0G 0 2.0G 0% /run/shm</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 10.5pt">Then I logged into the lxc container :</DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc-gq:~$ ssh -i id_rsa_lxc
ubuntu@10.0.0.4
</DIV>
<DIV style="FONT-SIZE: 8pt">Welcome to Ubuntu 12.04.2 LTS (GNU/Linux
3.8.0-25-generic x86_64)</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">* Documentation:
https://help.ubuntu.com/</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">System information disabled due to load higher
than 2.0</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> Get cloud support with Ubuntu Advantage
Cloud Guest:</DIV>
<DIV style="FONT-SIZE: 8pt">
http://www.ubuntu.com/business/services/cloud</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> Use Juju to deploy your cloud instances
and workloads:</DIV>
<DIV style="FONT-SIZE: 8pt">
https://juju.ubuntu.com/#cloud-precise</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">0 packages can be updated.</DIV>
<DIV style="FONT-SIZE: 8pt">0 updates are security updates.</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">Last login: Thu Aug 8 07:30:04 2013 from
10.0.0.1</DIV>
<DIV style="FONT-SIZE: 8pt">To run a command as administrator (user "root"),
use "sudo <command>".</DIV>
<DIV style="FONT-SIZE: 8pt">See "man sudo_root" for details.</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc3:~$ df -hl</DIV>
<DIV style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV style="FONT-SIZE: 8pt">/dev/nbd1
1.4G 956M 328M 75% /</DIV>
<DIV
style="FONT-SIZE: 8pt">devfs
64K 8.0K 56K 13% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
64K 0 64K 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">none
396M 12M 384M 3% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">none
5.0M 0 5.0M 0% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">none
2.0G 0 2.0G 0%
/run/shm</DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV>From above, We can see under libvirt version 1.0.2, through
lxc-enter-namespace, disk space info can be obtained and it's the same as info
got from lxc inside.</DIV>
<DIV> </DIV>
<DIV>But when I did the same thing under libvirt of version 1.1.0 with debian
host OS, the execution result changed:</DIV>
<DIV> </DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>
<DIV style="FONT-SIZE: 8pt">#disk info of host</DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ df -hl</DIV>
<DIV
style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV
style="FONT-SIZE: 8pt">rootfs
4.0G 1.6G 2.2G 42% /</DIV>
<DIV
style="FONT-SIZE: 8pt">udev
10M 0 10M 0% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
4.8G 468K 4.8G 1% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/disk/by-uuid/12bb656b-4f80-4386-aa07-4bf90a3111b4
4.0G 1.6G 2.2G 42% /</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
5.0M 4.0K 5.0M 1% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
9.9G 0 9.9G 0% /run/shm</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda8
428G 112G 313G 27% /home</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda6
7.9G 159M 7.8G 2% /tmp</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda5
16G 2.7G 14G 17% /var</DIV>
<DIV
style="FONT-SIZE: 8pt">cgroup_root
24G 0 24G 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/nbd5
1.4G 851M 466M 65%
/home/openstack/stack/data/nova/instances/eed45ccb-3707-4815-9ae4-c7a2f56adb64/rootfs</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ vir version</DIV>
<DIV style="FONT-SIZE: 8pt">Compiled against library: libvirt 1.1.0</DIV>
<DIV style="FONT-SIZE: 8pt">Using library: libvirt 1.1.0</DIV>
<DIV style="FONT-SIZE: 8pt">Using API: LXC 1.1.0</DIV>
<DIV style="FONT-SIZE: 8pt">Running hypervisor: LXC 3.2.46</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ vir list</DIV>
<DIV style="FONT-SIZE: 8pt">Id
Name
State</DIV>
<DIV
style="FONT-SIZE: 8pt">----------------------------------------------------</DIV>
<DIV style="FONT-SIZE: 8pt">6096
instance-00000037
running</DIV>
<DIV style="FONT-SIZE: 8pt">27981
instance-00000038
running</DIV>
<DIV style="FONT-SIZE: 8pt">30846
instance-0000001a
running</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ vir
lxc-enter-namespace instance-00000037 /bin/df -hl</DIV>
<DIV style="FONT-SIZE: 8pt">libvirt: error : argument unsupported:
Security model cannot be entered</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ vir
lxc-enter-namespace instance-00000037 --noseclabel /bin/df -hl</DIV>
<DIV
style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV
style="FONT-SIZE: 8pt">rootfs
4.0G 1.6G 2.2G 42% /</DIV>
<DIV
style="FONT-SIZE: 8pt">udev
10M 0 10M 0% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
4.8G 468K 4.8G 1% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/disk/by-uuid/12bb656b-4f80-4386-aa07-4bf90a3111b4
4.0G 1.6G 2.2G 42% /</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
5.0M 4.0K 5.0M 1% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
9.9G 0 9.9G 0% /run/shm</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda8
428G 112G 313G 27% /home</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda6
7.9G 159M 7.8G 2% /tmp</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/sda5
16G 2.7G 14G 17% /var</DIV>
<DIV
style="FONT-SIZE: 8pt">cgroup_root
24G 0 24G 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">/dev/nbd5
1.4G 851M 466M 65%
/home/openstack/stack/data/nova/instances/eed45ccb-3707-4815-9ae4-c7a2f56adb64/rootfs</DIV>
<DIV> </DIV>
<DIV>Then I logged into the lxc container :</DIV>
<DIV style="FONT-SIZE: 8pt">hzguanqiang@debian:~$ ssh -i id_rsa
ubuntu@10.160.70.2</DIV>
<DIV style="FONT-SIZE: 8pt"> Welcome to Ubuntu 12.04.2 LTS (GNU/Linux
3.2.46-openstack-amd64 x86_64)</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">* Documentation:
https://help.ubuntu.com/</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> System information as of Wed Aug 7
10:49:35 UTC 2013</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> System load:
0.62
Processes:
31</DIV>
<DIV style="FONT-SIZE: 8pt"> Usage of /: 20.9% of
19.69GB Users logged in: 1</DIV>
<DIV style="FONT-SIZE: 8pt"> Memory usage:
51%
IP address for eth0: 10.160.70.2</DIV>
<DIV style="FONT-SIZE: 8pt"> Swap usage: 0%</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> Graph this data and manage this system at
https://landscape.canonical.com/</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> Get cloud support with Ubuntu Advantage
Cloud Guest:</DIV>
<DIV style="FONT-SIZE: 8pt">
http://www.ubuntu.com/business/services/cloud</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt"> Use Juju to deploy your cloud instances
and workloads:</DIV>
<DIV style="FONT-SIZE: 8pt">
https://juju.ubuntu.com/#cloud-precise</DIV>
<DIV style="FONT-SIZE: 8pt"> </DIV>
<DIV style="FONT-SIZE: 8pt">Last login: Wed Aug 7 10:49:35 2013 from
10.160.70.3</DIV>
<DIV style="FONT-SIZE: 8pt">ubuntu@lxc1:~$ df -hl</DIV>
<DIV style="FONT-SIZE: 8pt">Filesystem
Size Used Avail Use% Mounted on</DIV>
<DIV style="FONT-SIZE: 8pt">/dev/loop2
20G 11G 8.3G 57% /</DIV>
<DIV
style="FONT-SIZE: 8pt">devfs
64K 8.0K 56K 13% /dev</DIV>
<DIV
style="FONT-SIZE: 8pt">tmpfs
64K 0 64K 0%
/sys/fs/cgroup</DIV>
<DIV
style="FONT-SIZE: 8pt">none
4.8G 6.4M 4.8G 1% /run</DIV>
<DIV
style="FONT-SIZE: 8pt">none
5.0M 0 5.0M 0% /run/lock</DIV>
<DIV
style="FONT-SIZE: 8pt">none
24G 0 24G 0%
/run/shm</DIV></BLOCKQUOTE></BLOCKQUOTE>
<DIV> </DIV>
<DIV>From above, We can see under libvirt version 1.1.0, disk space info
of lxc container gotten through lxc-enter-namespace are different from info got
from lxc inside, but the same as host.</DIV>
<DIV> </DIV>
<DIV>Why does this happen? Is there a bug or anything?</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV>
<DIV>--------------------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>------------------ </DIV>
<DIV>Best regards!</DIV>
<DIV>GuanQiang</DIV></DIV></BODY></HTML>