[libvirt] libvirt equivalent config for a kvm command line

Rajkumar S rajkumars at gmail.com
Thu Nov 20 14:09:46 UTC 2008


I had been running kvm in a previous version of Ubuntu with the
following command line:

-hda /mnt/kvm/vm-images-work/nanobsd.img
-net nic,vlan=26,macaddr=52:54:00:12:34:26 -net tap,vlan=26,ifname=tap26
-net nic,vlan=27,macaddr=52:54:00:12:34:27 -net tap,vlan=27,ifname=tap27
-net nic,vlan=28,macaddr=52:54:00:12:34:28 -net tap,vlan=28,ifname=tap28
-m 640 -vnc :26 -usbdevice tablet

The vm shows couple if lines in console and then redirects rest of the
output to serial console. I can see that in ctrl-alt-3 of vncviewer
ctrl-alt-2 gives access to emulation console and 4 gives access to
parallel console.

After upgrading to latest Intrepid Ibex I decided to move to using
virsh to manage my vms. For the above vm I am using the following xml

<domain type='kvm'>
    <boot dev='hd'/>
  <clock offset='localtime'/>
    <disk type='file' device='disk'>
      <source file='/mnt/kvm/vm-images-work/nanotest.img'/>
      <target dev='hda' bus='ide'/>
    <interface type='bridge'>
      <mac address='52:54:00:12:34:31'/>
      <source bridge='br0'/>
    <interface type='bridge'>
      <mac address='52:54:00:12:34:32'/>
      <source bridge='br0'/>
    <interface type='bridge'>
      <mac address='52:54:00:12:34:33'/>
      <source bridge='br0'/>
    <serial type='vc'>
      <target port='2'/>
    <console type='pty'>
      <target port='0'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5931' listen=''/>

Which produces the following command line.

 /usr/bin/kvm -S -M pc -m 256 -smp 1 -name nanobsd -monitor pty
-localtime -boot c
-drive file=/mnt/kvm/vm-images-work/nanotest.img,if=ide,index=0,boot=on
-net nic,macaddr=52:54:00:12:34:31,vlan=0 -net
-net nic,macaddr=52:54:00:12:34:32,vlan=1 -net
-net nic,macaddr=52:54:00:12:34:33,vlan=2 -net
-serial vc -parallel none -usb -vnc

Problem with this configuration is that the screen freezes after
couple of minuets of booting, I am not sure if this is the problem
with the serial console or actual execution. I can see the serial
console in ctrl-alt-2, but the window size changes. The image works
perfectly in normal PC as well as if I use the previous command line.
I guess I am missing some thing here, but I would be very happy if I
can get the old behaviour back :)


More information about the libvir-list mailing list