Re: [libvirt] [OpenVZ]

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

 



Hi,

attached patch fix problem.

Guys,

        is it really an issue to fix also mac generation for OpenVZ? Vzctl generates different macs for host's and domain's eth devices. Libvirt creates them with equal macs.

        In this case there is a bridge support for OpenVZ in libvirt but it doesn't work ... :-( And it has to implement additional steps for changing macs after container creation.

This message (including attachments) is private and confidential. If you have received this message in error, please notify us and remove it from your system.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



Index: openvz_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/openvz_driver.c,v
retrieving revision 1.65
diff -u -p -r1.65 openvz_driver.c
--- openvz_driver.c	17 Dec 2008 21:13:19 -0000	1.65
+++ openvz_driver.c	18 Dec 2008 13:42:28 -0000
@@ -473,6 +473,8 @@ openvzDomainSetNetwork(virConnectPtr con
     int rc = 0, narg;
     const char *prog[OPENVZ_MAX_ARG];
     char macaddr[VIR_MAC_STRING_BUFLEN];
+    unsigned char host_mac[VIR_MAC_BUFLEN];
+    char host_macaddr[VIR_MAC_STRING_BUFLEN];
     struct openvz_driver *driver =  conn->privateData;
     char *opt = NULL;
 
@@ -507,6 +509,8 @@ openvzDomainSetNetwork(virConnectPtr con
     }
 
     virFormatMacAddr(net->mac, macaddr);
+    virCapabilitiesGenerateMac(driver->caps, host_mac);
+    virFormatMacAddr(host_mac, host_macaddr);
 
     if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
         virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -541,7 +545,7 @@ openvzDomainSetNetwork(virConnectPtr con
         virBufferAdd(&buf, dev_name_ve, -1); /* Guest dev */
         virBufferVSprintf(&buf, ",%s", macaddr); /* Guest dev mac */
         virBufferVSprintf(&buf, ",%s", net->ifname); /* Host dev */
-        virBufferVSprintf(&buf, ",%s", macaddr); /* Host dev mac */
+        virBufferVSprintf(&buf, ",%s", host_macaddr); /* Host dev mac */
 
         if (driver->version >= VZCTL_BRIDGE_MIN_VERSION) {
             virBufferVSprintf(&buf, ",%s", net->data.bridge.brname); /* Host bridge */
@@ -549,7 +553,7 @@ openvzDomainSetNetwork(virConnectPtr con
             virBufferVSprintf(configBuf, "ifname=%s", dev_name_ve);
             virBufferVSprintf(configBuf, ",mac=%s", macaddr); /* Guest dev mac */
             virBufferVSprintf(configBuf, ",host_ifname=%s", net->ifname); /* Host dev */
-            virBufferVSprintf(configBuf, ",host_mac=%s", macaddr); /* Host dev mac */
+            virBufferVSprintf(configBuf, ",host_mac=%s", host_macaddr); /* Host dev mac */
             virBufferVSprintf(configBuf, ",bridge=%s", net->data.bridge.brname); /* Host bridge */
         }
 
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]