# compress = < yes | no > (default = yes)
 # if yes, compress the sqldump output. 
 #
-# vsname = <vserver> (no default)
-# what vserver to operate on (only used if vserver = yes 
-# in /etc/backupninja.conf), if you do not specify a vsname the 
-# host will be operated on
+# vsnames = all | <vserver1> <vserver2> (no default)
+# what vservers to operate on (only used if vserver = yes 
+# in /etc/backupninja.conf), if you do not specify vsnames the 
+# host will be operated on.
 # 
 # NB: databases = all doesn't seem to work with hotcopy = yes 
 # when vsname is specified, I would like to know how to fix this.
 
 getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names"
 getconf compress yes
 getconf vsname
+getconf vsnames
 
 # authentication:
 getconf user
 # In the former case, check that $vsname exists and is running.
 local usevserver=no
 local vroot
-if [ $vservers_are_available = yes ]; then
-   if [ -n "$vsname" ]; then
-      # does it exist ?
-      if ! vservers_exist "$vsname" ; then
-         fatal "The vserver given in vsname ($vsname) does not exist."
-      fi
-      # is it running ?
-      vservers_running $vsname || fatal "The vserver $vsname is not running."
-      # everything ok
-      info "Using vserver '$vsname'."
-      usevserver=yes
+
+if [ -n "$vsname" ]; then
+   if [ -z "$vsnames" ]; then
+      warning "Using deprecated 'vsname' configuration variable"
+      vsnames="$vsname"
    else
-      info "No vserver name specified, actions will be performed on the host."
+      warning "Ignoring (deprecated) vsname configuration variable, since vsnames is given"
+   fi
+fi
+
+if [ $vservers_are_available = yes -a -n "$vsnames" ]; then
+   if [ "$vsnames" = all ]; then
+      vsnames="$found_vservers"
+   else
+      if ! vservers_exist "$vsnames" ; then
+         fatal "At least one of the vservers listed in vsnames ($vsnames) does not exist."
+      fi
    fi
+   info "Using vservers '$vsnames'"
+   usevserver=yes
 else
-   [ -z "$vsname" ] || warning 'vservers support disabled in backupninja.conf, vsname configuration line will be ignored'
+   [ -z "$vsnames" ] || warning 'vservers support disabled in backupninja.conf, vsnames configuration line will be ignored'
 fi
 
 ## Prepare ignore part of the command
 
 function make_backup() {
    vsname="$1"
-   if [ -n "$vsname" ]; then
-      vroot="$VROOTDIR/$vsname"
-      vexec="$VSERVER $vsname exec"
-   else
+   if [ -z "$vsname" ]; then
+      info "Running on host"
       vroot=""
       vexec=""
+   else
+      if ! vservers_running "$vsname"; then
+         error "vserver $vsname is not running!"
+         return 1
+      fi
+      info "Running on vserver $vsname"
+      vroot="$VROOTDIR/$vsname"
+      vexec="$VSERVER $vsname exec"
    fi
 
    interpolated=`interpolate "$backupdir" "$vsname"`
 }
 
 if [ $usevserver = yes ]; then
-   make_backup "$vsname"
+   for vserver in $vsnames; do
+      make_backup "$vserver"
+   done
 else
    make_backup ""
 fi