create VMs without xml machine file

This commit is contained in:
Raphael Dannecker 2024-01-24 10:02:03 +01:00
parent 5a2ae0d33c
commit b5bb3c9fa6
5 changed files with 102 additions and 97 deletions

View file

@ -70,17 +70,6 @@ fi
# rebasing disk image
qemu-img rebase -f qcow2 -b "${NEWBASE}" -F qcow2 "${VM_NAME}.qcow2"
if [[ -v NEWNAME ]]; then
# copy and adapt machine definition file
CURRENTNAME="${CURRENTBASE/.qcow2/}"
if [[ -f "${CURRENTNAME}.xml" ]]; then
cp "${CURRENTNAME}.xml" "${NEWNAME}.xml"
elif [[ -f "${VM_SYSDIR}/${CURRENTNAME}.xml" ]]; then
cp "${VM_SYSDIR}/${CURRENTNAME}.xml" "${NEWNAME}.xml"
else
echo "no machine definition file found" >&2
exit 1
fi
sed -i "s/${CURRENTNAME}/${NEWNAME}/" "${NEWNAME}.xml"
NEWNAME="${NEWNAME}.qcow2"
else
rm "${CURRENTBASE}"