Re: [pve-devel] Preview of the GUI with ExtJS5
* I hope you like blue (Default Theme of ExtJS5 is, well, blue) The contrast is much too high for my eyes (dark blue vs. white)... ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH 2/2] add node stats
Signed-off-by: Alexandre Derumier aderum...@odiso.com --- bin/pvestatd | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/pvestatd b/bin/pvestatd index 785380c..ad688a0 100755 --- a/bin/pvestatd +++ b/bin/pvestatd @@ -118,7 +118,18 @@ sub update_node_status { my $plugin_config = $status_cfg-{ids}-{$id}; next if $plugin_config-{disable}; my $plugin = PVE::Status::Plugin-lookup($plugin_config-{type}); - my $d = {}; # fixme: what data? + + my $d = {}; + $d-{uptime} = $uptime; + $d-{cpustat} = $stat; + $d-{cpustat}-{avg1} = $avg1; + $d-{cpustat}-{avg5} = $avg5; + $d-{cpustat}-{avg15} = $avg15; + $d-{cpustat}-{cpus} = $maxcpu; + $d-{memory} = $meminfo; + $d-{blockstat} = $dinfo; + $d-{nics} = $netdev; + $plugin-update_node_status($plugin_config, $nodename, $d, $ctime); } } -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
What about a gray theme? What about a user configurable theme option ? (Don't known if they are all compatibles without css/fonts hack?) - Mail original - De: datanom.net m...@datanom.net À: pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 17:29:28 Objet: Re: [pve-devel] Preview of the GUI with ExtJS5 On Mon, 22 Jun 2015 17:08:46 +0200 (CEST) Dietmar Maurer diet...@proxmox.com wrote: * I hope you like blue (Default Theme of ExtJS5 is, well, blue) The contrast is much too high for my eyes (dark blue vs. white)... What about a gray theme? -- Hilsen/Regards Michael Rasmussen Get my public GnuPG keys: michael at rasmussen dot cc http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xD3C9A00E mir at datanom dot net http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE501F51C mir at miras dot org http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE3E80917 -- /usr/games/fortune -es says: The truth about a woman often lasts longer than the woman is true. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Add support for external graphite metric server
On June 22, 2015 at 4:53 PM Alexandre DERUMIER aderum...@odiso.com wrote: Hi Dietmar, I have a bug in current plugin framework inside Graphite.pm for example sub update_node_status { my ($plugin_config, $node, $data, $ctime) = @_; } The $plugin_config var content = 'PVE::Status::Graphite' ??? in pvestatd, this is correct my $plugin_config = $status_cfg-{ids}-{$id}; I have the hashref with plugin options Any idea ? Sorry, the first element is the $class. So please correct the function signature to: sub update_node_status { my ($class, $plugin_config, $node, $data, $ctime) = @_; Does that work? ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH 1/2] add graphite plugin
diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm index cbc1229..cd246f9 100644 --- a/PVE/Status/Graphite.pm +++ b/PVE/Status/Graphite.pm @@ -7,6 +7,8 @@ use PVE::Status::Plugin; # example config (/etc/pve/status.cfg) #graphite: #graphiteserver test +#port 2003 +#path proxmox.mycluster #disable 0 # @@ -22,39 +24,91 @@ sub properties { type = 'string', description = External graphite statistic server, what format exactly? }, + port = { +type = 'string', + description = graphite server port, + default = 2003, why is this type 'string'? + }, + path = { +type = 'string', + description = root graphite path, + default = 'proxmox' what format exactly? ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
On Mon, 22 Jun 2015 17:08:46 +0200 (CEST) Dietmar Maurer diet...@proxmox.com wrote: * I hope you like blue (Default Theme of ExtJS5 is, well, blue) The contrast is much too high for my eyes (dark blue vs. white)... What about a gray theme? -- Hilsen/Regards Michael Rasmussen Get my public GnuPG keys: michael at rasmussen dot cc http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xD3C9A00E mir at datanom dot net http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE501F51C mir at miras dot org http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0xE3E80917 -- /usr/games/fortune -es says: The truth about a woman often lasts longer than the woman is true. pgp83oc0T9WZb.pgp Description: OpenPGP digital signature ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Add support for external graphite metric server
Does that work? yes, thanks. I'll fix that in my patch for plugin.pm too - Mail original - De: dietmar diet...@proxmox.com À: aderumier aderum...@odiso.com Cc: pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 17:25:05 Objet: Re: [pve-devel] Add support for external graphite metric server On June 22, 2015 at 4:53 PM Alexandre DERUMIER aderum...@odiso.com wrote: Hi Dietmar, I have a bug in current plugin framework inside Graphite.pm for example sub update_node_status { my ($plugin_config, $node, $data, $ctime) = @_; } The $plugin_config var content = 'PVE::Status::Graphite' ??? in pvestatd, this is correct my $plugin_config = $status_cfg-{ids}-{$id}; I have the hashref with plugin options Any idea ? Sorry, the first element is the $class. So please correct the function signature to: sub update_node_status { my ($class, $plugin_config, $node, $data, $ctime) = @_; Does that work? ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH 1/2] add graphite plugin
Signed-off-by: Alexandre Derumier aderum...@odiso.com --- PVE/Status/Graphite.pm | 72 +++--- PVE/Status/Plugin.pm | 8 +++--- bin/pvestatd | 8 +++--- 3 files changed, 71 insertions(+), 17 deletions(-) diff --git a/PVE/Status/Graphite.pm b/PVE/Status/Graphite.pm index cbc1229..cd246f9 100644 --- a/PVE/Status/Graphite.pm +++ b/PVE/Status/Graphite.pm @@ -7,6 +7,8 @@ use PVE::Status::Plugin; # example config (/etc/pve/status.cfg) #graphite: # graphiteserver test +# port 2003 +# path proxmox.mycluster # disable 0 # @@ -22,39 +24,91 @@ sub properties { type = 'string', description = External graphite statistic server, }, + port = { +type = 'string', + description = graphite server port, + default = 2003, + }, + path = { +type = 'string', + description = root graphite path, + default = 'proxmox' + }, }; } sub options { return { graphiteserver = {}, + port = { optional = 1 }, + path = { optional = 1 }, disable = { optional = 1 }, }; } # Plugin implementation sub update_node_status { -my ($plugin_config, $node, $data) = @_; +my ($class, $plugin_config, $node, $data, $ctime) = @_; + +write_graphite_hash($plugin_config, $data, $ctime, nodes.$node); -# implement me } sub update_qemu_status { -my ($plugin_config, $vmid, $data) = @_; - -# implement me +my ($class, $plugin_config, $vmid, $data, $ctime) = @_; +write_graphite_hash($plugin_config, $data, $ctime, qemu.$vmid); } sub update_lxc_status { -my ($plugin_config, $vmid, $data) = @_; +my ($class, $plugin_config, $vmid, $data, $ctime) = @_; -# implement me +write_graphite_hash($plugin_config, $data, $ctime, lxc.$vmid); } sub update_storage_status { -my ($plugin_config, $storeid, $data) = @_; +my ($class, $plugin_config, $nodename, $storeid, $data, $ctime) = @_; + +write_graphite_hash($plugin_config, $data, $ctime, storages.$nodename.$storeid); +} + +sub write_graphite_hash { +my ($plugin_config, $d, $ctime, $object) = @_; + +my $host = $plugin_config-{graphiteserver}; +my $port = $plugin_config-{port} ? $plugin_config-{port} : 2003; +my $path = $plugin_config-{path} ? $plugin_config-{path} : 'proxmox'; + +my $carbon_socket = IO::Socket::IP-new( +PeerAddr= $host, +PeerPort= $port, +Proto = 'udp', +); + +write_graphite($carbon_socket, $d, $ctime, $path..$object); + +$carbon_socket-close() if $carbon_socket; + +} + +sub write_graphite { +my ($carbon_socket, $d, $ctime, $path) = @_; + +for my $key (keys %$d) { + +my $value = $d-{$key}; +my $oldpath = $path; +$key =~ s/\./-/g; +$path .= .$key; -# implement me +if ( defined $value ) { +if ( ref $value eq 'HASH' ) { +write_graphite($carbon_socket, $value, $ctime, $path); +}else { +$carbon_socket-send( $path $value $ctime ); +} +} +$path = $oldpath; +} } 1; diff --git a/PVE/Status/Plugin.pm b/PVE/Status/Plugin.pm index 13d9b3c..699d868 100644 --- a/PVE/Status/Plugin.pm +++ b/PVE/Status/Plugin.pm @@ -48,25 +48,25 @@ sub parse_section_header { } sub update_node_status { -my ($plugin_config, $node, $data) = @_; +my ($class, $plugin_config, $node, $data, $ctime) = @_; die please implement inside plugin; } sub update_qemu_status { -my ($plugin_config, $vmid, $data) = @_; +my ($class, $plugin_config, $vmid, $data, $ctime) = @_; die please implement inside plugin; } sub update_lxc_status { -my ($plugin_config, $vmid, $data) = @_; +my ($class, $plugin_config, $vmid, $data, $ctime) = @_; die please implement inside plugin; } sub update_storage_status { -my ($plugin_config, $storeid, $data) = @_; +my ($class, $plugin_config, $nodename, $storeid, $data, $ctime) = @_; die please implement inside plugin; } diff --git a/bin/pvestatd b/bin/pvestatd index 51bb245..785380c 100755 --- a/bin/pvestatd +++ b/bin/pvestatd @@ -119,7 +119,7 @@ sub update_node_status { next if $plugin_config-{disable}; my $plugin = PVE::Status::Plugin-lookup($plugin_config-{type}); my $d = {}; # fixme: what data? - $plugin-update_node_status($plugin_config, $nodename, $d); + $plugin-update_node_status($plugin_config, $nodename, $d, $ctime); } } @@ -197,7 +197,7 @@ sub update_qemu_status { my $plugin_config = $status_cfg-{ids}-{$id}; next if $plugin_config-{disable}; my $plugin = PVE::Status::Plugin-lookup($plugin_config-{type}); - $plugin-update_qemu_status($plugin_config, $vmid, $d); + $plugin-update_qemu_status($plugin_config, $vmid, $d, $ctime);
Re: [pve-devel] Add support for external graphite metric server
Hi Dietmar, I have a bug in current plugin framework inside Graphite.pm for example sub update_node_status { my ($plugin_config, $node, $data, $ctime) = @_; } The $plugin_config var content = 'PVE::Status::Graphite' ??? in pvestatd, this is correct my $plugin_config = $status_cfg-{ids}-{$id}; I have the hashref with plugin options Any idea ? - Mail original - De: dietmar diet...@proxmox.com À: aderumier aderum...@odiso.com Cc: pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 09:51:43 Objet: Re: [pve-devel] Add support for external graphite metric server Ok, finally implemented the status plugin framework: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff;h=9d4f69ff6a4d88919ff0a1281c0d0705035f1900 https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=56678698baf5d877ea2d2ed3a35cd8b2058dd7de Please can you rebase your work on the new framework? On June 16, 2015 at 11:52 AM Dietmar Maurer diet...@proxmox.com wrote: Could you create an empty sample Plugin ? I'm reading the code, but I'm a little bit lost. yes, but I need a few days for that. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
Hi As for the remove-button issue you mentioned a while ago, I had an idea which is probably a bit of a PITA to implement, but just to get it out in the open: what about moving the item related action buttons into the list's rows so that there's a remove/edit-button per element? (The row height would probably need to be increased by a few pixels, though, so the buttons don't stick together too much.) This was discussed in this a bug report, https://bugzilla.proxmox.com/show_bug.cgi?id=360 If I understand you, this means the list elements would look like this ( notice the position of the edit / delete button) http://ww1.prweb.com/prfiles/2013/03/14/10505421/modifications%20to%20learning%20objective%20screen.png The glyphs in this list come from the Twitter Boostrap CSS frameworks: http://getbootstrap.com/components/ I will add this information in the bug report. Emmanuel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] lxc: add hotplug memory cpus cgroups value V3
changelog: - rename cgroups_write to write_cgroup_value (to match the existing read_cgroup_value) - write config after each $opt if vm is running. (In case of hotplug fail, when nic hotplug will be implemented) - push nohotplug $opt in an array, and display them at the end Signed-off-by: Alexandre Derumier aderum...@odiso.com --- src/PVE/LXC.pm | 37 +++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 068b46f..2f4d9eb 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -804,6 +804,14 @@ sub read_cgroup_value { return PVE::Tools::file_read_firstline($path); } +sub write_cgroup_value { + my ($group, $vmid, $name, $value) = @_; + + my $path = /sys/fs/cgroup/$group/lxc/$vmid/$name; + PVE::ProcFSTools::write_proc_entry($path, $value) if -e $path; + +} + sub find_lxc_console_pids { my $res = {}; @@ -964,8 +972,7 @@ sub verify_searchdomain_list { sub update_lxc_config { my ($vmid, $conf, $running, $param, $delete) = @_; -# fixme: hotplug -die unable to modify config while container is running\n if $running; +my @nohotplug; if (defined($delete)) { foreach my $opt (@$delete) { @@ -973,6 +980,7 @@ sub update_lxc_config { die unable to delete required option '$opt'\n; } elsif ($opt eq 'swap') { delete $conf-{'lxc.cgroup.memory.memsw.limit_in_bytes'}; + write_cgroup_value(memory, $vmid, memory.memsw.limit_in_bytes, -1); } elsif ($opt eq 'description') { delete $conf-{'pve.comment'}; } elsif ($opt eq 'onboot') { @@ -981,13 +989,20 @@ sub update_lxc_config { delete $conf-{'pve.startup'}; } elsif ($opt eq 'nameserver') { delete $conf-{'pve.nameserver'}; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'searchdomain') { delete $conf-{'pve.searchdomain'}; + push @nohotplug, $opt; + next if $running; } elsif ($opt =~ m/^net\d$/) { delete $conf-{$opt}; + push @nohotplug, $opt; + next if $running; } else { die implement me } + PVE::LXC::write_config($vmid, $conf) if $running; } } @@ -1002,39 +1017,56 @@ sub update_lxc_config { } elsif ($opt eq 'nameserver') { my $list = verify_nameserver_list($value); $conf-{'pve.nameserver'} = $list; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'searchdomain') { my $list = verify_searchdomain_list($value); $conf-{'pve.searchdomain'} = $list; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'memory') { $conf-{'lxc.cgroup.memory.limit_in_bytes'} = $value*1024*1024; + write_cgroup_value(memory, $vmid, memory.limit_in_bytes, $value*1024*1024); } elsif ($opt eq 'swap') { my $mem = $conf-{'lxc.cgroup.memory.limit_in_bytes'}; $mem = $param-{memory}*1024*1024 if $param-{memory}; $conf-{'lxc.cgroup.memory.memsw.limit_in_bytes'} = $mem + $value*1024*1024; + write_cgroup_value(memory, $vmid, memory.memsw.limit_in_bytes, $mem + $value*1024*1024); + } elsif ($opt eq 'cpulimit') { if ($value 0) { my $cfs_period_us = 10; $conf-{'lxc.cgroup.cpu.cfs_period_us'} = $cfs_period_us; $conf-{'lxc.cgroup.cpu.cfs_quota_us'} = $cfs_period_us*$value; + write_cgroup_value(cpu, $vmid, cpu.cfs_quota_us, $cfs_period_us*$value); } else { delete $conf-{'lxc.cgroup.cpu.cfs_period_us'}; delete $conf-{'lxc.cgroup.cpu.cfs_quota_us'}; + write_cgroup_value(cpu, $vmid, cpu.cfs_quota_us, -1); } } elsif ($opt eq 'cpuunits') { $conf-{'lxc.cgroup.cpu.shares'} = $value; + write_cgroup_value(cpu, $vmid, cpu.shares, $value); } elsif ($opt eq 'description') { $conf-{'pve.comment'} = PVE::Tools::encode_text($value); } elsif ($opt eq 'disk') { $conf-{'pve.disksize'} = $value; + push @nohotplug, $opt; + next if $running; } elsif ($opt =~ m/^net(\d+)$/) { my $netid = $1; my $net = PVE::LXC::parse_lxc_network($value); $net-{'veth.pair'} = veth${vmid}.$netid; $conf-{$opt} = $net; + push @nohotplug, $opt; + next if $running; } else { die implement me } + PVE::LXC::write_config($vmid, $conf) if $running; } + +die unable to modify .join(,,@nohotplug). while container is running\n if @nohotplug 0 $running; } sub get_primary_ips { @@ -1071,5 +1103,6 @@ sub
Re: [pve-devel] [PATCH] enable lxc hotplug
applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] Extent man description for network settings
From: w.l...@proxmox.com Wolfgang Link There was no source expect the sourcecode, where the user can see the possible options. Signed-off-by: w.l...@proxmox.com Wolfgang Link --- src/PVE/LXC.pm | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 11788cd..c3842ac 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -596,7 +596,12 @@ for (my $i = 0; $i $MAX_LXC_NETWORKS; $i++) { $confdesc-{net$i} = { optional = 1, type = 'string', format = 'pve-lxc-network', - description = Specifies network interfaces for the container., + description = Specifies network interfaces for the container.\n\n. + The string should have the follow format:\n\n. + -net[0-9] bridge=vmbrNummber[,hwaddr=MAC]\n. + [,mut=Number][,name=String][,ip=IPv4Format/CIDR]\n. + ,ip6=IPv6Format/CIDR][,gw=GatwayIPv4]\n. + ,gw6=GatwayIPv6][,firewall=[1|0]][,tag=VlanNo], }; } -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] Fix ZFSPoolPlugin path for subvol
Signed-off-by: Wolfgang Link w.l...@proxmox.com --- PVE/Storage/ZFSPoolPlugin.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm index cae598d..6b095f1 100644 --- a/PVE/Storage/ZFSPoolPlugin.pm +++ b/PVE/Storage/ZFSPoolPlugin.pm @@ -150,7 +150,7 @@ sub path { if ($vtype eq images) { if ($volname =~ m/^subvol-/) { # fixme: we currently assume standard mount point?! - $path = $scfg-{pool}/$volname; + $path = /$scfg-{pool}/$volname; } else { $path = /dev/zvol/$scfg-{pool}/$volname; } -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Add support for external graphite metric server
Ok, finally implemented the status plugin framework: Thanks ! Please can you rebase your work on the new framework? I'll do that today. (BTW,Don't have too much to work on cloudinit this week, so if proxmox team have time to work on it, it could be great :) - Mail original - De: dietmar diet...@proxmox.com À: aderumier aderum...@odiso.com Cc: pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 09:51:43 Objet: Re: [pve-devel] Add support for external graphite metric server Ok, finally implemented the status plugin framework: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff;h=9d4f69ff6a4d88919ff0a1281c0d0705035f1900 https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=56678698baf5d877ea2d2ed3a35cd8b2058dd7de Please can you rebase your work on the new framework? On June 16, 2015 at 11:52 AM Dietmar Maurer diet...@proxmox.com wrote: Could you create an empty sample Plugin ? I'm reading the code, but I'm a little bit lost. yes, but I need a few days for that. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH] lxc: add hotplug memory cpus cgroups value V3
Hi Alexandre, I already commited the first version of the patch (sorry): https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=3a43e41a0c5a79e4d847eb48161f90c4b03bfc7a Please can you rebase? On June 22, 2015 at 8:48 AM Alexandre Derumier aderum...@odiso.com wrote: changelog: - rename cgroups_write to write_cgroup_value (to match the existing read_cgroup_value) - write config after each $opt if vm is running. (In case of hotplug fail, when nic hotplug will be implemented) - push nohotplug $opt in an array, and display them at the end ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH] lxc: add hotplug memory cpus cgroups value V3
Please can you rebase? Sure. (Is this patch ok for you ?) - Mail original - De: dietmar diet...@proxmox.com À: aderumier aderum...@odiso.com, pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 10:19:33 Objet: Re: [pve-devel] [PATCH] lxc: add hotplug memory cpus cgroups value V3 Hi Alexandre, I already commited the first version of the patch (sorry): https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=3a43e41a0c5a79e4d847eb48161f90c4b03bfc7a Please can you rebase? On June 22, 2015 at 8:48 AM Alexandre Derumier aderum...@odiso.com wrote: changelog: - rename cgroups_write to write_cgroup_value (to match the existing read_cgroup_value) - write config after each $opt if vm is running. (In case of hotplug fail, when nic hotplug will be implemented) - push nohotplug $opt in an array, and display them at the end ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH] lxc: add hotplug memory cpus cgroups value V3
Please can you rebase? Sure. (Is this patch ok for you ?) Yes. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] enable lxc hotplug
Signed-off-by: Alexandre Derumier aderum...@odiso.com --- src/PVE/LXC.pm | 52 ++-- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 72ab3c8..2ddee60 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -817,6 +817,14 @@ sub read_cgroup_value { return PVE::Tools::file_read_firstline($path); } +sub write_cgroup_value { + my ($group, $vmid, $name, $value) = @_; + + my $path = /sys/fs/cgroup/$group/lxc/$vmid/$name; + PVE::ProcFSTools::write_proc_entry($path, $value) if -e $path; + +} + sub find_lxc_console_pids { my $res = {}; @@ -977,16 +985,15 @@ sub verify_searchdomain_list { sub update_lxc_config { my ($vmid, $conf, $running, $param, $delete) = @_; -# fixme: hotplug -die unable to modify config while container is running\n if $running; - +my @nohotplug; + if (defined($delete)) { foreach my $opt (@$delete) { if ($opt eq 'hostname' || $opt eq 'memory') { die unable to delete required option '$opt'\n; } elsif ($opt eq 'swap') { delete $conf-{'lxc.cgroup.memory.memsw.limit_in_bytes'}; - cgroups_write(memory, $vmid, memsw.limit_in_bytes, -1, $running); + write_cgroup_value(memory, $vmid, memory.memsw.limit_in_bytes, -1); } elsif ($opt eq 'description') { delete $conf-{'pve.comment'}; } elsif ($opt eq 'onboot') { @@ -995,13 +1002,20 @@ sub update_lxc_config { delete $conf-{'pve.startup'}; } elsif ($opt eq 'nameserver') { delete $conf-{'pve.nameserver'}; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'searchdomain') { delete $conf-{'pve.searchdomain'}; + push @nohotplug, $opt; + next if $running; } elsif ($opt =~ m/^net\d$/) { delete $conf-{$opt}; + push @nohotplug, $opt; + next if $running; } else { die implement me } + PVE::LXC::write_config($vmid, $conf) if $running; } } @@ -1016,45 +1030,56 @@ sub update_lxc_config { } elsif ($opt eq 'nameserver') { my $list = verify_nameserver_list($value); $conf-{'pve.nameserver'} = $list; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'searchdomain') { my $list = verify_searchdomain_list($value); $conf-{'pve.searchdomain'} = $list; + push @nohotplug, $opt; + next if $running; } elsif ($opt eq 'memory') { $conf-{'lxc.cgroup.memory.limit_in_bytes'} = $value*1024*1024; - cgroups_write(memory, $vmid, memory.limit_in_bytes, $value*1024*1024, $running); + write_cgroup_value(memory, $vmid, memory.limit_in_bytes, $value*1024*1024); } elsif ($opt eq 'swap') { my $mem = $conf-{'lxc.cgroup.memory.limit_in_bytes'}; $mem = $param-{memory}*1024*1024 if $param-{memory}; $conf-{'lxc.cgroup.memory.memsw.limit_in_bytes'} = $mem + $value*1024*1024; - cgroups_write(memory, $vmid, memsw.limit_in_bytes, $mem + $value*1024*1024, $running); + write_cgroup_value(memory, $vmid, memory.memsw.limit_in_bytes, $mem + $value*1024*1024); } elsif ($opt eq 'cpulimit') { if ($value 0) { my $cfs_period_us = 10; $conf-{'lxc.cgroup.cpu.cfs_period_us'} = $cfs_period_us; $conf-{'lxc.cgroup.cpu.cfs_quota_us'} = $cfs_period_us*$value; - cgroups_write(cpu, $vmid, cpu.cfs_quota_us, $cfs_period_us*$value, $running); + write_cgroup_value(cpu, $vmid, cpu.cfs_quota_us, $cfs_period_us*$value); } else { delete $conf-{'lxc.cgroup.cpu.cfs_period_us'}; delete $conf-{'lxc.cgroup.cpu.cfs_quota_us'}; - cgroups_write(cpu, $vmid, cpu.cfs_quota_us, -1, $running); + write_cgroup_value(cpu, $vmid, cpu.cfs_quota_us, -1); } } elsif ($opt eq 'cpuunits') { $conf-{'lxc.cgroup.cpu.shares'} = $value; - cgroups_write(cpu, $vmid, cpu.shares, $value, $running); + write_cgroup_value(cpu, $vmid, cpu.shares, $value); } elsif ($opt eq 'description') { $conf-{'pve.comment'} = PVE::Tools::encode_text($value); } elsif ($opt eq 'disk') { $conf-{'pve.disksize'} = $value; + push @nohotplug, $opt; + next if $running; } elsif ($opt =~ m/^net(\d+)$/) { my $netid = $1; my $net = PVE::LXC::parse_lxc_network($value); $net-{'veth.pair'} = veth${vmid}.$netid; $conf-{$opt} = $net; + push @nohotplug, $opt; + next if $running;
Re: [pve-devel] Add support for external graphite metric server
Ok, finally implemented the status plugin framework: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff;h=9d4f69ff6a4d88919ff0a1281c0d0705035f1900 https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=56678698baf5d877ea2d2ed3a35cd8b2058dd7de Please can you rebase your work on the new framework? On June 16, 2015 at 11:52 AM Dietmar Maurer diet...@proxmox.com wrote: Could you create an empty sample Plugin ? I'm reading the code, but I'm a little bit lost. yes, but I need a few days for that. ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH] correct typo
From: w.l...@proxmox.com Wolfgang Link Signed-off-by: w.l...@proxmox.com Wolfgang Link --- src/PVE/LXC.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 068b46f..11788cd 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -228,7 +228,7 @@ sub parse_lxc_option { my $parser = $valid_lxc_keys-{$name}; -die inavlid key '$name'\n if !defined($parser); +die invalid key '$name'\n if !defined($parser); if ($parser eq '1') { return $value; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
The contrast is much too high for my eyes (dark blue vs. white)... I think that extjs5 crisp theme is less agressive http://odisoweb1.odiso.net/crisp.png - Mail original - De: dietmar diet...@proxmox.com À: Emmanuel Kasper e.kas...@proxmox.com, pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 17:08:46 Objet: Re: [pve-devel] Preview of the GUI with ExtJS5 * I hope you like blue (Default Theme of ExtJS5 is, well, blue) The contrast is much too high for my eyes (dark blue vs. white)... ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
something like this could be worderful http://dox.codaxy.com/ext5-themes/Basic (too bad, it's a commercial theme). light blue for headers, grey for forms background - Mail original - De: aderumier aderum...@odiso.com À: dietmar diet...@proxmox.com Cc: pve-devel pve-devel@pve.proxmox.com Envoyé: Mardi 23 Juin 2015 05:52:47 Objet: Re: [pve-devel] Preview of the GUI with ExtJS5 The contrast is much too high for my eyes (dark blue vs. white)... I think that extjs5 crisp theme is less agressive http://odisoweb1.odiso.net/crisp.png - Mail original - De: dietmar diet...@proxmox.com À: Emmanuel Kasper e.kas...@proxmox.com, pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 17:08:46 Objet: Re: [pve-devel] Preview of the GUI with ExtJS5 * I hope you like blue (Default Theme of ExtJS5 is, well, blue) The contrast is much too high for my eyes (dark blue vs. white)... ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 1/3] PVE::API2::Ceph: network_interfaces update + ipv6
--- PVE/API2/Ceph.pm | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index 217b8ce..b7eea84 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -765,16 +765,18 @@ __PACKAGE__-register_method ({ my $find_node_ip = sub { my ($cidr) = @_; -my $config = PVE::INotify::read_file('interfaces'); - my $net = Net::IP-new($cidr) || die Net::IP::Error() . \n; +my $id = $net-version == 6 ? 'address6' : 'address'; + +my $config = PVE::INotify::read_file('interfaces'); +my $ifaces = $config-{ifaces}; -foreach my $iface (keys %$config) { +foreach my $iface (keys %$ifaces) { my $d = $config-{$iface}; - next if !$d-{address}; - my $a = Net::IP-new($d-{address}); + next if !$d-{$id}; + my $a = Net::IP-new($d-{$id}); next if !$a; - return $d-{address} if $net-overlaps($a); + return $d-{$id} if $net-overlaps($a); } die unable to find local address within network '$cidr'\n; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 3/3] www/network: ipv6 related columns and edit fields
--- www/manager/Toolkit.js | 6 ++ www/manager/Utils.js| 1 + www/manager/node/NetworkEdit.js | 39 +++ www/manager/node/NetworkView.js | 20 ++-- 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/www/manager/Toolkit.js b/www/manager/Toolkit.js index c9a354f..ecee399 100644 --- a/www/manager/Toolkit.js +++ b/www/manager/Toolkit.js @@ -25,6 +25,12 @@ Ext.apply(Ext.form.field.VTypes, { IP6AddressText: gettext('Example') + ': 2001:DB8::42', IP6AddressMask: /[A-Fa-f0-9:]/, +IP6Subnet: function(v) { +return IP6_subnet_match.test(v); +}, +IP6SubnetText: gettext('Example') + ': 112', +IP6SubnetMask: /[0-9]/, + IP6CIDRAddress: function(v) { return IP6_cidr_match.test(v); }, diff --git a/www/manager/Utils.js b/www/manager/Utils.js index 7632822..345c756 100644 --- a/www/manager/Utils.js +++ b/www/manager/Utils.js @@ -45,6 +45,7 @@ var IPV6_REGEXP = (?: + var IP6_match = new RegExp(^(?: + IPV6_REGEXP + )$); var IP6_cidr_match = new RegExp(^(?: + IPV6_REGEXP + )\/[0-9]{1,3}?$); var IP6_bracket_match = new RegExp(^\\[( + IPV6_REGEXP + )\\]); +var IP6_subnet_match = new RegExp(^(?:12[0-8]|1[01][0-9]|[1-9]?[0-9])$); var IP64_match = new RegExp(^(?: + IPV6_REGEXP + | + IPV4_REGEXP + )$); diff --git a/www/manager/node/NetworkEdit.js b/www/manager/node/NetworkEdit.js index 072bee6..eef892b 100644 --- a/www/manager/node/NetworkEdit.js +++ b/www/manager/node/NetworkEdit.js @@ -233,6 +233,45 @@ Ext.define('PVE.node.NetworkEdit', { fieldLabel: gettext('Gateway'), vtype: 'IPAddress', name: 'gateway' + }, + { + xtype: 'pvetextfield', + deleteEmpty: !me.create, + fieldLabel: gettext('IPv6 address'), + vtype: 'IP6Address', + name: 'address6' + }, + { + xtype: 'pvetextfield', + deleteEmpty: !me.create, + fieldLabel: gettext('Subnet length'), + vtype: 'IP6Subnet', + name: 'netmask6', + validator: function(value) { + /*jslint confusion: true */ + if (!me.items) { + return true; + } + var address = me.down('field[name=address6]').getValue(); + if (value !== '') { + if (address === '') { + return IPv6 subnet length requires option 'IPv6 address'; + } + } else { + if (address !== '') { + return Option 'IPv6 address' requires an IPv6 subnet length; + } + } + + return true; + } + }, + { + xtype: 'pvetextfield', + deleteEmpty: !me.create, + fieldLabel: gettext('Gateway'), + vtype: 'IP6Address', + name: 'gateway6' } ]); } diff --git a/www/manager/node/NetworkView.js b/www/manager/node/NetworkView.js index 4b1db77..177df85 100644 --- a/www/manager/node/NetworkView.js +++ b/www/manager/node/NetworkView.js @@ -277,6 +277,21 @@ Ext.define('PVE.node.NetworkView', { header: gettext('Gateway'), sortable: true, dataIndex: 'gateway' + }, + { + header: gettext('IPv6 address'), + sortable: true, + dataIndex: 'address6' + }, + { + header: gettext('IPv6 subnet length'), + sortable: true, + dataIndex: 'netmask6' + }, + { + header: gettext('IPv6 Gateway'), + sortable: true, + dataIndex: 'gateway6' } ], listeners: { @@ -312,8 +327,9 @@ Ext.define('PVE.node.NetworkView', { extend: 'Ext.data.Model', fields: [ 'iface', 'type', 'active', 'autostart', - 'bridge_ports', 'slaves', 'address', - 'netmask', 'gateway' + 'bridge_ports', 'slaves', + 'address', 'netmask', 'gateway', + 'address6', 'netmask6', 'gateway6', ], idProperty: 'iface' }); -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com
[pve-devel] [RFC PATCH 0/3] [manager] network interfaces internal API change
This is the pve-manager part of a set of patches for [ ] pve-common [*] pve-manager These patches upgrade code dealing with /etc/network/interfaces to the new interface, and add API support for ipv6 addresses. I'm currently using perl's Net::IP::ip_iptypev6 to extract the IP's type in order to validate whether it's a valid IP to assign to an interface. I'm not sure whether this covers all usecases correctly, or whether we want to do this at all? At least it prevents the use of multicast and reserved addresses. It permits the use of global/local/unique unicast addresses and addresses which are not part of any known reserved range. Special ranges are usually handled by external tools anyway (eg. with miredo/teredo addresses are assigned by daemons and not written to configuration files. However I'm not sure about whether this is also true for other tunneling services.) Regardless, special cases can still be configured as a custom configuration in a separate file included via source. Patch 3 adds ipv6 configuration to the GUI. This is a temporary solution! For containers ipv4 and ipv6 addresses are shown below each other in the same column. We probably want the same behavior here? For now I just wanted to get it working and all the rest of the patchset reviewed and commented on before hacking through the UI code. (and adding new columns was as easy as copypasting existing code) (Ideally only the final UI change makes into the repo to not unnecessarily increase Emmanuel's workload with piles of patches ;-) ) Wolfgang Bumiller (3): PVE::API2::Ceph: network_interfaces update + ipv6 PVE::API2::Network: network_interfaces update + ipv6 www/network: ipv6 related columns and edit fields PVE/API2/Ceph.pm| 14 ++-- PVE/API2/Network.pm | 142 www/manager/Toolkit.js | 6 ++ www/manager/Utils.js| 1 + www/manager/node/NetworkEdit.js | 39 +++ www/manager/node/NetworkView.js | 20 +- 6 files changed, 188 insertions(+), 34 deletions(-) -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 6/7] write_etc_network_interfaces: write options only once
Options such as bridge ports or ovs_* will now be written out only for the first interface. If multiple protocol families of a bridge contain bridge_ports lines they will be merged into the first interface. --- src/PVE/INotify.pm | 51 --- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index bc6c345..3d91aad 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -990,7 +990,7 @@ sub read_etc_network_interfaces { } sub __interface_to_string { -my ($iface, $d, $family) = @_; +my ($iface, $d, $family, $once) = @_; return '' if !($d $d-{method}); @@ -1004,53 +1004,49 @@ sub __interface_to_string { $raw .= \tgateway . $d-{gateway$suffix} . \n if $d-{gateway$suffix}; $raw .= \tbroadcast . $d-{broadcast$suffix} . \n if $d-{broadcast$suffix}; -my $done = { type = 1, priority = 1, method = 1, active = 1, exists = 1, -comments = 1, autostart = 1, options = 1, -address = 1, netmask = 1, gateway = 1, broadcast = 1, -method6= 1, families = 1, -address6 = 1, netmask6 = 1, gateway6 = 1, broadcast6 = 1 }; - -if ($d-{type} eq 'bridge') { +if (scalar(keys %$once)) { + # type-specific options are all only printed once +} elsif ($d-{type} eq 'bridge') { my @ports = split(/\n/, $d-{bridge_ports} || 'none'); $raw .= \tbridge_ports $_\n foreach @ports; - $done-{bridge_ports} = 1; + $once-{bridge_ports} = 1; my $v = defined($d-{bridge_stp}) ? $d-{bridge_stp} : 'off'; $raw .= \tbridge_stp $v\n; - $done-{bridge_stp} = 1; + $once-{bridge_stp} = 1; $v = defined($d-{bridge_fd}) ? $d-{bridge_fd} : 0; $raw .= \tbridge_fd $v\n; - $done-{bridge_fd} = 1; + $once-{bridge_fd} = 1; } elsif ($d-{type} eq 'bond') { my $slaves = $d-{slaves} || 'none'; $raw .= \tslaves $slaves\n; - $done-{slaves} = 1; + $once-{slaves} = 1; my $v = defined ($d-{'bond_miimon'}) ? $d-{'bond_miimon'} : 100; $raw .= \tbond_miimon $v\n; - $done-{'bond_miimon'} = 1; + $once-{'bond_miimon'} = 1; $v = defined ($d-{'bond_mode'}) ? $d-{'bond_mode'} : 'balance-rr'; $raw .= \tbond_mode $v\n; - $done-{'bond_mode'} = 1; + $once-{'bond_mode'} = 1; if ($d-{'bond_mode'} $d-{'bond_xmit_hash_policy'} ($d-{'bond_mode'} eq 'balance-xor' || $d-{'bond_mode'} eq '802.3ad')) { $raw .= \tbond_xmit_hash_policy $d-{'bond_xmit_hash_policy'}\n; } - $done-{'bond_xmit_hash_policy'} = 1; + $once-{'bond_xmit_hash_policy'} = 1; } elsif ($d-{type} eq 'OVSBridge') { $raw .= \tovs_type $d-{type}\n; - $done-{ovs_type} = 1; + $once-{ovs_type} = 1; $raw .= \tovs_ports $d-{ovs_ports}\n if $d-{ovs_ports}; - $done-{ovs_ports} = 1; + $once-{ovs_ports} = 1; } elsif ($d-{type} eq 'OVSPort' || $d-{type} eq 'OVSIntPort' || $d-{type} eq 'OVSBond') { @@ -1060,7 +1056,7 @@ sub __interface_to_string { if (defined($d-{ovs_tag})) { $set_ovs_option($d, tag = $d-{ovs_tag}); } - $done-{ovs_tag} = 1; + $once-{ovs_tag} = 1; if ($d-{type} eq 'OVSBond') { @@ -1079,10 +1075,10 @@ sub __interface_to_string { $set_ovs_option($d, lacp = undef); $set_ovs_option($d, bond_mode = $d-{bond_mode}); } - $done-{bond_mode} = 1; + $once-{bond_mode} = 1; $raw .= \tovs_bonds $d-{ovs_bonds}\n if $d-{ovs_bonds}; - $done-{ovs_bonds} = 1; + $once-{ovs_bonds} = 1; } if ($d-{ovs_bridge}) { @@ -1090,20 +1086,28 @@ sub __interface_to_string { } $raw .= \tovs_type $d-{type}\n; - $done-{ovs_type} = 1; + $once-{ovs_type} = 1; if ($d-{ovs_bridge}) { $raw .= \tovs_bridge $d-{ovs_bridge}\n; - $done-{ovs_bridge} = 1; + $once-{ovs_bridge} = 1; } # fixme: use Data::Dumper; print Dumper($d); } +my $done = { type = 1, priority = 1, method = 1, active = 1, exists = 1, +comments = 1, autostart = 1, options = 1, +address = 1, netmask = 1, gateway = 1, broadcast = 1, +method6= 1, families = 1, +address6 = 1, netmask6 = 1, gateway6 = 1, broadcast6 = 1, +%$once }; + # print other settings foreach my $k (keys %$d) { next if $done-{$k}; next if !$d-{$k}; $raw .= \t$k $d-{$k}\n; + $once-{$k} = 1; } foreach my $option (@{$d-{options$suffix}}) { @@ -1261,7 +1265,8 @@ sub write_etc_network_interfaces { $printed-{$iface} = 1; $raw .= auto $iface\n if $d-{autostart}; - $raw .= __interface_to_string($iface,
[pve-devel] [RFC PATCH 2/3] PVE::API2::Network: network_interfaces update + ipv6
--- PVE/API2/Network.pm | 142 ++-- 1 file changed, 116 insertions(+), 26 deletions(-) diff --git a/PVE/API2/Network.pm b/PVE/API2/Network.pm index dedf9e6..3ab31d3 100644 --- a/PVE/API2/Network.pm +++ b/PVE/API2/Network.pm @@ -45,6 +45,11 @@ my $confdesc = { type = 'string', optional = 1, }, +comments6 = { + description = Comments, + type = 'string', + optional = 1, +}, autostart = { description = Automatically start interface on boot., type = 'boolean', @@ -115,6 +120,23 @@ my $confdesc = { type = 'string', format = 'ipv4', optional = 1, requires = 'netmask', +}, +gateway6 = { + description = 'Default ipv6 gateway address.', + type = 'string', format = 'ipv6', + optional = 1, +}, +netmask6 = { + description = 'Network mask.', + type = 'integer', format = 'ipv6subnet', + optional = 1, + requires = 'address6', +}, +address6 = { + description = 'IP address.', + type = 'string', format = 'ipv6', + optional = 1, + requires = 'netmask6', } }; @@ -166,19 +188,21 @@ __PACKAGE__-register_method({ $rpcenv-set_result_attrib('changes', $changes) if $changes; - delete $config-{lo}; # do not list the loopback device + my $ifaces = $config-{ifaces}; + + delete $ifaces-{lo}; # do not list the loopback device if ($param-{type}) { - foreach my $k (keys %$config) { - my $type = $config-{$k}-{type}; + foreach my $k (keys %$ifaces) { + my $type = $ifaces-{$k}-{type}; my $match = ($param-{type} eq $type) || ( ($param-{type} eq 'any_bridge') ($type eq 'bridge' || $type eq 'OVSBridge')); - delete $config-{$k} if !$match; + delete $ifaces-{$k} if !$match; } } - return PVE::RESTHandler::hash_to_array($config, 'iface'); + return PVE::RESTHandler::hash_to_array($ifaces, 'iface'); }}); __PACKAGE__-register_method({ @@ -206,15 +230,25 @@ __PACKAGE__-register_method({ return undef; }}); -my $check_duplicate_gateway = sub { -my ($config, $newiface) = @_; +my $check_duplicate = sub { +my ($config, $newiface, $key, $name) = @_; foreach my $iface (keys %$config) { - raise_param_exc({ gateway = Default gateway already exists on interface '$iface'. }) - if ($newiface ne $iface) $config-{$iface}-{gateway}; + raise_param_exc({ $key = $name already exists on interface '$iface'. }) + if ($newiface ne $iface) $config-{$iface}-{$key}; } }; +my $check_duplicate_gateway = sub { +my ($config, $newiface) = @_; +return $check_duplicate($config, $newiface, 'gateway', 'Default gateway'); +}; + +my $check_duplicate_gateway6 = sub { +my ($config, $newiface) = @_; +return $check_duplicate($config, $newiface, 'gateway6', 'Default ipv6 gateway'); +}; + my $check_ipv4_settings = sub { my ($address, $netmask) = @_; @@ -227,6 +261,29 @@ my $check_ipv4_settings = sub { if ($binhost eq $binmask) || ($binhost eq $broadcast); }; +sub ipv6_tobin { +return Net::IP::ip_iptobin(Net::IP::ip_expand_address(shift, 6), 6); +} + +my $check_ipv6_settings = sub { +my ($address, $netmask) = @_; + +raise_param_exc({ netmask = $netmask is not a valid subnet length for ipv6 }) + if $netmask 0 || $netmask 128; + +raise_param_exc({ address = $address is not a valid host ip address. }) + if !Net::IP::ip_is_ipv6($address); + +my $binip = ipv6_tobin($address); +my $binmask = Net::IP::ip_get_mask($netmask, 6); + +my $type = Net::IP::ip_iptypev6($binip); + +raise_param_exc({ address = $address is not a valid host ip address. }) + if ($binip eq $binmask) || + (defined($type) $type !~ /^(?:(?:GLOBAL|(?:UNIQUE|LINK)-LOCAL)-UNICAST)$/); +}; + __PACKAGE__-register_method({ name = 'create_network', path = '', @@ -252,17 +309,30 @@ __PACKAGE__-register_method({ my $code = sub { my $config = PVE::INotify::read_file('interfaces'); + my $ifaces = $config-{ifaces}; raise_param_exc({ iface = interface already exists }) - if $config-{$iface}; + if $ifaces-{$iface}; - $check_duplicate_gateway($config, $iface) + $check_duplicate_gateway($ifaces, $iface) if $param-{gateway}; + $check_duplicate_gateway6($ifaces, $iface) + if $param-{gateway6}; $check_ipv4_settings($param-{address}, $param-{netmask}) if $param-{address}; + $check_ipv6_settings($param-{address6}, int($param-{netmask6})) + if $param-{address6}; + + my $families = $param-{families} = []; + push
[pve-devel] [RFC PATCH 6/7 resend] write_etc_network_interfaces: write options only once
Options such as bridge ports or ovs_* will now be written out only for the first interface. If multiple protocol families of a bridge contain bridge_ports lines they will be merged into the first interface. (Resent patch 6/7 due to for/foreach style mixup) --- src/PVE/INotify.pm | 51 --- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index bc6c345..3d91aad 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -990,7 +990,7 @@ sub read_etc_network_interfaces { } sub __interface_to_string { -my ($iface, $d, $family) = @_; +my ($iface, $d, $family, $once) = @_; return '' if !($d $d-{method}); @@ -1004,53 +1004,49 @@ sub __interface_to_string { $raw .= \tgateway . $d-{gateway$suffix} . \n if $d-{gateway$suffix}; $raw .= \tbroadcast . $d-{broadcast$suffix} . \n if $d-{broadcast$suffix}; -my $done = { type = 1, priority = 1, method = 1, active = 1, exists = 1, -comments = 1, autostart = 1, options = 1, -address = 1, netmask = 1, gateway = 1, broadcast = 1, -method6= 1, families = 1, -address6 = 1, netmask6 = 1, gateway6 = 1, broadcast6 = 1 }; - -if ($d-{type} eq 'bridge') { +if (scalar(keys %$once)) { + # type-specific options are all only printed once +} elsif ($d-{type} eq 'bridge') { my @ports = split(/\n/, $d-{bridge_ports} || 'none'); $raw .= \tbridge_ports $_\n foreach @ports; - $done-{bridge_ports} = 1; + $once-{bridge_ports} = 1; my $v = defined($d-{bridge_stp}) ? $d-{bridge_stp} : 'off'; $raw .= \tbridge_stp $v\n; - $done-{bridge_stp} = 1; + $once-{bridge_stp} = 1; $v = defined($d-{bridge_fd}) ? $d-{bridge_fd} : 0; $raw .= \tbridge_fd $v\n; - $done-{bridge_fd} = 1; + $once-{bridge_fd} = 1; } elsif ($d-{type} eq 'bond') { my $slaves = $d-{slaves} || 'none'; $raw .= \tslaves $slaves\n; - $done-{slaves} = 1; + $once-{slaves} = 1; my $v = defined ($d-{'bond_miimon'}) ? $d-{'bond_miimon'} : 100; $raw .= \tbond_miimon $v\n; - $done-{'bond_miimon'} = 1; + $once-{'bond_miimon'} = 1; $v = defined ($d-{'bond_mode'}) ? $d-{'bond_mode'} : 'balance-rr'; $raw .= \tbond_mode $v\n; - $done-{'bond_mode'} = 1; + $once-{'bond_mode'} = 1; if ($d-{'bond_mode'} $d-{'bond_xmit_hash_policy'} ($d-{'bond_mode'} eq 'balance-xor' || $d-{'bond_mode'} eq '802.3ad')) { $raw .= \tbond_xmit_hash_policy $d-{'bond_xmit_hash_policy'}\n; } - $done-{'bond_xmit_hash_policy'} = 1; + $once-{'bond_xmit_hash_policy'} = 1; } elsif ($d-{type} eq 'OVSBridge') { $raw .= \tovs_type $d-{type}\n; - $done-{ovs_type} = 1; + $once-{ovs_type} = 1; $raw .= \tovs_ports $d-{ovs_ports}\n if $d-{ovs_ports}; - $done-{ovs_ports} = 1; + $once-{ovs_ports} = 1; } elsif ($d-{type} eq 'OVSPort' || $d-{type} eq 'OVSIntPort' || $d-{type} eq 'OVSBond') { @@ -1060,7 +1056,7 @@ sub __interface_to_string { if (defined($d-{ovs_tag})) { $set_ovs_option($d, tag = $d-{ovs_tag}); } - $done-{ovs_tag} = 1; + $once-{ovs_tag} = 1; if ($d-{type} eq 'OVSBond') { @@ -1079,10 +1075,10 @@ sub __interface_to_string { $set_ovs_option($d, lacp = undef); $set_ovs_option($d, bond_mode = $d-{bond_mode}); } - $done-{bond_mode} = 1; + $once-{bond_mode} = 1; $raw .= \tovs_bonds $d-{ovs_bonds}\n if $d-{ovs_bonds}; - $done-{ovs_bonds} = 1; + $once-{ovs_bonds} = 1; } if ($d-{ovs_bridge}) { @@ -1090,20 +1086,28 @@ sub __interface_to_string { } $raw .= \tovs_type $d-{type}\n; - $done-{ovs_type} = 1; + $once-{ovs_type} = 1; if ($d-{ovs_bridge}) { $raw .= \tovs_bridge $d-{ovs_bridge}\n; - $done-{ovs_bridge} = 1; + $once-{ovs_bridge} = 1; } # fixme: use Data::Dumper; print Dumper($d); } +my $done = { type = 1, priority = 1, method = 1, active = 1, exists = 1, +comments = 1, autostart = 1, options = 1, +address = 1, netmask = 1, gateway = 1, broadcast = 1, +method6= 1, families = 1, +address6 = 1, netmask6 = 1, gateway6 = 1, broadcast6 = 1, +%$once }; + # print other settings foreach my $k (keys %$d) { next if $done-{$k}; next if !$d-{$k}; $raw .= \t$k $d-{$k}\n; + $once-{$k} = 1; } foreach my $option (@{$d-{options$suffix}}) { @@ -1261,7 +1265,8 @@ sub write_etc_network_interfaces { $printed-{$iface} = 1; $raw .= auto $iface\n if
[pve-devel] [RFC PATCH 1/7] JSONSchema: ipv6subnet and ipsubnet
ipv6subnet matches an ipv6 subnet length (0..128) ipsubnet matches an ipv4mask or an ipv6subnet --- src/PVE/JSONSchema.pm | 22 ++ 1 file changed, 22 insertions(+) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 36a2de9..12a209e 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -220,6 +220,28 @@ sub pve_verify_ipv4mask { return $mask; } +register_format('ipv6subnet', \pve_verify_ipv6subnet); +sub pve_verify_ipv6subnet { +my ($subnet, $noerr) = @_; +($subnet) = grep(/^\d+$/, $subnet); +return $subnet if defined($subnet) $subnet = 128; +return undef if $noerr; +die value is not a valid ipv6 subnet range\n; +} + +register_format('ipsubnet', \pve_verify_ipsubnet); +sub pve_verify_ipsubnet { +my ($subnet, $noerr) = @_; + +if (!(pve_verify_ipv6subnet($subnet, 1) || + pve_verify_ipv4mask($subnet, 1))) +{ + return undef if $noerr; + die value does not look like a valid subnet mask\n; +} +return $subnet; +} + register_format('CIDR', \pve_verify_cidr); sub pve_verify_cidr { my ($cidr, $noerr) = @_; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 2/7] read_etc_network_interfaces: less strict parsing
*) Don't require indented lines, instead know when to end a section. *) Don't require empty lines between sections. And turned (.*)\s* into just (.*) as .* eats the whitespace too. --- src/PVE/INotify.pm | 22 -- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index fbedc50..d97b5e3 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -766,30 +766,38 @@ sub read_etc_network_interfaces { my $gateway = 0; -while (defined ($line = $fh)) { +SECTION: while (defined ($line = $fh)) { chomp ($line); - next if $line =~ m/^#/; + next if $line =~ m/^\s*#/; - if ($line =~ m/^auto\s+(.*)$/) { + if ($line =~ m/^\s*auto\s+(.*)$/) { my @aa = split (/\s+/, $1); foreach my $a (@aa) { $ifaces-{$a}-{autostart} = 1; } - } elsif ($line =~ m/^iface\s+(\S+)\s+inet\s+(\S+)\s*$/) { + } elsif ($line =~ m/^\s*iface\s+(\S+)\s+inet\s+(\S+)\s*$/) { my $i = $1; $ifaces-{$i}-{method} = $2; $ifaces-{$i}-{priority} = $priority++; my $d = $ifaces-{$i}; while (defined ($line = $fh)) { - if ($line =~ m/^\s*#(.*)\s*$/) { + chomp $line; + if ($line =~ m/^\s*#(.*)$/) { # NOTE: we use 'comments' instead of 'comment' to # avoid automatic utf8 conversion $d-{comments} = '' if !$d-{comments}; $d-{comments} .= $1\n; - } elsif ($line =~ m/^\s+((\S+)\s+(.+))$/) { + } elsif ($line =~ m/^\s*(?:iface\s + |mapping\s + |auto- + |source\s + |source-directory\s +)/x) { + last; + } elsif ($line =~ m/^\s*((\S+)\s+(.+))$/) { my $option = $1; my ($id, $value) = ($2, $3); if (($id eq 'address') || ($id eq 'netmask') || ($id eq 'broadcast')) { @@ -837,6 +845,8 @@ sub read_etc_network_interfaces { last; } } + last SECTION if !defined($line); + redo SECTION; } } -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
Not so many components are working yet, but there are enough stuff which at least display so I can share a screenshot: http://i.imgur.com/y8uMXkx.png Things to notice: * fonts are a bit bigger, 13px instead of 12px. I am testing on At first glance I'd say it seems cleaner and easier to parse for the eyes. Fewer edges and element-details = less distracting and let you focus more easiliy on the text and key bits of information. (As long as the elements are still distinguishable from one another, which they are.) The Datacenter heading's white background box seems a bit out of place though ;-P. As for the remove-button issue you mentioned a while ago, I had an idea which is probably a bit of a PITA to implement, but just to get it out in the open: what about moving the item related action buttons into the list's rows so that there's a remove/edit-button per element? (The row height would probably need to be increased by a few pixels, though, so the buttons don't stick together too much.) * I hope you like blue (Default Theme of ExtJS5 is, well, blue) Can we have rainbows? On Mon, Jun 22, 2015 at 03:49:10PM +0200, Emmanuel Kasper wrote: Hi You might have noticed some patches moving around the list related to ExtJS5. Not so many components are working yet, but there are enough stuff which at least display so I can share a screenshot: http://i.imgur.com/y8uMXkx.png Things to notice: * fonts are a bit bigger, 13px instead of 12px. I am testing on 1280x1024 and everything has enough room * I hope you like blue (Default Theme of ExtJS5 is, well, blue) Emmanuel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Preview of the GUI with ExtJS5
Hi Emmanuel, * fonts are a bit bigger, 13px instead of 12px. I am testing on 1280x1024 and everything has enough room I have notice that in the treeview on the left, if I have long vm name, I have an horizontal scrollbar on the bottom. also in the treeview, the node name font is ok, but the vm name font are more bigger (too much). I can display twice more elements in the tree with extjs4 vs extjs5 http://odisoweb1.odiso.net/extjs4.png http://odisoweb1.odiso.net/extjs5.png - Mail original - De: Emmanuel Kasper e.kas...@proxmox.com À: pve-devel pve-devel@pve.proxmox.com Envoyé: Lundi 22 Juin 2015 15:49:10 Objet: [pve-devel] Preview of the GUI with ExtJS5 Hi You might have noticed some patches moving around the list related to ExtJS5. Not so many components are working yet, but there are enough stuff which at least display so I can share a screenshot: http://i.imgur.com/y8uMXkx.png Things to notice: * fonts are a bit bigger, 13px instead of 12px. I am testing on 1280x1024 and everything has enough room * I hope you like blue (Default Theme of ExtJS5 is, well, blue) Emmanuel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] Preview of the GUI with ExtJS5
Hi You might have noticed some patches moving around the list related to ExtJS5. Not so many components are working yet, but there are enough stuff which at least display so I can share a screenshot: http://i.imgur.com/y8uMXkx.png Things to notice: * fonts are a bit bigger, 13px instead of 12px. I am testing on 1280x1024 and everything has enough room * I hope you like blue (Default Theme of ExtJS5 is, well, blue) Emmanuel ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 4/7] read_etc_network_interfaces: improved parsing
* parsing ipv6 blocks * parsing extra lines like source/source-directory/... The returned config hash is not just the interface hash anymore. Interfaces are now in its 'ifaces' member hash. All unknown options (including mappings) end up in its 'options' hash. Added a comment describing the config hash's layout in detail. An interface can now have an ipv4 and an ipv6 entry, they will be returned as a single interface with address/netmask/gateway and address6/netmask6/gateway6 elements. Additionally a 'families' array is available listing which families are available. Ideally we'll at some point allow unhandled families to be kept too, however, now that extra lines like 'source' and 'source-directory' are preserved, it is recommended to move all custom configuration into separate files to not interfere with our interface parsing. --- src/PVE/INotify.pm | 110 + 1 file changed, 85 insertions(+), 25 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 97a379d..c825a11 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -745,10 +745,49 @@ my $extract_ovs_option = sub { return $v; }; +# config = { +# ifaces = { +# $ifname = { +# optional exists = BOOL, +# optional active = BOOL, +# optional autostart = BOOL, +# auto priority = INT, +# +# type = eth | bridge | bond | loopback | OVS* | ... , +# +# families = [inet, inet6, ...], +# +# method = manual | static | dhcp | ... , +# address = IP, +# netmask = SUBNET, +# broadcast = IP, +# gateway = IP, +# comments = [ ... ], +# +# method6 = manual | static | dhcp | ... , +# address6 = IP, +# netmask6 = SUBNET, +# gateway6 = IP, +# comments6 = [ ... ], +# +# known options, # like bridge_ports, ovs_* +# +# # extra/unknown options stored by-family: +# options4 = { inet options... } +# options6 = { inet6 options... } +# } +# }, +# options = [ +# # mappings end up here as well, as we don't need to understand them +# [priority,line] +# ] +# } sub read_etc_network_interfaces { my ($filename, $fh) = @_; -my $ifaces = {}; +my $config = {}; +my $ifaces = $config-{ifaces} = {}; +my $options = $config-{options} = []; my $line; @@ -775,19 +814,23 @@ sub read_etc_network_interfaces { $ifaces-{$a}-{autostart} = 1; } - } elsif ($line =~ m/^\s*iface\s+(\S+)\s+inet\s+(\S+)\s*$/) { + } elsif ($line =~ m/^\s*iface\s+(\S+)\s+(inet6?)\s+(\S+)\s*$/) { my $i = $1; - $ifaces-{$i}-{method} = $2; - $ifaces-{$i}-{priority} = $priority++; + my $family = $2; + my $f = { method = $3 }; # by family, merged to $d with a $suffix + (my $suffix = $family) =~ s/^inet//; my $d = $ifaces-{$i}; + $d-{priority} = $priority++ if !$d-{priority}; + push @{$d-{families}}, $family; + while (defined ($line = $fh)) { chomp $line; if ($line =~ m/^\s*#(.*)$/) { # NOTE: we use 'comments' instead of 'comment' to # avoid automatic utf8 conversion - $d-{comments} = '' if !$d-{comments}; - $d-{comments} .= $1\n; + $f-{comments} = '' if !$f-{comments}; + $f-{comments} .= $1\n; } elsif ($line =~ m/^\s*(?:iface\s |mapping\s |auto- @@ -799,7 +842,7 @@ sub read_etc_network_interfaces { my $option = $1; my ($id, $value) = ($2, $3); if (($id eq 'address') || ($id eq 'netmask') || ($id eq 'broadcast') || ($id eq 'gateway')) { - $d-{$id} = $value; + $f-{$id} = $value; } elsif ($id eq 'ovs_type' || $id eq 'ovs_options'|| $id eq 'ovs_bridge' || $id eq 'ovs_bonds' || $id eq 'ovs_ports') { $d-{$id} = $value; @@ -834,14 +877,17 @@ sub read_etc_network_interfaces { } $d-{$id} = $value; } else { - push @{$d-{options}}, $option; + push @{$f-{options}}, $option; } } else { last; } } + $d-{$_$suffix} = $f-{$_} foreach (keys %$f); last SECTION if !defined($line); redo SECTION; + } elsif ($line =~ /\w/) { + push @$options, [$priority++, $line]; } } @@ -924,6 +970,7 @@ sub read_etc_network_interfaces { } $d-{method} = 'manual' if !$d-{method}; + $d-{method6} = 'manual' if !$d-{method6}; } if (my $fd2 =
[pve-devel] [RFC PATCH 0/7] [common] network interfaces internal API change
This is the pve-common part of a set of patches for [*] pve-common [ ] pve-manager This changes the way the /etc/network/interfaces is represented internally. The new internal representation is described in patch number 4 as both part of the commit message as well as a comment inside the code. Patch 1 adds some more schema variables used by the other patches. Patch 2 makes the interface parser less strict in order to not get confused by missing indentation or missing empty lines between interface blocks. Patch 3 removes a variable which was never used, only written to, please make sure it was just dead left-over code or if there was a future purpose for it. Patch 4 includes a major addition to the parser, please read. It includes a description of the new representation and adds support to preserve source/source-directory/... lines which were previously just silently dropped from the file on changes. Patch 5 just deals with the fact that bridge_ports can be used several times. This approach doesn't touch the contents and should thus be general enough for all purposes including regex lists (untested). Patch 6 was the easiest way to deal with duplicate known options: I simply remember written variables in a $once hash outside of __internface_to_string passed as parameter in order to make sure they're only written once. The $done hash was moved below the ovs/bridge handling code and simply receives an expanded %$once hash. Patch 7 documents improves the file-header for /etc/network/interfaces to tell the admins that it is recommended to keep custom configurations in separate files included via source or source-directory directives. Wolfgang Bumiller (7): JSONSchema: ipv6subnet and ipsubnet read_etc_network_interfaces: less strict parsing removed write-only $gateway variable read_etc_network_interfaces: improved parsing merge bridge_port declarations write_etc_network_interfaces: write options only once write_etc_network_interfaces: updated header comment src/PVE/INotify.pm| 202 +++--- src/PVE/JSONSchema.pm | 22 ++ 2 files changed, 166 insertions(+), 58 deletions(-) -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 5/7] merge bridge_port declarations
--- src/PVE/INotify.pm | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index c825a11..bc6c345 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -853,7 +853,11 @@ sub read_etc_network_interfaces { $devs-{$p} = 1; } my $str = join (' ', sort keys %{$devs}); - $d-{$id} = $str || ''; + if ($d-{$id}) { + $d-{$id} .= \n . $str if $str; + } else { + $d-{$id} = $str || ''; + } } elsif ($id eq 'bridge_stp') { if ($value =~ m/^\s*(on|yes)\s*$/i) { $d-{$id} = 'on'; @@ -1008,8 +1012,8 @@ sub __interface_to_string { if ($d-{type} eq 'bridge') { - my $ports = $d-{bridge_ports} || 'none'; - $raw .= \tbridge_ports $ports\n; + my @ports = split(/\n/, $d-{bridge_ports} || 'none'); + $raw .= \tbridge_ports $_\n foreach @ports; $done-{bridge_ports} = 1; my $v = defined($d-{bridge_stp}) ? $d-{bridge_stp} : 'off'; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 3/7] removed write-only $gateway variable
--- src/PVE/INotify.pm | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index d97b5e3..97a379d 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -764,8 +764,6 @@ sub read_etc_network_interfaces { # we try to keep order inside the file my $priority = 2; # 1 is reserved for lo -my $gateway = 0; - SECTION: while (defined ($line = $fh)) { chomp ($line); next if $line =~ m/^\s*#/; @@ -800,11 +798,8 @@ sub read_etc_network_interfaces { } elsif ($line =~ m/^\s*((\S+)\s+(.+))$/) { my $option = $1; my ($id, $value) = ($2, $3); - if (($id eq 'address') || ($id eq 'netmask') || ($id eq 'broadcast')) { - $d-{$id} = $value; - } elsif ($id eq 'gateway') { + if (($id eq 'address') || ($id eq 'netmask') || ($id eq 'broadcast') || ($id eq 'gateway')) { $d-{$id} = $value; - $gateway = 1; } elsif ($id eq 'ovs_type' || $id eq 'ovs_options'|| $id eq 'ovs_bridge' || $id eq 'ovs_bonds' || $id eq 'ovs_ports') { $d-{$id} = $value; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [RFC PATCH 7/7] write_etc_network_interfaces: updated header comment
The header now mentions that the file is auto-generated and should not be tempered with directly. It now recommends to add custom network configurations via source/source-directory lines. --- src/PVE/INotify.pm | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index 3d91aad..8895b28 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -1201,7 +1201,19 @@ sub write_etc_network_interfaces { } } -my $raw = # network interface settings\n; +my $raw = 'NETWORKDOC'; +# network interface settings; autogenerated +# Please do NOT modify this file directly, unless you know what +# you're doing. +# +# If you want to manage part of the network configuration manually, +# please utilize the 'source' or 'source-directory' directives to do +# so. +# PVE will preserve these directives, but will NOT its network +# configuration from sourced files, so do not attempt to move any of +# the PVE managed interfaces into external files! + +NETWORKDOC my $printed = {}; -- 2.1.4 ___ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel