2024/02/03

virsh attach-diskでCD-ROMをマウントできない

virsh attach-diskでCD-ROMをマウントしようとしたらエラーが出る。


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target vdc --mode readonly --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'vdc' does not support ejectable media

 

試行錯誤したので、結果をメモ


発見事項

  • --targetbusを指定しているか、いないかで処理が変わる。
  • 指定している場合は、--targetがvd、sd、hdのどれでも同じ挙動になる。
  • 指定していない場合は、--targetの文字列で挙動が変わる。
    • vdはエラーになるが、sdはbusとしてscsi、hdはideが指定され、attachされる。
    • vdで始まる場合は、busはvirtioが選択されるようだ。

 

--targetbusを指定した場合の結果は以下

targetbusmodesourcetypedriver結果
idereadonlyok
satareadonlyfileerror: unsupported configuration: unsupported driver name 'file' for disk 'sdc'
satareadonlyqemuok
satareadonlyrawerror: unsupported configuration: unsupported driver name 'raw' for disk 'sdc'
satareadonlyok
virtiofilerawerror: unsupported configuration: disk type of 'vdc' does not support ejectable media
virtioreadonlyfileerror: unsupported configuration: disk type of 'vdc' does not support ejectable media
virtioreadonlyerror: unsupported configuration: disk type of 'sdc' does not support ejectable media
virtioerror: unsupported configuration: disk type of 'vdc' does not support ejectable media


以下は、色々試行錯誤したときの結果の記録


1  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target vdc --targetbus virtio --sourcetype file --driver raw --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'vdc' does not support ejectable media

2  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus sata --mode readonly --driver qemu  --config
Disk attached successfully

targetはsd、vd、hdのどれでも同じ結果

3  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus ide --mode readonly --config
Disk attached successfully

targetはsd、vd、hdのどれでも同じ結果

4  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus virtio --mode readonly --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'sdc' does not support ejectable media

5  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus sata --mode readonly --config
Disk attached successfully

6  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target vdc --targetbus virtio --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'vdc' does not support ejectable media

7  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target vdc --targetbus virtio --mode readonly --driver file --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'vdc' does not support ejectable media

targetはsd、vd、hdのどれも同じエラーが出る

8  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus sata --mode readonly --driver raw  --config
error: Failed to attach disk
error: unsupported configuration: unsupported driver name 'raw' for disk 'sdc'

9  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --targetbus sata --mode readonly --driver file  --config
error: Failed to attach disk
error: unsupported configuration: unsupported driver name 'file' for disk 'sdc'

10  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target hdc --mode readonly --config
Disk attached successfully

11  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target vdc --mode readonly --config
error: Failed to attach disk
error: unsupported configuration: disk type of 'vdc' does not support ejectable media

12  


# virsh attach-disk --domain guestVM --type cdrom --source /path-to-iso/cdrom.iso --target sdc --mode readonly --config
Disk attached successfully

 

  ちなみに、qcow2のイメージは--target vdcで普通にマウントできた


# virsh attach-disk --domain guestVM --source /path-to-qcow2/qcow2-os.img --target vdc --config
Disk attached successfully

 

 

0 件のコメント:

コメントを投稿