[backend] Clean up vm type setting

$vm awkwardly had a leading space in some cases, which
caused invocations that were not passed through the shell
to fail (as the leading space was then part of the argument).

Also, half of the code compared the vm incorrectly, consequently
also failed to detect vm type properly.

Fixes killing of running jobs amongst other things for KVM and
ZVM.