July 2010
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  
86

Categories

Archives

Managing OpenVZ Instance Descriptions

I recently discovered that you can assign descriptions to your OpenVZ instances. This isn’t really that surprising but I never really took the the time until now to scan through the vzctl and vzlist man pages. Prior to discovering these more esoteric features of vzctl and vzlist, I’d normally just run this command to see what’s what with my OpenVZ instances:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# list of all VE instances
% vzlist -a
      CTID      NPROC STATUS  IP_ADDR         HOSTNAME                        
       101         32 running 10.1.1.101      flanders.mydom.net              
       102         49 running 10.1.1.102      lisa.mydom.net                  
       103         36 running -               bart.mydom.net                  
       104         38 running 10.1.1.104      marge.mydom.net                 
       105         34 running 10.1.1.105      homer.mydom.net                 
       106         31 running 10.1.1.106      kang.mydom.net                  
       107         27 running 10.1.1.107      kodos.mydom.net                 
       108         32 running 10.1.1.108      maude.mydom.net                 
       109         30 running 10.1.1.109      nelson.mydom.net                
       110         32 running 10.1.1.110      ralphie.mydom.net               
       111         30 running 10.1.1.111      martin.mydom.net

This had worked fine, but sometimes I’d draw a blank about what’s running in each instance, hence my need for the description column. You can use the following command to see the description of each instance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# initial description columns for VEs
% vzlist -o ctid,numproc,status,ip,hostname,description
      CTID      NPROC STATUS  IP_ADDR         HOSTNAME                         DESCRIPTION                     
       101         34 running 10.1.1.101      flanders.mydom.net               -                               
       102         49 running 10.1.1.102      lisa.mydom.net                   -                               
       103         35 running -               bart.mydom.net                   -                               
       104         38 running 10.1.1.104      marge.mydom.net                  -                               
       105         34 running 10.1.1.105      homer.mydom.net                  -                               
       106         31 running 10.1.1.106      kang.mydom.net                   -                               
       107         27 running 10.1.1.107      kodos.mydom.net                  -                               
       108         32 running 10.1.1.108      maude.mydom.net                  -                               
       109         30 running 10.1.1.109      nelson.mydom.net                 -                               
       110         32 running 10.1.1.110      ralphie.mydom.net                -                               
       111         30 running 10.1.1.111      martin.mydom.net                 -

I used the following commands to set the description for each VE.

1
2
3
4
5
6
7
8
9
10
11
vzctl set 101 --description "nis server" --save
vzctl set 102 --description "mail,imap,smtp server" --save
vzctl set 103 --description "samba server" --save
vzctl set 104 --description "mysql server" --save
vzctl set 105 --description "www,blog,webmail server" --save
vzctl set 106 --description "trac,git,svn server" --save
vzctl set 107 --description "trac,git,svn server (dev)" --save
vzctl set 108 --description "ldap server (dev)" --save
vzctl set 109 --description "cacti server" --save
vzctl set 110 --description "tracks server" --save
vzctl set 111 --description "wiki server" --save

Re-running the vzlist command from before now shows the newly added descriptions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# filled out description columns for VEs
% vzlist -o ctid,numproc,status,ip,hostname,description
      CTID      NPROC STATUS  IP_ADDR         HOSTNAME                         DESCRIPTION                     
       101         32 running 10.1.1.101      flanders.mydom.net               nis server                      
       102         49 running 10.1.1.102      lisa.mydom.net                   mail,imap,smtp server           
       103         36 running -               bart.mydom.net                   samba server                    
       104         38 running 10.1.1.104      marge.mydom.net                  mysql server                    
       105         34 running 10.1.1.105      homer.mydom.net                  www,blog,webmail server         
       106         31 running 10.1.1.106      kang.mydom.net                   trac,git,svn server             
       107         27 running 10.1.1.107      kodos.mydom.net                  trac,git,svn server (dev)       
       108         32 running 10.1.1.108      maude.mydom.net                  ldap server (dev)               
       109         30 running 10.1.1.109      nelson.mydom.net                 cacti server                    
       110         32 running 10.1.1.110      ralphie.mydom.net                tracks server                   
       111         30 running 10.1.1.111      martin.mydom.net                 wiki server

1 comment to Managing OpenVZ Instance Descriptions

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>