<div dir="ltr">2008/10/3 Evgeniy Sokolov <span dir="ltr"><<a href="mailto:evg@openvz.org" target="_blank">evg@openvz.org</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div><div></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi.<br>
<br>
I rewrite functions taken from vzctl in the new patch, so this:<br>
 <br>
<br>
        Here is the patch, that implements the following behaviour<br>
<br>
        * interface name inside container is automatically generated and<br>
        equals ethN,<br>
           where N is the number of that interface within current domain<br>
        * mac address of that interface inside container is generated<br>
        automatically by<br>
           function openvzGenerateMac<br>
        * if <target dev=""> is specified, use it; otherwise, use the<br>
        default openvz name,<br>
           i.e., vethN.M for interface ethM in container with veid N<br>
        * if <mac address='...'> specified, use it; otherwise, vzctl<br>
        will generate it automatically<br>
        * <target dev> and <mac address> are (re)stored (from)to $veid.conf<br>
<br>
<br>
is true, while that:<br>
<br>
<br>
    the functions openvzGenerateMac and<br>
    openvzGenerateVethName are taken from vzctl sources and slightly<br>
    changed then<br>
<br>
<br>
is not true anymore.<br>
</blockquote>
<br></div></div>
+static char *<br>
+openvzGenerateMac(void)<br>
+{<br>
+    char mac[6] = {<br>
+        0x52,<br>
+        0x54,<br>
+        0x00,<br>
How did you get 0x52, 0x54, 0x00?</blockquote><div><br>This is the same as in virDomainNetRandomMAC() function, see the source code for it.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<br>
<br>
+    if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {<br>
+        static int vnetNo = 0;<br>
<br>
Libvirt may be use as library in applications. If some will call create 2 containers, then first container will have eth0...ethN<br>
second will have ethN+1...</blockquote><div>OK, I will try to fix it.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Other looks good.</blockquote></div>Actually, there is a bug :( When we generate host interface name, we need to save it in net->ifname.<br><br><br><br>
P.S. Now I am working on that:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
P.S. Are someone going to implement<br>
      <interface type='bridge'><br>
         ...<br>
          <source bridge="..."><br>
         ...<br>
       </interface><br>
part of openvz driver? :)<br>
</blockquote></div>
I plan to implement it in a month.<br>
It will be fine if you are ready to develop the feature.<br>
</blockquote><div><br>I'm using $veid.conf to store information about bridge device in the following manner:<br>for interface <ifname>, therhe will be a line<br>   #BRIGDE(<ifname>): <bridge name><br>
for example,<br>   #BRIDGE(veth101.0): virbr1<br><br>Do you agree with that behaviour?<br></div></div></div>