
# prepare libvirt machine for network boot

export VM_NAME=gentoo-bios-openrc
echo "VM_NAME - ${VM_NAME}"
virsh destroy ${VM_NAME}
virsh undefine ${VM_NAME}
rm /mnt/tank/libvirt/${VM_NAME}.qcow2
qemu-img create -f qcow2 /mnt/tank/libvirt/${VM_NAME}.qcow2 32G
chown qemu:qemu /mnt/tank/libvirt/${VM_NAME}.qcow2

virt-install  \
  --name ${VM_NAME} \
  --memory 4096  \
  --vcpus=2  \
  --os-variant gentoo  \
  --disk /mnt/tank/libvirt/${VM_NAME}.qcow2,format=qcow2,bus=scsi,size=32  \
  --boot hd,network  \
  --network network=testnet,model=e1000,mac=52:54:00:11:11:00  \
  --graphics=vnc,port=5903  \
  --serial tcp,host=127.1.0.3:4444,source.mode=bind 

# xxx
#  --graphics=vnc,port=5903,password=inttest  \
# deprecated
  --os-type=linux   \

export VM_NAME=gentoo-bios-systemd
echo "VM_NAME - ${VM_NAME}"
virsh destroy ${VM_NAME}
virsh undefine ${VM_NAME}
rm /mnt/tank/libvirt/${VM_NAME}.qcow2
qemu-img create -f qcow2 /mnt/tank/libvirt/${VM_NAME}.qcow2 32G
chown qemu:qemu /mnt/tank/libvirt/${VM_NAME}.qcow2

virt-install  \
  --name ${VM_NAME} \
  --memory 4096  \
  --vcpus=2  \
  --os-variant gentoo  \
  --disk /mnt/tank/libvirt/${VM_NAME}.qcow2,format=qcow2,bus=scsi,size=32  \
  --boot hd,network  \
  --network network=testnet,model=e1000,mac=52:54:00:11:11:01  \
  --graphics=vnc,port=5904  \
  --serial tcp,host=127.1.0.4:4444,source.mode=bind 
