Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

B.6. ゲスト仮想マシンの停止をエラーで起動します。 No boot device

現象
既存のディスクイメージからゲスト仮想マシンを構築すると、ゲストの起動が停止し、エラーメッセージ No boot device が表示されます。ただし、ゲスト仮想マシンは QEMU コマンドを直接使用して正常に起動できます。
調査
ディスクのバスタイプは、既存のディスクイメージをインポートするために コマンドで指定されていません。
# virt-install \
--connect qemu:///system \
--ram 2048 -n rhel_64 \
--os-type=linux --os-variant=rhel5 \
--disk  path=/root/RHEL-Server-5.8-64-virtio.qcow2,device=disk,format=qcow2 \
--vcpus=2 --graphics spice --noautoconsole --import
ただし、QEMU を使用してゲスト仮想マシンを起動するために使用されるコマンドラインは、バスタイプに virtio を使用することを示しています。
# ps -ef | grep qemu
/usr/libexec/qemu-kvm -monitor stdio -drive file=/root/RHEL-Server-5.8-32-virtio.qcow2,index=0,if=virtio,media=disk,cache=none,format=qcow2 -net nic,vlan=0,model=rtl8139,macaddr=00:30:91:aa:04:74 -net tap,vlan=0,script=/etc/qemu-ifup,downscript=no -m 2048 -smp 2,cores=1,threads=1,sockets=2 -cpu qemu64,+sse2 -soundhw ac97 -rtc-td-hack -M rhel5.6.0 -usbdevice tablet -vnc :10 -boot c -no-kvm-pit-reinjection
インポートしたゲスト用に libvirt によって生成されたゲストの XML の bus= をメモします。
<domain type='qemu'>
 <name>rhel_64</name>
 <uuid>6cd34d52-59e3-5a42-29e4-1d173759f3e7</uuid>
 <memory>2097152</memory>
 <currentMemory>2097152</currentMemory>
 <vcpu>2</vcpu>
 <os>
   <type arch='x86_64' machine='rhel5.4.0'>hvm</type>
   <boot dev='hd'/>
 </os>
 <features>
   <acpi/>
   <apic/>
   <pae/>
 </features>
 <clock offset='utc'>
   <timer name='pit' tickpolicy='delay'/>
 </clock>
 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>restart</on_crash>
 <devices>
   <emulator>/usr/libexec/qemu-kvm</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='qcow2' cache='none'/>
     <source file='/root/RHEL-Server-5.8-64-virtio.qcow2'/>
     <emphasis role="bold"><target dev='hda' bus='ide'/></emphasis>
     <address type='drive' controller='0' bus='0' unit='0'/>
   </disk>
   <controller type='ide' index='0'/>
   <interface type='bridge'>
     <mac address='54:52:00:08:3e:8c'/>
     <source bridge='br0'/>
   </interface>
   <serial type='pty'>
     <target port='0'/>
   </serial>
   <console type='pty'>
     <target port='0'/>
   </console>
   <input type='mouse' bus='ps2'/>
   <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
   <video>
     <model type='cirrus' vram='9216' heads='1'/>
   </video>
 </devices>
 </domain>
ディスクのバスタイプは ide に設定されています。これは、libvirt によって設定されるデフォルト値です。これは間違ったバスタイプであり、インポートされたゲストで起動に失敗した原因となっていました。
解決方法

手順B.2 ディスクバスタイプの修正

  1. インポートされたゲストの定義を解除してから、bus=virtio と以下のように再インポートします。
    # virsh destroy rhel_64
    # virsh undefine rhel_64
    # virt-install \
    --connect qemu:///system \
    --ram 1024 -n rhel_64 -r 2048 \
    --os-type=linux --os-variant=rhel5  \
    --disk path=/root/RHEL-Server-5.8-64-virtio.qcow2,device=disk,bus=virtio,format=qcow2 \
    --vcpus=2 --graphics spice --noautoconsole --import
  2. virsh edit を使用してインポートされたゲストの XML を編集し、ディスクバスの種類を修正します。