OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 01/10] Containers(V10): Basic container framework
Re: [PATCH 01/10] Containers(V10): Basic container framework [message #14054 is a reply to message #13542] Wed, 13 June 2007 10:17 Go to previous message
Dhaval Giani is currently offline  Dhaval Giani
Messages: 37
Registered: June 2007
Member
Hi,

On Tue, May 29, 2007 at 06:01:05AM -0700, menage@google.com wrote:
> +1.5 How do I use containers ?
> +--------------------------
> +
> +To start a new job that is to be contained within a container, using
> +the "cpuset" container subsystem, the steps are something like:
> +
> + 1) mkdir /dev/container
> + 2) mount -t container -ocpuset cpuset /dev/container
> + 3) Create the new container by doing mkdir's and write's (or echo's) in
> + the /dev/container virtual file system.
> + 4) Start a task that will be the "founding father" of the new job.
> + 5) Attach that task to the new container by writing its pid to the
> + /dev/container tasks file for that container.
> + 6) fork, exec or clone the job tasks from this founding father task.
> +
> +For example, the following sequence of commands will setup a container
> +named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
> +and then start a subshell 'sh' in that container:
> +
> + mount -t container cpuset -ocpuset /dev/container
> + cd /dev/container
> + mkdir Charlie
> + cd Charlie

This example does not work. To do so we need to do

/bin/echo 2-3 > cpus
/bin/echo 1 > mems

> + /bin/echo $$ > tasks
> + sh
> + # The subshell 'sh' is now running in container Charlie
> + # The next line should display '/Charlie'
> + cat /proc/self/container

The following patch does that.

thanks and regards
Dhaval

----------------------

Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>


diff -uprN linux-2.6.22-rc4/Documentation/containers.txt old/Documentation/containers.txt
--- linux-2.6.22-rc4/Documentation/containers.txt 2007-06-13 15:38:30.000000000 +0530
+++ old/Documentation/containers.txt 2007-06-13 10:56:49.000000000 +0530
@@ -310,6 +310,8 @@ and then start a subshell 'sh' in that c
cd /dev/container
mkdir Charlie
cd Charlie
+ /bin/echo 2-3 > cpus
+ /bin/echo 1 > mems
/bin/echo $$ > tasks
sh
# The subshell 'sh' is now running in container Charlie
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: nptl perf bench and profiling with pidns patchsets
Next Topic: Proposed changes to the vz* specfiles.
Goto Forum:
  


Current Time: Tue Oct 08 11:57:53 GMT 2024

Total time taken to generate the page: 0.05528 seconds