[vserver] Documenting cool util-vserver feature, operate on groups of servers using --mark

From: Ed W <lists_at_wildgooses.com>
Date: Sat 03 Sep 2011 - 20:26:15 BST
Message-ID: <4E627F57.1020303@wildgooses.com>

Some time back, Daniel was kind enough to implement what I find is a
massively useful feature: --mark support in the util-vserver tools.
This allows operating on vservers in groups based on their mark values

The implications are that you can insert multiple marks (one per line) in:
    /etc/vservers/xxx/apps/init/mark

Then any vserver command which can work on multiple vservers can be
persuaded to operate on arbitrary groups of vservers

An example. I use gentoo, so I will use the "vupdateworld" command which
does something like a "yum -a", effects are irrelevant, just watch the
syntax:

- Update all WWW servers:
    vupdateworld --mark www

- Update all WWW & DNS servers (comma separation is "or"):
    vupdateworld --mark www,dns

- Update all WWW & DNS servers, but *don't* update my base template
images (multiple --mark is "and", "!" is "not". Note you might need to
escape the "!")
    vupdateworld --mark www,dns --mark \!template

- Update WWW/DNS, not the templates, and only the running vservers (ok
"running" is implicit here, but the example is useful)
    vupdateworld --mark dns,www --mark \!template --running

All of the commands which iterate are using the "vsomething" command
under the bonnet, so look there for syntax and fuller options. The
vsomething command runs a command for every vserver that matches, the
syntax is something like:

    vsomething [cmd_to_run] -- [your_marks] -- [args_to_cmd]

this runs, for each vserver:
    cmd_to_run vserver_name args_to_cmd

- so for example to start all template servers (say to update them)
    vsomething vserver -- --mark template -- start

- run "hostname" on all the servers in the example above, WWW/DNS, no
templates
    vsomething vserver --mark dns,www --mark \!template --running --
exec hostname

Using these groups makes bulk operations on vservers dramatically
simpler and management is very much simpler. I would encourage
groupings based on server use, eg DNS or WWW (assuming you have very
granular server builds!). Additionally I mark special features, eg
"UPGRADE_CAREFULLY", "TEMPLATE" so that I can exclude certain servers
from bulk operations

I hope others find this as helpful as I do - many thanks to Daniel (and
of course Herbert!)

Perhaps someone might find a spot for some documentation based on the
above for the wiki?

Thanks

Ed W
Received on Sat Sep 3 20:26:32 2011

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Sat 03 Sep 2011 - 20:26:33 BST by hypermail 2.1.8