[pve-devel] Add support for OVS Trunk

Benjamin Lessani | Sonassi - The Magento Experts ben at sonassi.com
Mon Sep 15 13:27:21 CEST 2014


Hi Guys,

 

Given 3.3 has just been released, the changes I made to pvemanagerlib.js are
no longer valid, so I've adjusted the fixes to the following.

 

--

 

diff --git a/usr/share/pve-manager/ext4/pvemanagerlib.js
b/usr/share/pve-manager/ext4/pvemanagerlib.js

index 6f50679..c75e310 100644

--- a/usr/share/pve-manager/ext4/pvemanagerlib.js

+++ b/usr/share/pve-manager/ext4/pvemanagerlib.js

@@ -1303,9 +1303,11 @@ Ext.define('PVE.Parser', { statics: {

         } else if ((match_res = p.match(/^rate=(\d+(\.\d+)?)$/)) !== null)
{

         res.rate = match_res[1];

         } else if ((match_res = p.match(/^tag=(\d+(\.\d+)?)$/)) !== null) {

-                res.tag = match_res[1];

+        res.tag = match_res[1];

         } else if ((match_res = p.match(/^firewall=(\d+)$/)) !== null) {

-                res.firewall = match_res[1];

+        res.firewall = match_res[1];

+        } else if ((match_res = p.match(/^trunks=([0-9;]+)$/)) !== null) {

+        res.trunks = match_res[1];

         } else {

         errors = true;

         return false; // break

@@ -1333,6 +1335,9 @@ Ext.define('PVE.Parser', { statics: {

         if (net.firewall) {

         netstr += ",firewall=" + net.firewall;

         }

+        if (net.trunks) {

+        netstr += ",trunks=" + net.trunks;

+        }

     }

     if (net.rate) {

         netstr += ",rate=" + net.rate;

@@ -1442,6 +1447,7 @@ Ext.define('PVE.Parser', { statics: {

             data['bridge'] = bridge_res[1];

             data['tag'] = bridge_res[4];

             data['firewall'] = bridge_res[5] ? 1 : 0;

+            data['trunks'] = bridge_res[6];

         } else {

             data[match_res[1]] = match_res[2];

         }

@@ -1465,7 +1471,7 @@ Ext.define('PVE.Parser', { statics: {

 

     Ext.Object.each(netif, function(iface, data) {

         var tmparray = [];

-        Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' ,
'host_mac', 'mac_filter', 'tag', 'firewall'], function(key) {

+        Ext.Array.each(['ifname', 'mac', 'bridge', 'host_ifname' ,
'host_mac', 'mac_filter', 'tag', 'firewall', 'trunks'], function(key) {

         var value = data[key];

         if (key === 'bridge'){

             if(data['tag']){

@@ -1473,7 +1479,7 @@ Ext.define('PVE.Parser', { statics: {

             }

             if (data['firewall']){

             value = value + 'f';

-            }

+            }

         }

         if (value) {

             tmparray.push(key + '=' + value);

@@ -3999,6 +4005,14 @@ Ext.define('PVE.form.VlanField', {

     me.callParent();

     }

});

+Ext.define('PVE.form.VlansField', {

+    extend: 'Ext.form.field.Text',

+    alias: ['widget.pveVlansField'],

+    deleteEmpty: false,

+    emptyText: 'no VLANs',

+    fieldLabel: gettext('VLAN Trunks'),

+    allowBlank: true,

+});

Ext.define('PVE.form.Checkbox', {

     extend: 'Ext.form.field.Checkbox',

     alias: ['widget.pvecheckbox'],

@@ -15150,6 +15164,7 @@ Ext.define('PVE.qemu.MemoryEdit', {

         me.network.bridge = values.bridge;

         me.network.tag = values.tag;

         me.network.firewall = values.firewall;

+        me.network.trunks = values.trunks;

     } else {

         me.network.bridge = undefined;

     }

@@ -15222,6 +15237,7 @@ Ext.define('PVE.qemu.MemoryEdit', {

             me.down('field[name=bridge]').validate();

             me.down('field[name=tag]').setDisabled(!value);

             me.down('field[name=firewall]').setDisabled(!value);

+            me.down('field[name=trunks]').setDisabled(!value);

             }

         }

         },

@@ -15234,6 +15250,13 @@ Ext.define('PVE.qemu.MemoryEdit', {

         },

         me.bridgesel,

         {

+        xtype: 'pveVlansField',

+        name: 'trunks',

+        value: '',

+        labelAlign: 'right'

+        },

+        me.bridgesel,

+        {

         xtype: 'pvecheckbox',

         fieldLabel: gettext('Firewall'),

         name: 'firewall',

@@ -19211,6 +19234,11 @@ Ext.define('PVE.OpenVZ.NetIfEdit', {

             value: cdata.tag,

         },

         {

+            xtype: 'pveVlansField',

+            name: 'trunks',

+            value: cdata.trunks

+        },

+        {

             xtype: 'pvecheckbox',

             fieldLabel: gettext('Firewall'),

             name: 'firewall',

@@ -19564,7 +19592,7 @@ Ext.define('PVE.openvz.NetworkView', {

     Ext.define('pve-openvz-network', {

     extend: "Ext.data.Model",

     proxy: { type: 'memory' },

-    fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge',
'host_ifname', 'host_mac', 'tag', 'firewall' ]

+    fields: [ 'id', 'type', 'value', 'ifname', 'mac', 'bridge',
'host_ifname', 'host_mac', 'tag', 'firewall', 'trunks' ]

     });

 

});

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20140915/5ee0a480/attachment.htm>


More information about the pve-devel mailing list