用於串行裝置的 virsh Attach-device

用於串行裝置的 virsh Attach-device

我想透過命令向來賓添加串行設備(控制台)virsh attach-device。我有一個 console.xml 文件,其中包含:

<serial type="pty">
  <target port="0"/>
</serial>

我運行以下命令:

sudo virsh attach-device VMNAME console.xml

但出現以下錯誤:

error: Failed to attach device from console.xml
error: XML error: unknown device type

這是我的版本資訊:

Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
Running hypervisor: QEMU 1.0.0

我究竟做錯了什麼?我如何從腳本添加這個?任何幫助,將不勝感激!

提前致謝。

答案1

根據 libvirt文件,你還需要一個來源元素。像這樣的事情:

<serial type='pty'>
  <source path='/dev/pts/3'/>
  <target port='0'/>
</serial>

相關內容