frnmst-archives
/
qvm
Archived
1
0
Fork 0
Browse Source

Added the attach remote option.

dev
Franco Masotti 5 years ago
parent
commit
793e11c765
  1. 19
      README.md
  2. 22
      qvm

19
README.md

@ -56,6 +56,14 @@ It can handle:
host_share /home/vm/shared 9p noauto,x-systemd.automount,trans=virtio,version=9p2000.L 0 0
- You can also access the virtual machine through SSH:
$ ./qvm -a
or, if you are working on another computer,
$ ./qvm --attach-remote
## VNC options
The VNC options in this script allow you to connect to a remote instance of
@ -86,7 +94,8 @@ Note: the VNC traffic goes through SSH TCP forwarding, so it is encrypted.
Trivial management of 64 bit virtual machines with qemu.
Options:
-a, --attach connect via SSH
-a, --attach connect to SSH locally
--attach-remote connect to SSH remotely
-b, --backup backup vhd
-c, --create create new vhd
-d, --delete delete vhd backup
@ -105,11 +114,11 @@ Note: the VNC traffic goes through SSH TCP forwarding, so it is encrypted.
--run-orig-vnc run from original vhd with vnc
Only a single option is accepted.
By default, the backup vhd is run.
Only a single option is accepted.
By default, the backup vhd is run.
CC0
Written in 2016 by Franco Masotti/frnmst <franco.masotti@student.unife.it>
CC0
Written in 2016 by Franco Masotti/frnmst <franco.masotti@student.unife.it>
## License

22
qvm

@ -19,7 +19,8 @@ Usage: qvm [OPTION]
Trivial management of 64 bit virtual machines with qemu.
Options:
-a, --attach connect via SSH
-a, --attach connect to SSH locally
--attach-remote connect to SSH remotely
-b, --backup backup vhd
-c, --create create new vhd
-d, --delete delete vhd backup
@ -53,7 +54,16 @@ unrecognized_option()
attach()
{
ssh -p "$ssh_host_port" -l "$ssh_guest_username" 127.0.0.1
local argc="$1"
local address=""
if [ "$argc" = "locally" ]; then
address="127.0.0.1"
elif [ "$argc" = "remotely" ]; then
address="$host_ip_address"
fi
ssh -p "$ssh_host_port" -l "$ssh_guest_username" "$address"
}
backup()
@ -161,8 +171,9 @@ main()
{
local argc="$1"
local options="abcdhinrx"
local long_options="attach,backup,create,delete,delete-orig\
,help,install,run,run-orig,run-nox,run-nox-orig,run-vnc,run-orig-vnc,remote,install-vnc"
local long_options="attach,backup,create,delete,delete-orig,\
help,install,run,run-orig,run-nox,run-nox-orig,run-vnc,run-orig-vnc,remote,install-vnc,\
attach-remote"
local opts
local opt
@ -180,7 +191,8 @@ main()
for opt in $opts; do
case "$opt" in
-- ) ;;
-a | --attach ) attach ;;
-a | --attach ) attach locally ;;
--attach-remote ) attach remotely ;;
-b | --backup ) backup ;;
-c | --create ) create ;;
-d | --delete ) delete ;;