openqa2vm is shell script for manipulation of qcow2 images generated by openQA.
- openqa2vm
- Description
- Requirements
- Installation
- Usage
- Examples
- Show job information on o.s.d
- Show job information on o.o.o
- Create (download, prepare and install image) and start virtual machine
- Download qcow2 image
- Prepare qcow2 image
- Install qcow2 image to libvirt directory /var/lib/libvirt/images
- Create and start virtual machine
- Destroy (stop and delete) virtual machine
- Clean job files, stop and delete virtual machine, delete image file
- Create dual node cluster with 4096 MB RAM and 2 VCPUs for each node on remote libvirt system
- Contributing
- License
It has ability to download, prepare and install images, start virtual machine using terraform with libvirt provider. Virtual machines can be started on local libvirt or remote libvirt locations. Root privileges are needed to prepare/install qcow2 images and create/start/stop/delete virtual machines.
Information about IP address provided, when is virtual machine successfully started. Connection to cloned machine can be done using ssh as root. Keys for ssh are automatically injected from logged user who runs openqa2vm script.
Default openQA instance is openqa.opensuse.org, but it can be changed by -f option or environment variable FROM to any openQA instance like openqa.suse.de or even private instance.
Local libvirt qemu:///system is used as default with NAT network. Type of the network can be changed to bridge by -b option or BRIDGE variable with supplied name of the
bridge interface. If you want to set macvtap interface, use environment variable MACVTAP with network device.
Remote libvirt can be configured by environment variable LIBVIRT_HOST, ssh access for root user is needed for remote libvirt operations.
Environmental variables MEMORY, VCPU, NODES can be used to configure amount of memory, cpus and number nodes of virtual machines.
Variables LIBVIRT_VOLUME_POOL and LIBVIRT_IMAGE_DIR are available for advanced configuration of libvirt volume pools.
All environmental variables can be supplied on command line or defined in /etc/openqa2vm/default configuration file.
You can re-define configuration file by CFG_FILE variable to have multiple configuration files for different scenarios.
Default values of variables:
CFG_FILE/etc/openqa2vm/defaultFROMopenqa.suse.deSSH_KEY_USERcurrently logged user who runs openqa2vm scriptSSH_KEY_FILEcreated fromSSH_KEY_USERLIBVIRT_HOSTnot setLIBVIRT_IMAGE_DIR/var/lib/libvirt/imagesLIBVIRT_VOLUME_POOLdefaultNODES1MEMORY1024VCPU1BRIDGEnot setMACVTAPnot set
Add terraform OBS repository.
sudo zypper ar https://download.opensuse.org/repositories/systemsmanagement:/terraform/openSUSE_Tumbleweed/systemsmanagement:terraform.reposudo zypper ar https://download.opensuse.org/repositories/systemsmanagement:/terraform/openSUSE_Leap_15.0/systemsmanagement:terraform.repoAdd openqa2vm OBS repository.
sudo zypper ar https://download.opensuse.org/repositories/home:/czerw:/openqa2vm/openSUSE_Tumbleweed/home:czerw:openqa2vm.repo sudo zypper ar https://download.opensuse.org/repositories/home:/czerw:/openqa2vm/openSUSE_Leap_15.0/home:czerw:openqa2vm.repo sudo zypper in openqa2vm Find proper job on openQA instance. It can be openqa.suse.de, openqa.opensuse.org or on any openQA private installation.
Job must produce image defined in PUBLISH_HDD_1 or job has defined image in HDD_1 variable. Installation only jobs don't
generate images, they are not suited for openqa2vm. Look for create_hdd_* or mru-install-* jobs.
Options:
-f HOST get job from specified host (default openqa.opensuse.org)
-b BRIDGE enable bridge networking on BRIDGE
-s JOBID show information about job
-d JOBID download image for the job
-p JOBID prepare image for virtual machine
-i JOBID install image to libvirt directory
-r JOBID run virtual machine
-x JOBID destroy(stop and delete) virtual machine
-c JOBID openqa2vm cleanup
stop vm, delete vm, delete images, delete tmp files
-h display help
sudo openqa2vm -f openqa.suse.de -s 2783196sudo openqa2vm -s 899225sudo openqa2vm -r 899225sudo openqa2vm -d 899225sudo openqa2vm -p 899225sudo openqa2vm -i 899225sudo openqa2vm -r 899225sudo openqa2vm -x 899225sudo openqa2vm -c 899225sudo LIBVIRT_HOST=192.168.50.250 MEMORY=4096 VCPU=2 NODES=2 openqa2vm -b br0 -x 899225Pull requests are welcomed :)