spice的debug输出一般都是采用标准输出或者标准错误输出的方式,如果想查看debug的输出需要设置环境变量或者加参数等。
1.spice-server的debug
spice-server的debug分为5个等级是采用枚举的方式定义的SpiceLogLevel
typedef enum {
SPICE_LOG_LEVEL_ERROR,
SPICE_LOG_LEVEL_CRITICAL,
SPICE_LOG_LEVEL_WARNING,
SPICE_LOG_LEVEL_INFO,
SPICE_LOG_LEVEL_DEBUG,
} SpiceLogLevel;
分别都有想对应的函数比如spice_info,spice_debug等。spice-server是通过getenv函数获得SPICE_DEBUG_LEVEL的环境变量还输出相应的debug信息。
相应查看相应的输出需要设置SPICE_DEBUG_LEVEL的环境变量,如果想查看SPICE_LOG_LEVEL_DEBUG以下的信息,在终端中输入:export SPICE_DEBUG_LEVEL=3
然后通过命令行启动虚拟机比如:
/usr/libexec/qemu-kvm -m 1024 -smp 1 -spice port=5901,addr=0.0.0.0,disable-ticketing -vga qxl -global qxl-vga.vram_size=67108864 /mnt/local/495c19e4-fa33-4995-878f-665817d0aac5 -netdev user,id=user.0 -device e1000,netdev=user.0 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
就会在终端中看到相应的输出,如果想想把debug信息放到log文件中可以在启动虚拟机后面加上:> /tmp/spice-server.log 2>&1
2.qxl的debug
spice官网有qxl构建和debug的相关介绍:
qxl debug
3.spice-gtk的debug
通过命令行连接虚拟机:spicy.exe -h 192.168.1.20 -p 5900 --spice-debug