[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] Different mac address used in libvirtd

I found libvirtd will create vnet0 with a different mac other than the one defined in domain file. The mac in Domain file will be used by qemu-kvm.
I want to know how libvirtd decides the mac for vnet0, Who can give me a hint about the location of the libvirtd codes which does this work?

I cannot find how the libvirtd translates the mac from one defined in domain file to vnet0's one in src/util/bridge.c: brSetInterfaceMac()
Yong Sheng Gong

[root robinlinux eclipsecdt]# virsh dumpxml 2
<domain type='kvm' id='2'>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <cmdline>root=/dev/vda console=ttyS0</cmdline>
    <boot dev='hd'/>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/nova/instances/instance-00000002/disk'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    <interface type='bridge'>
      <mac address='fa:16:3e:28:64:c2'/>
      <source bridge='br100'/>
      <target dev='vnet0'/>
      <filterref filter='nova-instance-instance-00000002-fa163e2864c2'>
        <parameter name='DHCPSERVER' value=''/>
        <parameter name='PROJNET' value=''/>
        <parameter name='PROJMASK' value=''/>
        <parameter name='IP' value=''/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    <serial type='file'>
      <source path='/var/lib/nova/instances/instance-00000002/console.log'/>
      <target port='0'/>
      <alias name='serial0'/>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='1'/>
      <alias name='serial1'/>
    <console type='file'>
      <source path='/var/lib/nova/instances/instance-00000002/console.log'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='' keymap='en-us'>
      <listen type='address' address=''/>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

[root robinlinux eclipsecdt]# ifconfig  vnet0
vnet0     Link encap:Ethernet  HWaddr FE:16:3E:28:64:C2  
          inet6 addr: fe80::fc16:3eff:fe28:64c2/64 Scope:Link
          RX packets:553 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1485 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:136360 (133.1 KiB)  TX bytes:280590 (274.0 KiB)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]