<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">hi, Michal Privoznik<div><br></div><div>i am a bit confusion about type of vm's interface . </div><div><interface type='network'> and <interface type='bridge'></div><div>do the Qos in libvirt can apply to both case?</div><div><br></div><div><br></div><div>thanks</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>At 2014-01-10 17:45:23,"Michal Privoznik" <mprivozn@redhat.com> wrote:<br><br></div><div>>On 10.01.2014 09:37, yue wrote:<br>>> hi,all<br>>> if we can control the bandwidth of vm at hypervisor level?<br>>> i know linux tc command  can control traffic, but it is at ISO level 3, <br>>> vm;s network is on bridge at level 2.<br>>>  <br>>> how libvirt implement traffic control over vm?<br>>>  <br>>> thanks<br>>> <br>><br>>I'm not sure the linux traffic shaper works on layer 3. I'd say linux<br>>inserts a new layer (called "queuing layer") in between layers 2 and 3<br>>just to allow traffic shaping on bridges too. Hence, there's no need for<br>>libvirt to treat bridges differently than the rest of devices when it<br>>comes to traffic shaping (e.g. TUN/TAP device). If your bridge is<br>>managed by libvirt, you can insert a simple XML snippet to corresponding<br>>network configuration, e.g.:<br>><br>> <bandwidth><br>>    <inbound average='1000' peak='5000' burst='5120'/><br>>    <outbound average='128' peak='256' burst='256'/><br>>  </bandwidth><br>><br>>http://libvirt.org/formatnetwork.html#elementQoS<br>><br>>Same applies for each domain's interface:<br>><br>>     <bandwidth><br>>        <inbound average='1000' peak='5000' floor='200' burst='1024'/><br>>        <outbound average='128' peak='256' burst='256'/><br>>      </bandwidth><br>><br>><br>>http://libvirt.org/formatdomain.html#elementQoS<br>><br>>If you're interested in implementation details I'd suggest to dive into<br>><br>>http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/util/virnetdevbandwidth.c;h=ed6a19d7faa3b564e4aa6c184418ebd85305a712;hb=HEAD#l45<br>><br>>Libvirt creates rather a complex tree of qdiscs (things get complicated<br>>once a device hotplug is allowed). But there's nearly a page comment<br>>with a picture showing what's going on.<br>><br>>Michal</div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>