← history for chapter-4/kvm-install-new-domain.sh
b01d9c99chapter-4/kvm-install-new-domain.sh29 lines⬡ raw↓ download
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /bin/bash -x
#
# This script helps creating a new LibVirt domain 
#
# Run as root user
#

# TODO: fill the variables below with proper values
# ----------------------------------------------------
domain_name=..
cpus=...
disk_size=...
memory=...
mac=...
isodisk=...
# ----------------------------------------------------


 virt-install \
 --name ${domain_name} \
 --disk path=/var/lib/libvirt/images/${domain_name}.qcow2,size=${disk_size}\
 --vcpus ${cpus} \
 --memory ${memory} \
 --location ${isodisk}\
 --network bridge=virbr0,mac=${mac}\
 --graphics none\
 --virt-type kvm\
 --extra-args console=ttyS0 \
 --osinfo detect=on,require=off --import