Contribute to project- Multiple Nics on containers(openvz)

dazza76

Renowned Member
May 25, 2010
41
0
71
Hello,
I am just started using proxmox and saw it missed 1 minor feature :
The ability to add multiple interfaces to openvz(containers) from the GUI.

as such i have modified the code to support this.

this is a simple hack allowing upto 4 interfaces to be configured
I plan to improve this if we can submit changes:D

Is there any place to submit this minor change as i see it an important one for openvz users

here is my diff of the openvz/network.htm

> $fdat{eth1mac} = PVE::Utils::trim ($fdat{eth1mac});
> $fdat{eth2mac} = PVE::Utils::trim ($fdat{eth2mac});
> $fdat{eth3mac} = PVE::Utils::trim ($fdat{eth3mac});
>
108a113,153
> if ($fdat{eth1bridge} eq 'disabled') {
> if (defined ($ifaces->{'eth1'})) {
> delete $ifaces->{'eth1'};
> $iflist = create_iflist ($ifaces);
> }
> } elsif ($fdat{eth1bridge}) {
> check_field (__("MAC Address"), $fdat{eth1mac}, 'NOTEMPTY', 'NOWHITESPACES', 'MAC');
>
> $ifaces->{'eth1'}->{create} = 1;
> $ifaces->{'eth1'}->{bridge} = $fdat{eth1bridge};
> $ifaces->{'eth1'}->{mac} = $fdat{eth1mac};
> $iflist = create_iflist ($ifaces);
> }
>
> if ($fdat{eth2bridge} eq 'disabled') {
> if (defined ($ifaces->{'eth2'})) {
> delete $ifaces->{'eth2'};
> $iflist = create_iflist ($ifaces);
> }
> } elsif ($fdat{eth1bridge}) {
> check_field (__("MAC Address"), $fdat{eth1mac}, 'NOTEMPTY', 'NOWHITESPACES', 'MAC');
>
> $ifaces->{'eth2'}->{create} = 1;
> $ifaces->{'eth2'}->{bridge} = $fdat{eth2bridge};
> $ifaces->{'eth2'}->{mac} = $fdat{eth2mac};
> $iflist = create_iflist ($ifaces);
> }
>
> if ($fdat{eth3bridge} eq 'disabled') {
> if (defined ($ifaces->{'eth3'})) {
> delete $ifaces->{'eth3'};
> $iflist = create_iflist ($ifaces);
> }
> } elsif ($fdat{eth1bridge}) {
> check_field (__("MAC Address"), $fdat{eth1mac}, 'NOTEMPTY', 'NOWHITESPACES', 'MAC');
>
> $ifaces->{'eth3'}->{create} = 1;
> $ifaces->{'eth3'}->{bridge} = $fdat{eth1bridge};
> $ifaces->{'eth3'}->{mac} = $fdat{eth1mac};
> $iflist = create_iflist ($ifaces);
> }
248c293
< if ($fdat{eth0bridge} && $fdat{eth0bridge} ne 'disabled') {
---
> if ($fdat{eth0bridge} && $fdat{eth0bridge} ne 'disabled' || $eth0bridge ne 'disabled') {
251a297,323
>
> $grid->add_row (@ea);
>
> my $eth1bridge = defined ($ifaces->{'eth1'}) ? $ifaces->{'eth1'}->{bridge} || 'vmbr1' : 'disabled';
> my $eth1mac = defined ($ifaces->{'eth1'}) ? $ifaces->{'eth1'}->{mac} : PVE::QemuServer::random_ether_addr();
> my @ea = ('eth1:',
> $brform->create_element ('eth1bridge', 'dynamicdropdown',
> $fdat{eth1bridge} || $eth1bridge,
> [ 'disabled' , @$bridges ]));
> if ($fdat{eth1bridge} && $fdat{eth1bridge} ne 'disabled' || $eth1bridge ne 'disabled') {
> push @ea, __("MAC Address") . ':',
> $brform->create_element ('eth1mac', 'text', $fdat{eth1mac} || $eth1mac);
>
> }
> $grid->add_row (@ea);
>
> my $eth2bridge = defined ($ifaces->{'eth2'}) ? $ifaces->{'eth2'}->{bridge} || 'vmbr1' : 'disabled';
> my $eth2mac = defined ($ifaces->{'eth2'}) ? $ifaces->{'eth2'}->{mac} : PVE::QemuServer::random_ether_addr();
> my @ea = ('eth2:',
> $brform->create_element ('eth2bridge', 'dynamicdropdown',
> $fdat{eth2bridge} || $eth2bridge,
> [ 'disabled' , @$bridges ]));
> if ($fdat{eth2bridge} && $fdat{eth2bridge} ne 'disabled' || $eth2bridge ne 'disabled') {
> push @ea, __("MAC Address") . ':',
> $brform->create_element ('eth2mac', 'text', $fdat{eth2mac} || $eth2mac);
>
> }
252a325,342
> my $eth3bridge = defined ($ifaces->{'eth3'}) ? $ifaces->{'eth3'}->{bridge} || 'vmbr1' : 'disabled';
> my $eth3mac = defined ($ifaces->{'eth3'}) ? $ifaces->{'eth3'}->{mac} : PVE::QemuServer::random_ether_addr();
> my @ea = ('eth3:',
> $brform->create_element ('eth3bridge', 'dynamicdropdown',
> $fdat{eth3bridge} || $eth3bridge,
> [ 'disabled' , @$bridges ]));
> if ($fdat{eth3bridge} && $fdat{eth3bridge} ne 'disabled' || $eth3bridge ne 'disabled') {
> push @ea, __("MAC Address") . ':',
> $brform->create_element ('eth3mac', 'text', $fdat{eth3mac} || $eth3mac);
>
> }
> $grid->add_row (@ea);



Regards,
Darren
 
Is there any place to submit this minor change as i see it an important one for openvz users

Just send the diff (please use 'diff -u') to me (dietmar@proxmox.com). I guess we can include
that if you remove the limit of 4 devices.
 
i have also emailed it to you:

This update allows multiple nics on openvz

hope this is usefull for some.
 

Attachments

  • network.zip
    2.4 KB · Views: 11
  • network.txt
    2.8 KB · Views: 27
Hello,

Thanks dazza76 for your contrib. I was very bad need for this feature. When we can see this patch include into 1.5?

Thank you
 
Thanks dazza76 for your contrib. I was very bad need for this feature. When we can see this patch include into 1.5?

Sorry, but there are too many things to work on currently. I will include it as soon as I get some time to do it.
 
Hi dietmar

Thank you for your reply. I am in phase of testing Proxmox VE to replace all my current custom openvz/kvm installation (3 Dell R710), after I knew that your solution support kernel 2.6.18. I have a complicated network configuration, each server with 10 NIC, group in two bond, one for SAN/NAS lan the other configured as trunk with switch to have access to 6 vlan. I need this config because the VM hosted reside on deference vlan and required access to at least two vlan. Your solution will be very much perfect if it has a feature to configure more that one veth in the container.

Thank you very much
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!