Triggering a checkpoint from inside the VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm on a RHEL 8 host, using virt-manager to run a CentOS 8 guest.  I need to be able to have a program on the guest trigger a checkpoint to save the guest.  I came up with a kludgy way to do this involving a script that ssh's to the host and runs 'virsh qemu-monitor-command --hmp centos8_1 "savevm savestate1"' and that works to some degree, but it takes a long time and sometimes I get an error.

So, I'm trying to think of ways to simplify the system.  If anyone has any ideas, I would love to have them.  All I can think of is:
  1. Connect to the qemu monitor with telnet from inside the VM.  (Therefore skipping the whole ssh remote command thing.)
  2. Run the VM without virt-manager (perhaps that would be simpler?)
I actually don't know how to do #1 without doing #2.  When I ran qemu from the command line there was a command line argument to define the port the monitor should open on.  I don't know how to access the monitor via telnet without that command line argument.

As for #2, I'm having trouble getting that to work as well.  I found this page and followed the instructions: https://developers.redhat.com/blog/2020/03/06/configure-and-run-a-qemu-based-vm-outside-of-libvirt (although he talks about qemu-system-x86_64 and I'm using qemu-kvm, but I hope that doesn't make any difference.)

But I can't get it to work.  I've tried a number of modifications, and the command line below launches the VM, but I can't access it.  No screen pops up, and I can't get there via ssh.  If I take off the last lines about the display it will say I can use VNC ::1:5900, but when I connect there it just says "guest has not initialized display yet."

Anybody have any ideas on any of this?
Here's the command line I've tried.  The removing the last 2 arguments does change the display behavior, but not to any particular benefit:
#! /bin/sh
export LC_ALL=C
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
export HOME=/var/lib/libvirt/qemu/domain-6-centos8_3
export XDG_DATA_HOME=/var/lib/libvirt/qemu/domain-6-centos8_3/.local/share
export XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain-6-centos8_3/.cache
export XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain-6-centos8_3/.config
export QEMU_AUDIO_DRV=spice
/usr/libexec/qemu-kvm \
-name guest=centos8_3,debug-threads=on \
-S \
-enable-fips \
-machine pc-q35-rhel8.2.0,accel=kvm,usb=off,vmport=off,dump-guest-core=off \
-cpu Skylake-Server-IBRS,ss=on,vmx=on,pdcm=on,hypervisor=on,tsc-adjust=on,clflushopt=on,umip=on,pku=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaves=on,ibpb=on,ibrs=on,amd-stibp=on,amd-ssbd=on,skip-l1dfl-vmentry=on,pschange-mc-no=on \
-m 24000 \
-overcommit mem-lock=off \
-smp 2,sockets=2,cores=1,threads=1 \
-uuid 8dd20f24-3e31-464c-956e-67d3d9f2a83c \
-no-user-config \
-rtc base=utc,driftfix=slew \
-global kvm-pit.lost_tick_policy=delay \
-no-hpet \
-no-shutdown \
-global ICH9-LPC.disable_s3=1 \
-global ICH9-LPC.disable_s4=1 \
-boot strict=on \
-device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 \
-device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 \
-device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 \
-device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 \
-device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 \
-device pcie-root-port,port=0x15,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 \
-device pcie-root-port,port=0x16,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6 \
-device pcie-root-port,port=0x17,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7 \
-device pcie-pci-bridge,id=pci.9,bus=pci.1,addr=0x0 \
-device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 \
-blockdev '{"driver":"file","filename":"/home/leek2/qemu/rhel8_1-clone-1.qcow2","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":null}' \
-device virtio-blk-pci,scsi=off,bus=pci.4,addr=0x0,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \
-device virtio-net-pci,netdev=hostnet0,id=net0,mac=6c:2b:59:e9:44:49,bus=pci.7,addr=0x0 \
-netdev bridge,id=hostnet0,br=virbr0 \
-chardev spicevmc,id=charchannel0,name=vdagent \
-device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
-device virtio-balloon-pci,id=balloon0,bus=pci.5,addr=0x0 \
-object rng-random,id=objrng0,filename=/dev/urandom \
-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.6,addr=0x0 \
-msg timestamp=on \
-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 \
-spice port=5900,addr=127.0.0.1,disable-ticketing,image-compression=off,seamless-migration=on



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux