[libvirt] Get IP of ghost from remote with libvirt

angelo alfano angeloalfa at gmail.com
Fri Mar 5 12:40:33 UTC 2010

Hello everyone, sorry for my English,
I need to create a script (preferably in Python) that runs on a host
machine, I return the IP address of a Ghost running, providing its hostname.
In this VM is assigned the IP in DHCP with a network with this

$ virsh net-dumpxml network1
Connecting to uri: qemu:///system
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' forwardDelay='0' />
  <ip address='' netmask=''>
      <range start='' end='' />

While the configuration of one of the VM is:

$ virsh dumpxml test1
Connecting to uri: qemu:///system
<domain type='kvm' id='1'>
    <type arch='x86_64' machine='pc-0.11'>hvm</type>
    <boot dev='hd'/>
  <clock offset='utc'/>
    <disk type='file' device='cdrom'>
      <target dev='hdc' bus='ide'/>
    <disk type='file' device='disk'>
      <source file='/var/lib/libvirt/images/test1.img'/>
      <target dev='vda' bus='virtio'/>
    <interface type='network'>
      <mac address='54:52:00:4e:59:0d'/>
      <source network='network1'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' keymap='it'/>
    <sound model='es1370'/>
      <model type='cirrus' vram='9216' heads='1'/>
  <seclabel type='dynamic' model='apparmor'>

Give me a hand?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100305/15c03f55/attachment-0001.htm>

More information about the libvir-list mailing list