[feature] move kvm to devel and add virt-install.sh
This commit is contained in:
parent
ddeeb64b91
commit
19b22fb5e7
36
devel/kvm/virt-install.sh
Executable file
36
devel/kvm/virt-install.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$#" -lt 1 ] ;then
|
||||
echo "Usage: $0 <network> [name] [disk-dir] [iso-path]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
bridge)
|
||||
NETWORK='bridge=br0'
|
||||
;;
|
||||
nat)
|
||||
NETWORK='network=default'
|
||||
;;
|
||||
*)
|
||||
NETWORK="type=direct,source=$1,model=virtio"
|
||||
;;
|
||||
esac
|
||||
|
||||
NAME=${2-centos7}
|
||||
DISKDIR=${3-'vms'}
|
||||
ISOPATH=${4-'CentOS-7-x86_64-Minimal-2003.iso'}
|
||||
|
||||
mkdir -p "$DISKDIR"
|
||||
sudo virsh destroy centos7
|
||||
sudo virsh undefine centos7
|
||||
sudo virt-install \
|
||||
--virt-type=kvm \
|
||||
--name "$NAME" \
|
||||
--ram 4096 \
|
||||
--vcpus=2 \
|
||||
--network "$NETWORK" \
|
||||
--nographics \
|
||||
--disk "path=$DISKDIR/$NAME.qcow2,size=40,bus=virtio,format=qcow2" \
|
||||
--extra-args "console=ttyS0" \
|
||||
--location "$ISOPATH"
|
Loading…
Reference in New Issue
Block a user