VM=$2
LPORT=$(( $RANDOM % 10000 + 5900))
-VNCDISPLAY=$(ssh $HOST "gnt-instance list --no-headers -o name,network_port | awk '/^$VM/ { print \$2 - 5900 } END { exit 1; }' || virsh -c qemu:///system vncdisplay $VM | sed s/://")
+if [ -z "$VNCDISPLAY" ]; then
+ VNCDISPLAY=$(ssh $HOST "gnt-instance list --no-headers -o name,network_port | awk '/^$VM/ { print \$2 - 5900 ; exit 0 } END { exit 1; }' || virsh -c qemu:///system vncdisplay $VM | sed s/://")
+fi
ssh -N -f -L ${LPORT}:localhost:$(( $VNCDISPLAY + 5900 )) $HOST
gvncviewer localhost:$(( $LPORT - 5900 ))