Re: [libvirt] PATCH 3/4: SUpport bridge config for openvz

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

 



On Thu, Oct 16, 2008 at 07:52:42PM +0400, Evgeniy Sokolov wrote:
> >This implements support for bridge configs in openvz following the rules
> >set out in
> >
> >http://wiki.openvz.org/Virtual_Ethernet_device#Making_a_bridged_veth-device_persistent
> >
> >This simply requires that the admin has created /etc/vz/vznetctl.conf
> >containing
> >
> >  #!/bin/bash
> >  EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
> >
> >
> >For openvz <= 3.0.22, we have to manually re-write the NETIF line to
> >add the bridge config parameter. 
> It is alternative, but more flexible way. It require simple modification 
> of vznetaddbr.
> Common scenario is to add VZHOSTBR="<bridge if>" to config.
> For newer openvz we can simply pass
> >the bridge name on the commnand line to --netif_add.
> >
> >Older openvz also requires that the admin install /usr/sbin/vznetaddbr
> >since it is not available out of the box
> >
> >Daniel
> >
> 
> 
> >+
> >+    while(1) {
> >+        if (openvz_readline(fd, line, sizeof(line)) <= 0)
> >+            break;
> >+
> >+        if (!STRPREFIX(line, param)) {
> need to check for '='.
> Currently, if you will search for 'NETIF', you can find any string with 
> such prefix. example 'NETIFOTHERPARAM'

Ahh, good point, will fix that.

> >+            if (safewrite(temp_fd, line, strlen(line)) !=
> >+                strlen(line))
> >+                goto error;
> >+        }
> >+    }
> >+
> > /*
> 
> >+
> >+        if (!(opt = virBufferContentAndReset(&buf)))
> >+            goto no_memory;
> >+
> >         ADD_ARG_LIT(opt) ;
> Need to free opt

Yes.

> >-    }else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
> >+    } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET &&
> >               net->data.ethernet.ipaddr != NULL) {
> 
> >+static int
> >+openvzDomainSetNetworkConfig(virConnectPtr conn,
> >+                             virDomainDefPtr def)
> >+{
> >+    unsigned int i;
> >+    virBuffer buf = VIR_BUFFER_INITIALIZER;
> >+    char *param;
> >+    struct openvz_driver *driver = (struct openvz_driver *) 
> >conn->privateData;
> >+
> >+    for (i = 0 ; i < def->nnets ; i++) {
> >+        if (driver->version < VZCTL_BRIDGE_MIN_VERSION && i > 0)
> >+            virBufferAddLit(&buf, ";");
> Need to check that network is bridge.
> In other case we will have NETIF='<some params>;;;;'

Opps, completely forgot that check

> >+
> >+        if (openvzDomainSetNetwork(conn, def->name, def->nets[i], &buf) < 
> >0) {
> >+            openvzError(conn, VIR_ERR_INTERNAL_ERROR,
> >+                        "%s", _("Could not configure network"));
> >+            goto exit;
> >+        }
> >+    }
> >+

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
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]