321 | | Each of these parameters can be set on individual nodes using attributes. The attribute to set a template on a node is {{{containers:openvz_template}} and the attribute to set the disk space is {{{containers:openvz_diskspace}}}. |
| 323 | Each of these parameters can be set on individual nodes using attributes. The attribute to set a template on a node is {{{containers:openvz_template}} and the attribute to set the disk space is {{{containers:openvz_diskspace}}}. [attachment:example5.tcl This example] shows setting these openvz parameters per node: |
| 324 | |
| 325 | {{{ |
| 326 | source tb_compat.tcl |
| 327 | set ns [new Simulator] |
| 328 | |
| 329 | # Create the center node (named by its variable name) |
| 330 | set center [$ns node] |
| 331 | # The center node is a process |
| 332 | tb-add-node-attribute $center containers:node_type process |
| 333 | tb-add-node-attribute $center containers:openvz_template ubuntu-12.04-x86_64 |
| 334 | |
| 335 | # Connect 10 satellites |
| 336 | for { set i 0} { $i < 10 } { incr i} { |
| 337 | # Create node n-1 (tcl n($i) becomes n-$i in the experiment) |
| 338 | set n($i) [$ns node] |
| 339 | # Set satellite disk sizes to be 20 GB |
| 340 | tb-add-node-attribute $n($i) containers:openvz_diskspace 20G |
| 341 | # Connect center to $n($i) |
| 342 | ns duplex-link $center $n($i) 100Mb 10ms DropTail |
| 343 | } |
| 344 | |
| 345 | # Creation boilerplate |
| 346 | $ns rtptoto Static |
| 347 | $ns run |
| 348 | }}} |
| 349 | |
| 350 | The {{{center}}} node will run Ubuntu 12.04 64 bit and the satellites will have 20GB file systems. |