2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 # TODO This will be merged in main functions.sh
13 sudo mkdir -p /var/lib/libvirt/images/$1
14 sudo qemu-img create -f qcow2 \
15 -o backing_file=/var/lib/libvirt/images/ubuntu-18.04.qcow2 \
16 /var/lib/libvirt/images/$1/"$1".qcow2 10G
18 # Create cloud-init configuration files
24 - $(cat $HOME/.ssh/id_rsa.pub)
25 sudo: ['ALL=(ALL) NOPASSWD:ALL']
30 local-hostname: $VM_NAME
33 sudo genisoimage -output /var/lib/libvirt/images/$1/"$1"-cidata.iso \
34 -volid cidata -joliet -rock user-data meta-data
36 sudo virt-install --connect qemu:///system --name $VM_NAME \
37 --ram 4096 --vcpus=4 --os-type linux --os-variant ubuntu16.04 \
38 --disk path=/var/lib/libvirt/images/$1/"$1".qcow2,format=qcow2 \
39 --disk /var/lib/libvirt/images/$1/"$1"-cidata.iso,device=cdrom \
40 --import --network network=default --network bridge=$BRIDGE,model=rtl8139 --noautoconsole