frnmst-archives
/
qvm
Archived
1
0
Fork 0
Franco Masotti 4 years ago
parent
commit
e63d0ba607
  1. 15
      README.md
  2. 5
      configvmrc
  3. 9
      fbopt
  4. 6
      qvm

15
README.md

@ -57,13 +57,12 @@ It can handle:
- Create a new virtual hard disk and complete the OS installation which
can also be done via SSH.
$ ./qvm -c
$ ./qvm -i
$ ./qvm --create && ./qvm --install
- Optionally enable the SSH daemon on the guest machine.
- Optionally create a new backup VHD:
$ ./qvm -b
$ ./qvm --backup
- Now you can run the virtual machine either using the original or the backup
virtual hard disk. If you run `./qvm -x` the virtual machine will run in
@ -76,11 +75,11 @@ It can handle:
- You can also access the virtual machine through SSH:
$ ./qvm -a
$ ./qvm --attach
or, if you are working on another computer,
$ ./qvm --attach-remote
$ ./qvm --attach --remote
## VNC options
@ -93,14 +92,14 @@ You must then run QVM with one of the VNC options on the server side.
On the client side you must simply edit the `host_ip_address` and
`host_username` variables in the configuration file.
For example, on the server side we could install the virtual machine remotely
For example, on the server side you could install the virtual machine remotely
like this:
$ ./qvm --install-vnc
$ ./qvm --install --vnc
And on the client side:
$ ./qvm -r
$ ./qvm --attach --remote --vnc
At this point you should see your virtual machine running in a TigerVNC window.

5
configvmrc

@ -28,10 +28,10 @@ VHD_SIZE='16G'
#
# Total RAM assigned to the vm.
vm_memory='4G'
MEMORY='4G'
# Total number of processor cores assigned to the vm.
number_of_cores=1
NUMBER_OF_CORES=1
#
# Ports.
@ -90,4 +90,3 @@ HOST_QVM_SCRIPT_DIRECTORY='/home/remote/qvm'
# Seconds to wait before connecting via SSH or VNC.
SECONDS_BEFORE_CONNECTION_ATTEMPT=25

9
fbopt

@ -16,6 +16,8 @@
# See also https://frnmst.gitlab.io/notes/my-bash-option-parsing-template.html
#
set -x
show_help()
{
cat <<-EOF
@ -34,11 +36,11 @@ Options:
-i, --install install img on vhd
-n, --nox run vm without opening a graphical window
which is useful for background jobs like SSH
-o, --orig run from original vhd
-s, --mkdir-shared create shared directory
-r, --remote connect to a vnc instance via ssh
-x, --run run vm
--vnc run vm with vnc
--orig run from original vhd
-v, --vnc run vm with vnc
Exit status:
0 if OK,
@ -160,6 +162,7 @@ remote,vnc,mkdir-shared,nox'
'install' \
'mkdir_shared' \
'nox' \
'origin' \
'run' \
'remote' \
'vnc' \
@ -174,7 +177,7 @@ remote,vnc,mkdir-shared,nox'
local display=''
if [ "${attach}" = 'true' ]; then
[ "${remote}" = 'true' ] && place='remote' || place=''
[ "${remote}" = 'true' ] && place='remote' || place='local'
[ "${vnc}" = 'true' ] && display='vnc' || display=''
{ attach "${place}" "${display}"; return ${?}; }
fi

6
qvm

@ -61,12 +61,13 @@ installs()
[ "${display}" = 'vnc' ] && enable_vnc='-monitor pty -vnc 127.0.0.1:0'
qemu-system-x86_64 -m "${VM_MEMORY}" \
qemu-system-x86_64 -m "${MEMORY}" \
-device e1000,netdev=user.0 \
-netdev user,id=user.0,\
hostfwd=tcp::"${SSH_HOST_PORT}"-:"${SSH_GUEST_PORT}" \
-enable-kvm \
${enable_vnc} \
-smp ${NUMBER_OF_CORES} \
-cdrom "${IMG_NAME}" \
-boot order=d \
"${VHD_NAME}" &
@ -115,6 +116,9 @@ hostfwd=tcp::"${SSH_HOST_PORT}"-:"${SSH_GUEST_PORT}" \
# -h, --help print this help
# -u, --use-vnc start the vm in VNC mode and connect to it with the
# VNC client
#
# FIXME
#
# Start and connect to a remote QVM instance hosted on a different machine.
run_remote_instance()
{