Oracle 8 KVM 容器在启动时突然崩溃“内部错误:qemu 监视器的文件结束”

Oracle 8 KVM 容器在启动时突然崩溃“内部错误:qemu 监视器的文件结束”

我们有 2 台硬件服务器,上面安装有 Ubuntu 20.04 LTS两个都我们通过 KVM 运行 Oracle Linux 8。它们一直运行良好,直到今天。两者都无法正确启动,主机上出现以下错误消息:

内部错误:qemu 监视器的文件结束

我们现在不知道为什么。虚拟机上没有任何变化。

我们在两者上运行备份脚本并使用 Cockpit 来监控 VM 并进行设置,但到目前为止没有任何问题。

该脚本是两台主机上唯一运行的脚本,因此我认为它可能有问题但却找不到任何东西。

您是否经历过类似的事情?

备份脚本:

#!/bin/bash
set +x
exec < /dev/null

[[ -f /tmp/backup-running ]] && exit 1
touch /tmp/backup-running

# Path, where backups should be stored
PDST=/vmbackup

# Path, where temporary snapshots should be created
SNAP=/var/backups/temp_snapshots

# Check and create working directories
[[ -d ${PDST} ]] || mkdir -p ${PDST}
[[ -d ${SNAP} ]] || mkdir -p ${SNAP}

date=$(date +"%Y%m%d")

#mount /dev/sda1 ${DST} >/dev/null 2>&1

if [[ "$?" -ne 0 ]]; then
    echo "Unable to mount backup drive!"
    exit 1
fi

echo coppy VM: $(virsh list --all --name)

for VM in $(virsh list --all  --name); do
    #Directory path
    DST=${PDST}/$VM
    #Check and create VM Backup Folder
    [[ -d ${DST} ]] || mkdir -p ${DST}
    #add file with date
    rm -f ${PDST}/LAST_TRY_*
    rm -f ${DST}/LATEST_*

    echo "Backup KVM guest ${VM}"

    # Make sure, snapshot merging was successfull
    image_path=$(virsh domblklist ${VM} --details | \
                 grep vda | \
                 awk '{ print $4; }' | \
                 cut -d "/" -f -5)

    if [[ "$image_path" != "/var/lib/libvirt/images" ]]; then
        continue # Existing snapshot. Skipping
    fi

    if [[ ! -f ${SNAP}/backup-snapshot-${VM}.qcow2 ]]; then
        echo "Create Snapshot..."
        virsh snapshot-create-as ${VM} "backup-${VM}" \
            --diskspec vda,file=${SNAP}/backup-snapshot-${VM}.qcow2 \
            --disk-only \
            --atomic \
            --no-metadata
    else
        continue # Orphaned snapshot. Skipping
    fi

    echo "Copy guest image to backup drive..."
    cp -f --sparse=always /var/lib/libvirt/images/${VM}.qcow2 ${DST}/

    echo "Merge snapshot with guest image..."
    virsh blockcommit ${VM} vda --wait --active
    virsh blockjob ${VM} ${SNAP}/backup-snapshot-${VM}.qcow2 --pivot

    echo "Copy XML to backup drive..."
    cp -f /etc/libvirt/qemu/${VM}.xml ${DST}/

    # file with Date
    touch ${DST}/LATEST_$date

    # Make sure, snapshot merging was successfull
    image_path=$(virsh domblklist ${VM} --details | \
                 grep vda | \
                 awk '{ print $4; }' | \
                 cut -d "/" -f -5)

    if [[ "$image_path" == "/var/lib/libvirt/images" ]]; then
        echo "Remove snapshot..."
        rm -f ${SNAP}/backup-snapshot-${VM}.qcow2
    fi

    echo "VM as compressed_${VM}.qcow2"
    qemu-img convert -c -f qcow2 ${DST}/${VM}.qcow2 -O qcow2 ${DST}/compressed_${VM}.qcow2
    echo "entferne unkomprimiertes img ..."
    rm ${DST}/${VM}.qcow2
    echo "renaming VM to ${VM}.qcow2"
    mv ${DST}/compressed_${VM}.qcow2 ${DST}/${VM}.qcow2
done

touch ${PDST}/LAST_TRY_$date

echo "Syncing disk..."
sync
#umount ${DST}

rm -f /tmp/backup-running

exit 0

# vim: expandtab ts=4 sw=4

相关内容