NVMC: NEAT VM CLUSTER ===================== Neat VM Cluster (NVMC; pronounced nevuc) is a collection of shell scripts for managing KVM virtual machines on multiple host nodes. It uses Qemu directly and stores host and VM configurations in the file system. DIRECTORY STRUCTURE =================== NVMC uses the following directories on the master node: + NCDIR: NVMC's base directory (/var/nc). + NCDIR/hosts: contains a directory for each host. + NCDIR/vms: contains a directory for each VM. The directory NCDIR/hosts/HOST stores the details of host node HOST: + ADDR: the address of the host. + CPUS: the number of available CPUs. + MEMS: available memory in GB. + DISK: available disk space in GB. + GPUS: each line contains Qemu options necessary for a GPU. The directory NCDIR/vms/VM stores the details of virtual machine VM: + CPUS: the number of CPUS assigned to VM. + MEMS: the amount of VM's memory in GB. + DISK: the size of VM's disk in GB. + HOST: the host on which the VM is running. + USER: the UID of VM owner. + INIT: VM initialization script (executed when creating the VM). + ONCE: commands executed only once (e.g. for resizing disk; optional). + QEMU: Qemu invocation script (optional; NCDIR/QEMU is used by default). + OPTS: extra Qemu arguments. + EMAC: MAC address for bridged networking (optional). + SLOT: the slot assigned to the VM (created by nc push). + disk: VM's disk image in QCOW2 format (created on the host node). EXECUTABLES =========== The main programs: + nc: main commands; shows available commands, if executed without arguments. + ncx: helper commands; shows available commands, if executed without arguments. + ncvm: executed on host nodes for managing VMs. + nclogin: for VM user login. For VM users: + users/ncfwd.sh: create a VNC or SSH tunnel to a VM. + users/ncvnc.cmd: create a VNC tunnel to a VM for windows. + users/vmdisk.sh: extend partition after enlarging VM disk. SETTING UP ========== NVMC is executed on a master node to manage virtual machines on multiple host nodes. The root user of the master node should be able to log into host nodes using its public key. On host nodes, Qemu/KVM and socat should be available. Host nodes can be on a private network, visible only to the master node, through which users may connect to VMs. + Install NVMC on the master node (make install) + Add a directory in NCDIR/hosts/ for each host, containing ADDR, CPUS, MEMS. + Install NVMC on host nodes (nc hostinit) + Create VM users (use "ncx mkuser") + Create VMs (use "ncx mkvm" or create the necessary files in NCDIR/vms/NAME) The script ncx assumes that disk images are stored in NCDIR/imgs directory on host nodes; if they are missing, they are retrieved from NCDIR/imgs_main, if it exists (it can be mounted via NFS). Note that after changing the files in a VM directory of the master node, nc push command should be invoked to update the VM on its host node. If the EMAC file is missing or empty in a VM directory, NVMC uses Qemu's user networking for that VM. Otherwise, NVMC uses bridged networking with the provided MAC address. In that case, the bridge br0 should be set up properly and the file /etc/qemu/bridge.conf should contain "allow br0". Edit the ncx script to change VM MAC address patterns. On host nodes, NVMC executes Qemu as root, unless user nvmc exists. To create it, execute the following commands on each host node. # groupadd nvmc # useradd -g nvmc -G kvm -N nvmc