-# If vservers are configured, decide if the handler should
-# use them or if it should just operate on the host
-if [ "$vservers" == "yes" ]; then
- if [ ! -z $vsname ]; then
- info "using vserver '$vsname'"
- usevserver=1
- else
- info "no vserver name specified, actions will be performed on the host"
- fi
+# If vservers are enabled, check that $vsname exists, and decide if the
+# handler should use it or if it should just operate on the host.
+local usevserver=no
+if [ $vservers_are_available = yes ]; then
+ if ! vservers_exist "$vsname" ; then
+ fatal "The vserver given in vsname ($vsname) does not exist."
+ else
+ info "using vserver '$vsname'"
+ usevserver=yes
+ fi