Using
I have an ansible file that create a VM name
user-data and meta-data are already created.
The issue : I need to create the VM with QEMU
I found few sources, for how to convert the virtual machine to QEMU.
Using this https://developers.redhat.com/blog/2020/03/06/configure-and-run-a-qemu-based-vm-outside-of-libvirt article
And this https://unix.stackexchange.com/questions/587045/convert-libvirt-xml-into-qemu-command-line question.
I have created a script file, when this script is run, it will (supposedly) convert the VM to QEMU.
The problem with the script is that, it simulates/run the VM but doesn't create it.
So I tried to recreate the VM with the command
When I try to boot I get a message saying the boot drive can't be found.
Checking the image with qemu-img shows no errors.
libvirt
, I am creating VM on Proxmox with Scaleway.I have an ansible file that create a VM name
CentOS_Base
, the most important commands are:
Bash:
# Downloading a CentOS-7-x86_64-GenericCloud-1809.qcow2
curl https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1809.qcow2
# Create root disk based on cloud init img
qemu-img create -b CentOS-7-x86_64-GenericCloud.qcow2 -f qcow2 -F qcow2 CentOS_Base.qcow2 20G
# Create iso image for cloud init
genisoimage -output cidata.iso -volid cidata -joliet -r user-data meta-data
# Create the VM
virt-install --connect qemu:///system --import --name CentOS_Base --ram 2048 --vcpus 2
--disk CentOS_Base.qcow2,format=qcow2,bus=virtio --disk cidata.iso,device=cdrom
--network network:default,model=virtio --os-type=linux --os-variant=rhel7 --noautoconsole
user-data and meta-data are already created.
The issue : I need to create the VM with QEMU
I found few sources, for how to convert the virtual machine to QEMU.
Using this https://developers.redhat.com/blog/2020/03/06/configure-and-run-a-qemu-based-vm-outside-of-libvirt article
And this https://unix.stackexchange.com/questions/587045/convert-libvirt-xml-into-qemu-command-line question.
I have created a script file, when this script is run, it will (supposedly) convert the VM to QEMU.
Bash:
#!/bin/sh
export LC_ALL=C
export XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-1-CentOS_Base/.local/share
export XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-1-CentOS_Base/.cache
export XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-1-CentOS_Base/.config
export QEMU_AUDIO_DRV=spice
/usr/bin/qemu-system-x86_64
-name guest=CentOS_Base,debug-threads=on
...
-display gtk
The problem with the script is that, it simulates/run the VM but doesn't create it.
So I tried to recreate the VM with the command
qm create
:
Bash:
qm create 9006 --name CentOS-vm1 --memory 2048 --net0 virtio,bridge=vmbr1 --serial0 socket --vga serial0
-ide2 GlusterFs:iso/cidata.iso -bootdisk scsi0 -scsi0 GlusterFs:32 --scsihw virtio-scsi-pci
-ostype l26 -sockets 1 -cores 2 -cpu host -numa 1
qm importdisk 9006 CentOS_Base.qcow2 GlusterFs -format qcow2
When I try to boot I get a message saying the boot drive can't be found.
Checking the image with qemu-img shows no errors.
Bash:
qemu-img check /mnt/pve/GlusterFs/images/9006/vm-9006-disk-0.qcow2
No errors were found on the image.
26771/327680 = 8.17% allocated, 0.08% fragmented, 0.00% compressed clusters
Image end offset: 21478375424
Last edited: