Created attachment 799 [details] 使用vhd镜像的虚拟机不停重启 Description of problem: 使用anolis_23_x64_20G_alibase_20230619.vhd镜像创建虚拟机,虚拟机在不断重启 因不支持直接使用vhd镜像,使用命令qemu-img convert -f vpc -O qcow2 /ImagePath/ImageName.vhd /ImagePath/ImageName.qcow2把vhd镜像转换成qcow2后通过xml文件创建虚拟机,calltrace信息截图见附件 Version-Release number of selected component (if applicable): 5.10.134-14.1.an23.x86_64 Steps to Reproduce: 1.下载vhd镜像并使用命令qemu-img convert -f vpc -O qcow2 /ImagePath/ImageName.vhd /ImagePath/ImageName.qcow2把vhd镜像转换成qcow2镜像 2.修改xml文件 3.执行virsh create xxx.xml Actual results: 镜像启动虚拟机后在不停重启 Expected results: 虚拟机正常进入安装界面,并正常安装启动 Additional info: xml文件如下 #cat temp.xml <domain type='kvm'> <name>lyq_an23_vhd</name> <!-- guest 名字 --> <memory>16777216</memory> <!-- 16GB 内存 --> <vcpu placement='static' current='4'>4</vcpu> <!-- 4 core --> <cpu mode='custom'> <topology sockets='2' cores='2' threads='2'/> </cpu> <os> <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <pae/> </features> <clock offset="localtime" timezone="Asia/Shanghai"> <timer name='rtc' tickpolicy='catchup' track='guest'/> <timer name='pit' tickpolicy='delay'/> <timer name='hpet' present='no'/> </clock> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type="file" device="disk"> <driver name="qemu" type="qcow2" cache="none" dataplane="on" io="native"/> <source file="/disk1/liuyaqing/RC2/anolis_23_x64_20G_alibase_20230619.qcow2"/> <target dev="vda" bus="virtio"/> </disk> <interface type="network"> <source network='default'/> <model type="virtio"/> </interface> <serial type="pty"> <target port="0"/> </serial> <console type="pty"> <target type="serial" port="0"/> </console> <video> <model type='vga' vram='16384' heads='1'/> <alias name='video0'/> </video> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5999' sharePolicy='allow-exclusive' > <listen type='address' address='0.0.0.0'/> </graphics> <memballoon model='none'/> </devices> </domain>
calltrace信息如下: [ 0.963644] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 Fatal glibc error: CPU does not support x86-64-v2 [ 0.964852] CPU: 0 PID: 1 Comm: init Not tainted 5.10.134-14.1.an23.x86_64 #1 [ 0.965734] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 [ 0.966455] Call Trace: [ 0.966833] dump_stack+0x57/0x6e [ 0.967276] panic+0x10e/0x307 [ 0.967689] do_exit.cold+0xa3/0xaf [ 0.968139] do_group_exit+0x33/0x90 [ 0.968603] __x64_sys_exit_group+0x14/0x20 [ 0.969133] do_syscall_64+0x33/0x40 [ 0.969600] entry_SYSCALL_64_after_hwframe+0x61/0xc6 [ 0.970226] RIP: 0033:0x7fabdd9a5e31 [ 0.970686] Code: 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa be e7 00 00 00 ba 3c 00 00 00 eb 0d 89 d0 0f 05 48 3d 00 f0 ff ff 77 1c f4 89 f0 0f 05 <48> 3d 00 f0 ff ff 76 e7 f7 d8 89 05 3f 14 01 00 eb dd 0f 1f 44 00 [ 0.972833] RSP: 002b:00007ffee2315e88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 0.973859] RAX: ffffffffffffffda RBX: 00007fabdd9a0e80 RCX: 00007fabdd9a5e31 [ 0.974783] RDX: 000000000000003c RSI: 00000000000000e7 RDI: 000000000000007f [ 0.975721] RBP: 00007ffee2316060 R08: 00007ffee2315e98 R09: 0000000000000000 [ 0.976617] R10: 0000000000000020 R11: 0000000000000246 R12: 0000000000000000 [ 0.977510] R13: 00007fabdd9b6ab0 R14: 00007fabdd984000 R15: 00007fabdd984470 [ 0.979448] Kernel Offset: 0x3a000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
看起来是镜像或者systemd的问题,转baseos
两个原因。 第一个是使用 qemu-img 命令进行转换时,qemu-img 命令的版本太低,导致转换出来的 qcrow2 是有问题的。已经更换至 2.0 以上的版本,进行验证。ok。 第二个是 xml 里部分需要更新。采用如下 xml,启动成功,没有相关报错。 $cat anolis23.xml <domain type='kvm'> <name>anolis23</name> <memory>8007152</memory> <!-- 1 GB内存。 --> <vcpu>96</vcpu> <os> <type arch='x86_64'>hvm</type> <boot dev='hd'/> </os> <cpu mode="host-passthrough"/> <clock sync="localtime"/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type='file' device='disk'><!-- 请根据镜像格式设置下面的type参数:qcow2对应type='qcow2'、vhd对应type='vpc'。 --> <driver name='qemu' type='qcow2' cache='none' dataplane='on' io='native'/> <!-- 如果要创建qcow2快照,需要关闭dataplane。 --> <source file='/home/songnannan.snn/vm/anolis23/anolis_23_x64_20G_alibase_20230619.qcow2'/> <target dev='vda' bus='virtio'/> </disk> <interface type='network'> <source network='default'/> <model type='virtio'/> </interface> <console type='pty'> <target type='virtio' port='0'/> </console> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> </video> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5917' autoport='no' listen='0.0.0.0'> <listen type='address' address='0.0.0.0'/> </graphics> </devices> </domain>
用的低版本qemu-img是1.5.3-105版本,这旧版本无法启动也是需要看下的
vhd 目前是通过山海平台制作出来的,所以需要的 qemu-ing 版本需要大与 2.0 版本。
(In reply to happy_orange from comment #5) > vhd 目前是通过山海平台制作出来的,所以需要的 qemu-ing 版本需要大与 2.0 版本。 如果用户使用低版本qemu-img,仍然会遇到该问题,问题没有消除,至少要在release note明确说明
我们同时提供 qcow2 和 vhd 两种格式的镜像,防止用户因为自身环境的问题导致转换问题出现问题。