FreeBSD avec bhyve et libvirt
pkg install -y libvirt
libvirtd_enable="YES"
vmm_load="YES" nmdm_load="YES"
truncate alcsys-vm51.img -s 100G
wget http://xxxxx/CentOS-7-x86_64-Minimal-1511.iso
# cat device.map (hd0) ./alcsys-vm51.img (cd0) ./CentOS-7-x86_64-Minimal-1511.iso
grub-bhyve -m device.map -r cd0 -M 2048 alcsys-vm51
linux (cd0)/isolinux/vmlinuz initrd (cd0)/isolinux/initrd.img boot
ifconfig tap1 create
bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap1 -s 3:0,virtio-blk,./alcsys-vm51.img -s 4:0,ahci-cd,./CentOS-7-x86_64-Minimal-1511.iso -l com1,stdio -c 4 -m 2048M alcsys-vm51
bhyvectl --destroy --vm=alcsys-vm51
grub-bhyve -m device.map -r hd0,msdos1 -M 2048M alcsys-vm51
configfile (hd0,msdos1)/grub2/grub.cfg
bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,bridge0 -s 3:0,virtio-blk,./alcsys-vm51.img -l com1,stdio -c 4 -m 2048M alcsys-vm51
echo "configfile (hd0,msdos1)/grub2/grub.cfg" | grub-bhyve -m device.map -r hd0,msdos1 -M 2048M alcsys-vm51 bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,bridge0 -s 3:0,virtio-blk,./alcsys-vm51.img -l com1,stdio -c 4 -m 2048M alcsys-vm51
<domain type='bhyve' id='97406'> <name>alcsys-vm51</name> <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid> <memory unit='KiB'>2097152</memory> <currentMemory unit='KiB'>2097152</currentMemory> <vcpu placement='static'>2</vcpu> <bootloader>/usr/local/sbin/grub-bhyve</bootloader> <bootloader_args>--directory=/grub2 --grub-cfg=grub.cfg -r hd0,msdos1 -m /vm/alcsys-vm51.map -M 2048 alcsys-vm51</bootloader_args> <os> <type arch='x86_64'>hvm</type> </os> <features> <acpi/> <apic/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> <driver name='file' type='raw'/> <source file='/vm/alcsys-vm51.img'/> <backingStore/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </disk> <controller type='pci' index='0' model='pci-root'/> <controller type='sata' index='0'/> <interface type='bridge'> <mac address='52:54:00:c6:2d:7c'/> <source bridge='bridge0'/> <target dev='vnet1'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface> <serial type='nmdm'> <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/> <target port='0'/> </serial> <console type='nmdm'> <source master='/dev/nmdm0A' slave='/dev/nmdm0B'/> <target type='serial' port='0'/> </console> </devices> </domain>
# cat /vm/alcsys-vm51.map (hd0) /vm/alcsys-vm51.img
virsh define alcsys-vm51.xml
virsh start alcsys-vm51
# virsh list Id Name State ---------------------------------------------------- 37911 alcsys-vm51 running
virsh console alcsys-vm51
tail -f /var/log/libvirt/bhyve/alcsys-vm51.log