#/bin/bash
qcow2_dir="/var/lib/libvirt/images"
xml_dir="/etc/libvirt/qemu"
read -p “请输入需要创建的主机名:” hname
read -p “请输入镜像文件的大小:” size
qemu-img create -f qcow2 -b $qcow2_dir/node.qcow2
q
c
o
w
2
d
i
r
/
"
qcow2_dir/"
qcow2dir/"hname".img $size cp /root/nsd1811/node.xml
x
m
l
d
i
r
/
"
xml_dir/"
xmldir/"hname".xml
sed -i ‘s/node/’$hname’/’
x
m
l
d
i
r
/
"
xml_dir/"
xmldir/"hname".xml
virsh define
x
m
l
d
i
r
/
"
xml_dir/"
xmldir/"hname".xml
virsh start --console “$hname”
使用脚本创建kvm虚拟机
最新推荐文章于 2024-08-13 06:00:00 发布