change readme, add network_control usage, improve vm-start init command

This commit is contained in:
primardj 2024-03-21 21:39:01 +00:00
parent 18280dd605
commit dff23e4d30
3 changed files with 50 additions and 35 deletions

View file

@ -14,7 +14,7 @@ script which permit to launch easily some virtual machines via qemu
## Functionnality: ## Functionnality:
- use of config files [not fully ok] - use of config files [~ok]
- start,create vm reading the config file [ok] - start,create vm reading the config file [ok]
- delete all data related to a vm [ok] - delete all data related to a vm [ok]
- create a backup or being able to recall the bacup [ok - have to be improved] - create a backup or being able to recall the bacup [ok - have to be improved]
@ -22,18 +22,16 @@ script which permit to launch easily some virtual machines via qemu
- list all vm already configured [ok] - list all vm already configured [ok]
- print help of version number [ok] - print help of version number [ok]
- support options to overrides the config file [ok] - support options to overrides the config file [ok]
- can support launching vm in uefi mode [ok] (doesn't support automatic add of uefi in conf file.) - can support launching vm in uefi mode [ok]
- take option create_disk to know what disk to use when creating a vm. [ok] - take option create_disk to know what disk to use when creating a vm. [ok]
- compatible to an extensive network configuration [~ok] (don't work with conf file, and no possibility to bridge over an existing interface.) - compatible to an extensive network configuration [ok, just need the script to create the network. ethernet_restraint/no_restreint can be used while waiting for this script to appear.]
### Next changes to come ### Next changes to come
- put the path of the creation disk on the config file - put the path of the creation disk on the config file
- add vnc support - add vnc support
- add an option -ng, --nographic with it's parametters assiciated. - read from $XDG_CONFIG_DIR/vm_start/conf, or if it not exist, from ~/.config/vm_start/conf.
- majors changes in setup_bridges.sh, it will be from this point called - improve the create_disk mecanism, and the init_cdrom in a load command.
- Do again the readme
```setup_bridges 'bridge_name' add|rm [--ip=<ip> | --imaster=<interface_master>] ```
@ -55,29 +53,3 @@ you can of course add options like --uefi to tun in uefi mode, or --nproc=<nb_pr
If you go to the conf folder created the first time you launch the script, you will find all configured variables for each of your vm. If you go to the conf folder created the first time you launch the script, you will find all configured variables for each of your vm.
### to connect two vm on different networks at a gateway nat.
first, run the script set-tap.sh to create two bridges.
```
setup_bridge.sh --addbridge=br0
setup_bridge.sh --addbridge=br1
```
after that change the mac address of all vm in conf folder.
```
vm-1 from 00:00:00:00:00:00 to 00:00:00:00:00:01
vm-2 from 00:00:00:00:00:00 to 00:00:00:00:00:02
```
and start the gateway and the vms after.
```
vm-start.sh gateway start --net=br:br0 --net=br:br1 --net=nat:id01
vm-start.sh vm-1 start --net=br:br0
vm-start.sh vm-2 start --net=br:br1
```
And that's it, your three vm are now connected. You just have now to do some configurations on thoses vms.

33
network_control.sh Executable file
View file

@ -0,0 +1,33 @@
# Script which control the network. Make the bridge, veth, dummy, brx alone without any help.
version="0.0.1"
usage="USAGE
$(basename $0) [PARAMETTER] [COMMAND NAME]
DESCRIPTION
Setup the bridge interfaces for a vm.
Take it's config files from:
- \$XDG_CONFIG_HOME/vm_start/conf
In case \$XDG_CONFIG_HOME doesn't exists
- ~/.config/vm_start/conf
PARAMETTER
-h, --help Print this help message and quit
-v, --version Print the installed version of $(basename $0) and quit
NAME
Is the name of the vm to open
COMMAND
active Active the internet network of the vm
desactive desactive the internet network of the vm
desactive-all desactive all vms previously loaded
"
echo "$usage"

View file

@ -4,7 +4,7 @@
#RESULT_POSSIBLE=("init","list","start","start_backup","create","backup","restore","suppr") #RESULT_POSSIBLE=("init","list","start","start_backup","create","backup","restore","suppr")
# Constante d'éxecutions. # Constante d'éxecutions.
Version="0.7.0" Version="0.7.1"
USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ] USAGE="vm-start [PARAMETTER] [ NAME COMMAND [OPTION] ]
Script to manage virtual machine easily. Script to manage virtual machine easily.
@ -55,6 +55,12 @@ OPTION="-display gtk,gl=on,show-cursor=on,show-menubar=off \
-usbdevice tablet \ -usbdevice tablet \
-daemonize" -daemonize"
option_graphical="-display sdl,gl=on,show-cursor=on \
-device virtio-vga-gl \
-usbdevice tablet \
-daemonize"
# other options choices # other options choices
# #
#-display gtk,show-menubar=off,gl=on,show-cursor=on,zoom-to-fit=on \ #-display gtk,show-menubar=off,gl=on,show-cursor=on,zoom-to-fit=on \
@ -93,14 +99,18 @@ INIT() {
mkdir -p conf mkdir -p conf
cat << EOF > "conf/$NAME-vm_var.sh" cat << EOF > "conf/$NAME-vm_var.sh"
init_version=${Version}
NAME="${NAME}" NAME="${NAME}"
VMHOSTNAME="\${NAME}-vm" VMHOSTNAME="\${NAME}-vm"
VMDRIVE="\${VMHOSTNAME}.cow" VMDRIVE="\${VMHOSTNAME}.cow"
NPROC="${NPROC}" NPROC="${NPROC}"
MEMORY="${MEMORY}" MEMORY="${MEMORY}"
FORWARD="${FORWARD}"
LOCATION="\${NAME}-sandbox" LOCATION="\${NAME}-sandbox"
UEFI="no"
FORWARD="${FORWARD}"
mac="00:00:00:00:00:00" mac="00:00:00:00:00:00"
net=""
driver="virtio-net"
EOF EOF
chmod +x "conf/$NAME-vm_var.sh" chmod +x "conf/$NAME-vm_var.sh"