virsh console ubuntu

ubuntu guest setting

  systemctl disable systemd-networkd-wait-online
  systemctl enable serial-getty@ttyS0.service
  systemctl start serial-getty@ttyS0.service

login by console

  virsh console ubuntu1

exit guest

  ctrl + ]

virsh xml define

<domain type='kvm' >
  <name>slb1</name>
  <memory unit='MiB'>1024</memory>
  <currentMemory unit='MiB'>1024</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc'>hvm</type>
    <boot dev='hd'/>
    <!--boot dev='cdrom'/--> 
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/opt/vms/slb1.qcow2'/>
      <target dev='hda' bus='ide'/>
    </disk>

    <interface type='network'>
      <source network='default'/>
      <target dev='vnet-slb1'/>
    </interface>

    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>

    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>

    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>

    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>

    <graphics type='vnc' port='-1' listen = '0.0.0.0' keymap='en-us'/>

  </devices>
</domain>

end.

posted @ 2017-12-15 20:50  changxun  阅读(721)  评论(0编辑  收藏  举报