#!/usr/bin/bash list(){ echo "|--------------------------------|" echo "|---------批量管理工具箱-----------|" echo "|----1.创建自定义配置单个虚拟机------|" echo "|----2.批量创建自定义配置虚拟机------|" echo "|----3.批量创建默认配置虚拟机--------|" echo "|----4.删除虚拟机------------------|" echo "|----5.退出-----------------------|" } dgchuangjian(){ read -p "请输入你的虚拟机名字" vm_name read -p "请输入内存大小(MB)" memory read -p "请输入cpu核数" vcpus read -p "请输入磁盘大小(G): " disk_size kvmuuid=`uuidgen` #kvmmac=`openssl rand -hex 3| sed -r 's/..\B/&:/g'` virsh define <( cat < $vm_name $kvmuuid $(($memory * 1024)) 2048000 $vcpus hvm destroy restart destroy /usr/libexec/qemu-kvm