[pve-devel] [PATCH pve-network 1/3] add simple plugin
allow to create standalone or simple routed vnets Signed-off-by: Alexandre Derumier --- PVE/API2/Network/SDN/Zones.pm | 1 + PVE/Network/SDN/Zones.pm | 2 + PVE/Network/SDN/Zones/Makefile| 2 +- PVE/Network/SDN/Zones/SimplePlugin.pm | 70 +++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 PVE/Network/SDN/Zones/SimplePlugin.pm diff --git a/PVE/API2/Network/SDN/Zones.pm b/PVE/API2/Network/SDN/Zones.pm index 10ca616..3e371df 100644 --- a/PVE/API2/Network/SDN/Zones.pm +++ b/PVE/API2/Network/SDN/Zones.pm @@ -15,6 +15,7 @@ use PVE::Network::SDN::Zones::QinQPlugin; use PVE::Network::SDN::Zones::VxlanPlugin; use PVE::Network::SDN::Zones::EvpnPlugin; use PVE::Network::SDN::Zones::FaucetPlugin; +use PVE::Network::SDN::Zones::SimplePlugin; use Storable qw(dclone); use PVE::JSONSchema qw(get_standard_option); diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm index 3e03f11..b6c5c34 100644 --- a/PVE/Network/SDN/Zones.pm +++ b/PVE/Network/SDN/Zones.pm @@ -16,6 +16,7 @@ use PVE::Network::SDN::Zones::QinQPlugin; use PVE::Network::SDN::Zones::VxlanPlugin; use PVE::Network::SDN::Zones::EvpnPlugin; use PVE::Network::SDN::Zones::FaucetPlugin; +use PVE::Network::SDN::Zones::SimplePlugin; use PVE::Network::SDN::Zones::Plugin; PVE::Network::SDN::Zones::VlanPlugin->register(); @@ -23,6 +24,7 @@ PVE::Network::SDN::Zones::QinQPlugin->register(); PVE::Network::SDN::Zones::VxlanPlugin->register(); PVE::Network::SDN::Zones::EvpnPlugin->register(); PVE::Network::SDN::Zones::FaucetPlugin->register(); +PVE::Network::SDN::Zones::SimplePlugin->register(); PVE::Network::SDN::Zones::Plugin->init(); my $local_network_sdn_file = "/etc/network/interfaces.d/sdn"; diff --git a/PVE/Network/SDN/Zones/Makefile b/PVE/Network/SDN/Zones/Makefile index ba9a4b5..8454388 100644 --- a/PVE/Network/SDN/Zones/Makefile +++ b/PVE/Network/SDN/Zones/Makefile @@ -1,4 +1,4 @@ -SOURCES=Plugin.pm VlanPlugin.pm VxlanPlugin.pm FaucetPlugin.pm EvpnPlugin.pm QinQPlugin.pm +SOURCES=Plugin.pm VlanPlugin.pm VxlanPlugin.pm FaucetPlugin.pm EvpnPlugin.pm QinQPlugin.pm SimplePlugin.pm PERL5DIR=${DESTDIR}/usr/share/perl5 diff --git a/PVE/Network/SDN/Zones/SimplePlugin.pm b/PVE/Network/SDN/Zones/SimplePlugin.pm new file mode 100644 index 000..60fb7db --- /dev/null +++ b/PVE/Network/SDN/Zones/SimplePlugin.pm @@ -0,0 +1,70 @@ +package PVE::Network::SDN::Zones::SimplePlugin; + +use strict; +use warnings; +use PVE::Network::SDN::Zones::Plugin; + +use base('PVE::Network::SDN::Zones::Plugin'); + +sub type { +return 'simple'; +} + +sub options { + +return { +nodes => { optional => 1}, + mtu => { optional => 1 } +}; +} + +# Plugin implementation +sub generate_sdn_config { +my ($class, $plugin_config, $zoneid, $vnetid, $vnet, $controller, $interfaces_config, $config) = @_; + +my $ipv4 = $vnet->{ipv4}; +my $ipv6 = $vnet->{ipv6}; +my $mac = $vnet->{mac}; +my $alias = $vnet->{alias}; +my $mtu = $plugin_config->{mtu} if $plugin_config->{mtu}; + +#vnet bridge +my @iface_config = (); +push @iface_config, "address $ipv4" if $ipv4; +push @iface_config, "address $ipv6" if $ipv6; +push @iface_config, "hwaddress $mac" if $mac; +push @iface_config, "bridge_ports none"; +push @iface_config, "bridge_stp off"; +push @iface_config, "bridge_fd 0"; +if($vnet->{vlanaware}) { +push @iface_config, "bridge-vlan-aware yes"; +push @iface_config, "bridge-vids 2-4094"; +} +push @iface_config, "mtu $mtu" if $mtu; +push @iface_config, "alias $alias" if $alias; +push(@{$config->{$vnetid}}, @iface_config) if !$config->{$vnetid}; + +return $config; +} + +sub status { +my ($class, $plugin_config, $zone, $vnetid, $vnet, $status) = @_; + +my $err_msg = []; + +# ifaces to check +my $ifaces = [ $vnetid]; + +foreach my $iface (@{$ifaces}) { + if (!$status->{$iface}->{status}) { + push @$err_msg, "missing $iface"; +} elsif ($status->{$iface}->{status} ne 'pass') { + push @$err_msg, "error iface $iface"; + } +} +return $err_msg; +} + +1; + + -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager 2/3] sdn: move mtu from vnetview to zoneview
Signed-off-by: Alexandre Derumier --- www/manager6/sdn/VnetView.js | 7 +-- www/manager6/sdn/ZoneView.js | 5 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js index 8afb29cf..e73632d1 100644 --- a/www/manager6/sdn/VnetView.js +++ b/www/manager6/sdn/VnetView.js @@ -111,12 +111,7 @@ Ext.define('PVE.sdn.VnetView', { header: 'MAC', flex: 1, dataIndex: 'mac', - }, - { - header: 'MTU', - flex: 1, - dataIndex: 'mtu', - }, + } ], listeners: { activate: reload, diff --git a/www/manager6/sdn/ZoneView.js b/www/manager6/sdn/ZoneView.js index cea1d86f..7b664537 100644 --- a/www/manager6/sdn/ZoneView.js +++ b/www/manager6/sdn/ZoneView.js @@ -116,6 +116,11 @@ Ext.define('PVE.sdn.ZoneView', { dataIndex: 'type', renderer: PVE.Utils.format_sdnzone_type }, + { + header: 'MTU', + flex: 1, + dataIndex: 'mtu', + }, { header: gettext('Nodes'), flex: 3, -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-network 3/3] cleanup code with wrong copy/paste from Storage
Signed-off-by: Alexandre Derumier --- PVE/API2/Network/SDN/Zones.pm | 2 +- PVE/API2/Network/SDN/Zones/Content.pm | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/PVE/API2/Network/SDN/Zones.pm b/PVE/API2/Network/SDN/Zones.pm index 3e371df..f629f43 100644 --- a/PVE/API2/Network/SDN/Zones.pm +++ b/PVE/API2/Network/SDN/Zones.pm @@ -35,7 +35,7 @@ my $api_sdn_zones_config = sub { $scfg->{digest} = $cfg->{digest}; if ($scfg->{nodes}) { -$scfg->{nodes} = PVE::Storage::Plugin->encode_value($scfg->{type}, 'nodes', $scfg->{nodes}); +$scfg->{nodes} = PVE::Network::SDN::Zones::Plugin->encode_value($scfg->{type}, 'nodes', $scfg->{nodes}); } return $scfg; diff --git a/PVE/API2/Network/SDN/Zones/Content.pm b/PVE/API2/Network/SDN/Zones/Content.pm index fb76133..66f49df 100644 --- a/PVE/API2/Network/SDN/Zones/Content.pm +++ b/PVE/API2/Network/SDN/Zones/Content.pm @@ -6,7 +6,6 @@ use Data::Dumper; use PVE::SafeSyslog; use PVE::Cluster; -use PVE::Storage; use PVE::INotify; use PVE::Exception qw(raise_param_exc); use PVE::RPCEnvironment; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-docs] sdn: add simple zone plugin
Signed-off-by: Alexandre Derumier --- pvesdn.adoc | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pvesdn.adoc b/pvesdn.adoc index c1597b8..ed8652d 100644 --- a/pvesdn.adoc +++ b/pvesdn.adoc @@ -142,12 +142,22 @@ Common options nodes:: Deploy and allow to use a VNets configured for this Zone only on these nodes. +[[pvesdn_zone_plugin_simple]] +Simple Zones + + +This is the simplest plugin, it will create an isolated vnet bridge. +This bridge is not linked to physical interfaces, VM traffic is only +local to the node(s). +It can be used for NAT or routed setup. + + [[pvesdn_zone_plugin_vlan]] VLAN Zones ~~ -This is the simplest plugin, it will reuse an existing local Linux or OVS -bridge, and manage VLANs on it. +This plugin will reuse an existing local Linux or OVS bridge, +and manage VLANs on it. The benefit of using SDN module, is that you can create different zones with specific VNets VLAN tag, and restrict Virtual Machines to separated zones. -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-network 2/3] vnet: make tag optional and verify value in zone plugins
Signed-off-by: Alexandre Derumier --- PVE/API2/Network/SDN/Vnets.pm | 15 +++ PVE/Network/SDN/VnetPlugin.pm | 5 +++-- PVE/Network/SDN/Zones/EvpnPlugin.pm | 7 +++ PVE/Network/SDN/Zones/Plugin.pm | 5 + PVE/Network/SDN/Zones/QinQPlugin.pm | 8 PVE/Network/SDN/Zones/SimplePlugin.pm | 7 +++ PVE/Network/SDN/Zones/VlanPlugin.pm | 8 PVE/Network/SDN/Zones/VxlanPlugin.pm | 8 8 files changed, 61 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Network/SDN/Vnets.pm b/PVE/API2/Network/SDN/Vnets.pm index 8f70bab..5d66908 100644 --- a/PVE/API2/Network/SDN/Vnets.pm +++ b/PVE/API2/Network/SDN/Vnets.pm @@ -7,6 +7,8 @@ use PVE::SafeSyslog; use PVE::Tools qw(extract_param); use PVE::Cluster qw(cfs_read_file cfs_write_file); use PVE::Network::SDN; +use PVE::Network::SDN::Zones; +use PVE::Network::SDN::Zones::Plugin; use PVE::Network::SDN::Vnets; use PVE::Network::SDN::VnetPlugin; @@ -129,6 +131,13 @@ __PACKAGE__->register_method ({ } $cfg->{ids}->{$id} = $opts; + + my $zone_cfg = PVE::Network::SDN::Zones::config(); + my $zoneid = $cfg->{ids}->{$id}->{zone}; + my $plugin_config = $zone_cfg->{ids}->{$zoneid}; + my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type}); + $plugin->verify_tag($opts->{tag}); + PVE::Network::SDN::VnetPlugin->on_update_hook($id, $cfg); PVE::Network::SDN::Vnets::write_config($cfg); @@ -168,6 +177,12 @@ __PACKAGE__->register_method ({ my $opts = PVE::Network::SDN::VnetPlugin->check_config($id, $param, 0, 1); $cfg->{ids}->{$id} = $opts; + my $zone_cfg = PVE::Network::SDN::Zones::config(); + my $zoneid = $cfg->{ids}->{$id}->{zone}; +my $plugin_config = $zone_cfg->{ids}->{$zoneid}; +my $plugin = PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type}); + $plugin->verify_tag($opts->{tag}); + PVE::Network::SDN::VnetPlugin->on_update_hook($id, $cfg); PVE::Network::SDN::Vnets::write_config($cfg); diff --git a/PVE/Network/SDN/VnetPlugin.pm b/PVE/Network/SDN/VnetPlugin.pm index 2433013..384358c 100644 --- a/PVE/Network/SDN/VnetPlugin.pm +++ b/PVE/Network/SDN/VnetPlugin.pm @@ -6,6 +6,7 @@ use warnings; use PVE::Cluster qw(cfs_read_file cfs_write_file cfs_lock_file); use base qw(PVE::SectionConfig); use PVE::JSONSchema qw(get_standard_option); +use PVE::Exception qw(raise raise_param_exc); PVE::Cluster::cfs_register_file('sdn/vnets.cfg', sub { __PACKAGE__->parse_config(@_); }, @@ -88,7 +89,7 @@ sub properties { sub options { return { zone => { optional => 0}, -tag => { optional => 0}, +tag => { optional => 1}, alias => { optional => 1 }, ipv4 => { optional => 1 }, ipv6 => { optional => 1 }, @@ -112,7 +113,7 @@ sub on_update_hook { next if $id eq $vnetid; my $vnet = $vnet_cfg->{ids}->{$id}; if ($vnet->{type} eq 'vnet' && defined($vnet->{tag})) { - die "tag $tag already exist in vnet $id" if $tag eq $vnet->{tag}; + raise_param_exc({ tag => "tag $tag already exist in vnet $id"}) if $tag eq $vnet->{tag}; } } } diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm b/PVE/Network/SDN/Zones/EvpnPlugin.pm index b2f57ee..a916579 100644 --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm @@ -140,6 +140,13 @@ sub on_update_hook { } } +sub verify_tag { +my ($class, $tag) = @_; + +raise_param_exc({ tag => "missing vxlan tag"}) if !defined($tag); +raise_param_exc({ tag => "vxlan tag max value is 16777216"}) if $tag > 16777216; +} + 1; diff --git a/PVE/Network/SDN/Zones/Plugin.pm b/PVE/Network/SDN/Zones/Plugin.pm index 5e3fdfd..d96e069 100644 --- a/PVE/Network/SDN/Zones/Plugin.pm +++ b/PVE/Network/SDN/Zones/Plugin.pm @@ -139,6 +139,11 @@ sub on_update_hook { # do nothing by default } +sub verify_tag { +my ($class, $tag) = @_; +# do nothing by default +} + #helpers sub parse_tag_number_or_range { my ($str, $max, $tag) = @_; diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm index c0b2402..4853f76 100644 --- a/PVE/Network/SDN/Zones/QinQPlugin.pm +++ b/PVE/Network/SDN/Zones/QinQPlugin.pm @@ -3,6 +3,7 @@ package PVE::Network::SDN::Zones::QinQPlugin; use strict; use warnings; use PVE::Network::SDN::Zones::Plugin; +use PVE::Exception qw(raise raise_param_exc); use base('PVE::Network::SDN::Zones::Plugin'); @@ -210,6 +211,13 @@ sub status { return $err_msg; } +sub verify_tag { +my ($class, $tag) = @_; + +raise_param_exc({ tag => "missing vlan tag"}) if !defined($tag); +raise_param_exc({ tag => "vlan tag max value is 4096"}) if $tag > 409
[pve-devel] [PATCH pve-network 0/3] add simple zone plugin
This add a new simple plugin, to create standalone/isolated bridge without any vlan tag. This can be used for routed setup or NAT bridge (I'll look to implemented NAT with subnets) Tag is now optionnal, and tag value is checked in zone plugin now. Alexandre Derumier (3): add simple plugin vnet: make tag optional and verify value in zone plugins cleanup code with wrong copy/paste from Storage PVE/API2/Network/SDN/Vnets.pm | 15 ++ PVE/API2/Network/SDN/Zones.pm | 3 +- PVE/API2/Network/SDN/Zones/Content.pm | 1 - PVE/Network/SDN/VnetPlugin.pm | 5 +- PVE/Network/SDN/Zones.pm | 2 + PVE/Network/SDN/Zones/EvpnPlugin.pm | 7 +++ PVE/Network/SDN/Zones/Makefile| 2 +- PVE/Network/SDN/Zones/Plugin.pm | 5 ++ PVE/Network/SDN/Zones/QinQPlugin.pm | 8 +++ PVE/Network/SDN/Zones/SimplePlugin.pm | 77 +++ PVE/Network/SDN/Zones/VlanPlugin.pm | 8 +++ PVE/Network/SDN/Zones/VxlanPlugin.pm | 8 +++ 12 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 PVE/Network/SDN/Zones/SimplePlugin.pm -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager 1/3] sdn: vnetedit: tag optional && fix max tag value
Signed-off-by: Alexandre Derumier --- www/manager6/sdn/VnetEdit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/manager6/sdn/VnetEdit.js b/www/manager6/sdn/VnetEdit.js index dfe6cb13..aa40b41f 100644 --- a/www/manager6/sdn/VnetEdit.js +++ b/www/manager6/sdn/VnetEdit.js @@ -51,9 +51,9 @@ Ext.define('PVE.sdn.VnetInputPanel', { xtype: 'proxmoxintegerfield', name: 'tag', minValue: 1, - maxValue: 1600, + maxValue: 16777216, fieldLabel: gettext('Tag'), - allowBlank: false, + allowBlank: true, }, { xtype: 'proxmoxcheckbox', -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager 3/3] sdn: add simple zone plugin
Signed-off-by: Alexandre Derumier --- www/manager6/Makefile| 1 + www/manager6/Utils.js| 5 +++ www/manager6/sdn/zones/SimpleEdit.js | 53 3 files changed, 59 insertions(+) create mode 100644 www/manager6/sdn/zones/SimpleEdit.js diff --git a/www/manager6/Makefile b/www/manager6/Makefile index ff452184..46254c04 100644 --- a/www/manager6/Makefile +++ b/www/manager6/Makefile @@ -203,6 +203,7 @@ JSSRC= \ sdn/zones/VxlanEdit.js \ sdn/zones/QinQEdit.js \ sdn/zones/EvpnEdit.js \ + sdn/zones/SimpleEdit.js \ sdn/ControllerView.js \ sdn/controllers/Base.js \ sdn/controllers/EvpnEdit.js \ diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js index 1dae292e..c5a76dcd 100644 --- a/www/manager6/Utils.js +++ b/www/manager6/Utils.js @@ -669,6 +669,11 @@ Ext.define('PVE.Utils', { utilities: { name: 'zone', hideAdd: true }, + simple: { + name: 'Simple', + ipanel: 'SimpleInputPanel', + faIcon: 'th' + }, vlan: { name: 'VLAN', ipanel: 'VlanInputPanel', diff --git a/www/manager6/sdn/zones/SimpleEdit.js b/www/manager6/sdn/zones/SimpleEdit.js new file mode 100644 index ..683d6766 --- /dev/null +++ b/www/manager6/sdn/zones/SimpleEdit.js @@ -0,0 +1,53 @@ +Ext.define('PVE.sdn.zones.SimpleInputPanel', { +extend: 'PVE.panel.SDNZoneBase', + +onlineHelp: 'pvesdn_zone_plugin_simple', + +onGetValues: function(values) { +var me = this; + +if (me.isCreate) { +values.type = me.type; +} else { +delete values.zone; +} + +return values; +}, + +initComponent : function() { + var me = this; + +me.items = [ + { +xtype: me.isCreate ? 'textfield' : 'displayfield', +name: 'zone', +maxLength: 10, +value: me.zone || '', +fieldLabel: 'ID', +allowBlank: false + }, + { +xtype: 'proxmoxintegerfield', +name: 'mtu', +minValue: 100, +maxValue: 65000, +fieldLabel: 'MTU', +skipEmptyText: true, +allowBlank: true, +emptyText: 'auto' + }, + { +xtype: 'pveNodeSelector', +name: 'nodes', +fieldLabel: gettext('Nodes'), +emptyText: gettext('All') + ' (' + gettext('No restrictions') +')', +multiSelect: true, +autoSelect: false + }, + + ]; + + me.callParent(); +} +}); -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH pve-manager 0/3] add simple zone plugin
Following the pve-network && pve-docs patch series Alexandre Derumier (3): sdn: vnetedit: tag optional && fix max tag value sdn: move mtu from vnetview to zoneview sdn: add simple zone plugin www/manager6/Makefile| 1 + www/manager6/Utils.js| 5 +++ www/manager6/sdn/VnetEdit.js | 4 +-- www/manager6/sdn/VnetView.js | 7 +--- www/manager6/sdn/ZoneView.js | 5 +++ www/manager6/sdn/zones/SimpleEdit.js | 53 6 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 www/manager6/sdn/zones/SimpleEdit.js -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete
On June 30, 2020 3:56 pm, Oguz Bektas wrote: > do a simple check to see if our $opt is already in the delete section. > > Signed-off-by: Oguz Bektas > --- > src/PVE/LXC/Config.pm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm > index 0a28380..237e2e5 100644 > --- a/src/PVE/LXC/Config.pm > +++ b/src/PVE/LXC/Config.pm > @@ -974,6 +974,9 @@ sub update_pct_config { > my $value = $param->{$opt}; > if ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') { > $class->check_protection($conf, "can't update CT $vmid drive > '$opt'"); > + if ($conf->{pending}->{delete} =~ m/$opt/) { this is incomplete: - $conf->{pending} or $conf->{pending}->{delete} might be undef - the matching is fuzzy (e.g., there might be a pending deletion of mp10, and we are currently hotplugging mp1) - we can actually just put the new mpX into the pending queue, and remove the entry from the pending deletion queue? (it's hotplugging that is the problem, not queuing the pending change) > + die "${opt} is in pending delete queue. please select another > mountpoint ID\n"; > + } > my $mp = $class->parse_volume($opt, $value); > $check_content_type->($mp) if ($mp->{type} eq 'volume'); > } elsif ($opt eq 'hookscript') { > -- > 2.20.1 > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [RFC pve-qemu] Add systemd journal logging patch
On 6/30/20 6:28 PM, Dietmar Maurer wrote: comments inline On 06/30/2020 2:06 PM Stefan Reiter wrote: Prints QEMU errors that occur *after* the "-daemonize" fork to the systemd journal, instead of pushing them into /dev/null like before. Signed-off-by: Stefan Reiter --- Useful for debugging rust panics for example. I'm sure there's other ways to go about this (log files? pass the journal fd from outside? pipe it into the journal somehow?) but this one seems simple enough, though it of course requires linking QEMU against libsystemd. @dietmar: is this similar to what you had in mind? debian/control| 1 + ...ct-stderr-to-journal-when-daemonized.patch | 50 +++ debian/patches/series | 1 + 3 files changed, 52 insertions(+) create mode 100644 debian/patches/pve/0052-PVE-redirect-stderr-to-journal-when-daemonized.patch diff --git a/debian/control b/debian/control index caceabb..e6d935d 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Build-Depends: autotools-dev, libseccomp-dev, libspice-protocol-dev (>= 0.12.14~), libspice-server-dev (>= 0.14.0~), + libsystemd-dev, libusb-1.0-0-dev (>= 1.0.17-1), libusbredirparser-dev (>= 0.6-2), python3-minimal, diff --git a/debian/patches/pve/0052-PVE-redirect-stderr-to-journal-when-daemonized.patch b/debian/patches/pve/0052-PVE-redirect-stderr-to-journal-when-daemonized.patch new file mode 100644 index 000..f73de53 --- /dev/null +++ b/debian/patches/pve/0052-PVE-redirect-stderr-to-journal-when-daemonized.patch @@ -0,0 +1,50 @@ +From Mon Sep 17 00:00:00 2001 +From: Stefan Reiter +Date: Tue, 30 Jun 2020 13:10:10 +0200 +Subject: [PATCH] PVE: redirect stderr to journal when daemonized + +QEMU uses the logging for error messages usually, so LOG_ERR is most +fitting. +--- + Makefile.objs | 1 + + os-posix.c| 7 +-- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/Makefile.objs b/Makefile.objs +index b7d58e592e..105f23bff7 100644 +--- a/Makefile.objs b/Makefile.objs +@@ -55,6 +55,7 @@ common-obj-y += net/ + common-obj-y += qdev-monitor.o + common-obj-$(CONFIG_WIN32) += os-win32.o + common-obj-$(CONFIG_POSIX) += os-posix.o ++os-posix.o-libs := -lsystemd + + common-obj-$(CONFIG_LINUX) += fsdev/ + +diff --git a/os-posix.c b/os-posix.c +index 3cd52e1e70..ab4d052c62 100644 +--- a/os-posix.c b/os-posix.c +@@ -28,6 +28,8 @@ + #include + #include + #include ++#include ++#include + + #include "qemu-common.h" + /* Needed early for CONFIG_BSD etc. */ +@@ -309,9 +311,10 @@ void os_setup_post(void) + + dup2(fd, 0); + dup2(fd, 1); I guess we also want to redirect stdout. Or does that produce too much noise? I figured since QEMU doesn't redirect it to its log file either that it wouldn't produce anything useful on stdout? +-/* In case -D is given do not redirect stderr to /dev/null */ ++/* In case -D is given do not redirect stderr to journal */ + if (!qemu_logfile) { +-dup2(fd, 2); ++int journal_fd = sd_journal_stream_fd("QEMU", LOG_ERR, 0); ++dup2(journal_fd, 2); + } + + close(fd); diff --git a/debian/patches/series b/debian/patches/series index 5d6a5d6..e658c1a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -50,3 +50,4 @@ pve/0048-savevm-async-add-debug-timing-prints.patch pve/0049-Add-some-qemu_vfree-statements-to-prevent-memory-lea.patch pve/0050-Fix-backup-for-not-64k-aligned-storages.patch pve/0051-PVE-Backup-Add-dirty-bitmap-tracking-for-incremental.patch +pve/0052-PVE-redirect-stderr-to-journal-when-daemonized.patch -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: Re: [PATCH qemu-server 02/11] update_disksize: make interface leaner
On 20.05.20 10:20, Fabian Ebner wrote: > Pass new size directly, so the function doesn't need to know about > how some hash is organized. And return a message directly, instead > of both size-strings. Also dropped the wantarray, because both > existing callers use the message anyways. > > Signed-off-by: Fabian Ebner > --- > PVE/QemuMigrate.pm | 5 +++-- > PVE/QemuServer.pm | 6 +++--- > PVE/QemuServer/Drive.pm | 11 +-- > 3 files changed, 11 insertions(+), 11 deletions(-) > > applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: Re: [PATCH qemu-server 01/11] sync_disks: fix check
On 20.05.20 10:20, Fabian Ebner wrote: > Signed-off-by: Fabian Ebner > --- > > This is a re-send of a previously stand-alone patch. > > PVE/QemuMigrate.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH pve-network] use PVE::Tools::split_list for ip lists
with the following applied on-top, since we don't want declarations combined with post-if: my $foo = 'bla' if $bar; is undefined behaviour[1]. -8<- diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/PVE/Network/SDN/Controllers/EvpnPlugin.pm index 9321af1..d82de2a 100644 --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -47,11 +47,13 @@ sub options { sub generate_controller_config { my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_; -my @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'}; +my @peers; +@peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'}; my $asn = $plugin_config->{asn}; my $gatewaynodes = $plugin_config->{'gateway-nodes'}; -my @gatewaypeers = PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'}; +my @gatewaypeers; +@gatewaypeers = PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if $plugin_config->{'gateway-external-peers'}; return if !$asn; diff --git a/PVE/Network/SDN/Zones/VxlanPlugin.pm b/PVE/Network/SDN/Zones/VxlanPlugin.pm index 5f17e15..e8cf1bd 100644 --- a/PVE/Network/SDN/Zones/VxlanPlugin.pm +++ b/PVE/Network/SDN/Zones/VxlanPlugin.pm @@ -50,7 +50,8 @@ sub generate_sdn_config { my $ipv6 = $vnet->{ipv6}; my $mac = $vnet->{mac}; my $multicastaddress = $plugin_config->{'multicast-address'}; -my @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'}; +my @peers; +@peers = PVE::Tools::split_list($plugin_config->{'peers'}) if $plugin_config->{'peers'}; my $vxlan_iface = "vxlan_$vnetid"; die "missing vxlan tag" if !$tag; ->8- I don't know enough about the code paths here to quickly evaluate this myself, but I have a feeling that some checks for undef are missing in these files, e.g.: PVE::Network::SDN::Controllers::EvpnPlugin::generate_controler_config() @peers and @gatewaypeers might be undef (or if not, then the post-if is unnecessary) @peers is passed to PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers if @peers is undef, this returns undef as well ($ifaceip, $interface) $ifaceip is put into a string inside @controller_config without checks something else that confused me at first glance in that method: @controller_config is re-used multiple times. it would probably be a good idea to find a better name for the three instances, and make that three variables ;) 1: https://git.proxmox.com/?p=pve-container.git;a=commitdiff;h=9de0505c772f7c382c82d9bfb170b3e0664af9ed On June 30, 2020 2:25 pm, Alexandre Derumier wrote: > Signed-off-by: Alexandre Derumier > --- > PVE/Network/SDN/Controllers/EvpnPlugin.pm | 4 ++-- > PVE/Network/SDN/Zones/EvpnPlugin.pm | 2 +- > PVE/Network/SDN/Zones/VxlanPlugin.pm | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/PVE/Network/SDN/Controllers/EvpnPlugin.pm > b/PVE/Network/SDN/Controllers/EvpnPlugin.pm > index 79ecaeb..9321af1 100644 > --- a/PVE/Network/SDN/Controllers/EvpnPlugin.pm > +++ b/PVE/Network/SDN/Controllers/EvpnPlugin.pm > @@ -47,11 +47,11 @@ sub options { > sub generate_controller_config { > my ($class, $plugin_config, $controller, $id, $uplinks, $config) = @_; > > -my @peers = split(',', $plugin_config->{'peers'}) if > $plugin_config->{'peers'}; > +my @peers = PVE::Tools::split_list($plugin_config->{'peers'}) if > $plugin_config->{'peers'}; > > my $asn = $plugin_config->{asn}; > my $gatewaynodes = $plugin_config->{'gateway-nodes'}; > -my @gatewaypeers = split(',', > $plugin_config->{'gateway-external-peers'}) if > $plugin_config->{'gateway-external-peers'}; > +my @gatewaypeers = > PVE::Tools::split_list($plugin_config->{'gateway-external-peers'}) if > $plugin_config->{'gateway-external-peers'}; > > return if !$asn; > > diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm > b/PVE/Network/SDN/Zones/EvpnPlugin.pm > index 95fbb64..b2f57ee 100644 > --- a/PVE/Network/SDN/Zones/EvpnPlugin.pm > +++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm > @@ -52,7 +52,7 @@ sub generate_sdn_config { > die "missing vxlan tag" if !$tag; > warn "vlan-aware vnet can't be enabled with evpn plugin" if > $vnet->{vlanaware}; > > -my @peers = split(',', $controller->{'peers'}); > +my @peers = PVE::Tools::split_list($controller->{'peers'}); > my ($ifaceip, $iface) = > PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers); > > my $mtu = 1450; > diff --git a/PVE/Network/SDN/Zones/VxlanPlugin.pm > b/PVE/Network/SDN/Zones/VxlanPlugin.pm > index bc585c6..5f17e15 100644 > --- a/PVE/Network/SDN/Zones/VxlanPlugin.pm > +++ b/PVE/Network/SDN/Zones/VxlanPlugin.pm > @@ -50,7 +50,7 @@ sub generate_sdn_config { > my $ipv6 = $vnet->{ipv6}; > my $mac =
[pve-devel] applied: [PATCH pve-network 1/2] remove more variable declarations with post-ifs
usage of $mtu is always guarded by an if itself anyway, so all of these are redundant post-ifs and can be removed. Signed-off-by: Fabian Grünbichler --- PVE/Network/SDN/Zones/QinQPlugin.pm | 4 ++-- PVE/Network/SDN/Zones/VlanPlugin.pm | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm b/PVE/Network/SDN/Zones/QinQPlugin.pm index c0b2402..c8dd0ab 100644 --- a/PVE/Network/SDN/Zones/QinQPlugin.pm +++ b/PVE/Network/SDN/Zones/QinQPlugin.pm @@ -55,7 +55,7 @@ sub generate_sdn_config { die "can't find bridge $bridge" if !-d "/sys/class/net/$bridge"; my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering"); -my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif"; +my $is_ovs = !-d "/sys/class/net/$bridge/brif"; my @iface_config = (); my $vnet_bridge_ports = ""; @@ -177,7 +177,7 @@ sub status { } my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering"); -my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif"; +my $is_ovs = !-d "/sys/class/net/$bridge/brif"; my $tag = $vnet->{tag}; my $vnet_uplink = "ln_".$vnetid; diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm b/PVE/Network/SDN/Zones/VlanPlugin.pm index 8e99fc4..dedb32c 100644 --- a/PVE/Network/SDN/Zones/VlanPlugin.pm +++ b/PVE/Network/SDN/Zones/VlanPlugin.pm @@ -44,11 +44,11 @@ sub generate_sdn_config { die "can't find bridge $bridge" if !-d "/sys/class/net/$bridge"; my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering"); -my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif"; +my $is_ovs = !-d "/sys/class/net/$bridge/brif"; my $tag = $vnet->{tag}; my $alias = $vnet->{alias}; -my $mtu = $plugin_config->{mtu} if $plugin_config->{mtu}; +my $mtu = $plugin_config->{mtu}; my $vnet_uplink = "ln_".$vnetid; my $vnet_uplinkpeer = "pr_".$vnetid; @@ -142,7 +142,7 @@ sub status { } my $vlan_aware = PVE::Tools::file_read_firstline("/sys/class/net/$bridge/bridge/vlan_filtering"); -my $is_ovs = 1 if !-d "/sys/class/net/$bridge/brif"; +my $is_ovs = !-d "/sys/class/net/$bridge/brif"; my $tag = $vnet->{tag}; my $vnet_uplink = "ln_".$vnetid; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH pve-network 2/2] build: fix erroneous install with empty DESTDIR
dh calls make in the dh_auto_build step without setting DESTDIR, so the missing empty default target meant that we'd install all the files to the build system during dh_auto_build, and then install them again to the tmp build dir during dh_auto_install. obviously the former is not something we want to do ;) Signed-off-by: Fabian Grünbichler --- noticed this while building as non-root.. PVE/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PVE/Makefile b/PVE/Makefile index 1fb961d..26e01a4 100644 --- a/PVE/Makefile +++ b/PVE/Makefile @@ -1,3 +1,5 @@ +all: + .PHONY: install install: make -C Network install -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH firewall] ebtables: keep policy of custom chains
with bug # added to commit subject. sorry for the delay, and thanks for the fix! On June 2, 2020 10:06 am, Stoiko Ivanov wrote: > currently all ebtalbes chains are created with a hardcoded policy of ACCEPT. > This patch changes the functionality to store the configured policy of a > chain while reading the 'ebtables-save' output and uses this policy when > creating the command list. > > This is only relevant for ebtablers chains not generated by pve-firewall (the > ones having an action of 'ignore' in the status-hash). > > Reported on the pve-user list: > https://pve.proxmox.com/pipermail/pve-user/2020-May/171731.html > > Minimally tested with the example from the thread. > > Signed-off-by: Stoiko Ivanov > --- > src/PVE/Firewall.pm | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm > index a2105e5..97670fd 100644 > --- a/src/PVE/Firewall.pm > +++ b/src/PVE/Firewall.pm > @@ -1944,9 +1944,10 @@ sub ebtables_get_chains { > my $line = shift; > return if $line =~ m/^#/; > return if $line =~ m/^\s*$/; > - if ($line =~ m/^:(\S+)\s\S+$/) { > + if ($line =~ m/^:(\S+)\s(ACCEPT|DROP|RETURN)$/) { > # Make sure we know chains exist even if they're empty. > $chains->{$1} //= []; > + $res->{$1}->{policy} = $2; > } elsif ($line =~ m/^(?:\S+)\s(\S+)\s(?:\S+).*/) { > my $chain = $1; > $line =~ s/\s+$//; > @@ -4063,6 +4064,7 @@ sub get_ruleset_status { > if (defined($change_only_regex)) { > $action = 'ignore' if ($chain !~ m/$change_only_regex/); > $statushash->{$chain}->{rules} = $active_chains->{$chain}->{rules}; > + $statushash->{$chain}->{policy} = > $active_chains->{$chain}->{policy}; > $sig = $sig->{sig}; > } > $statushash->{$chain}->{action} = $action; > @@ -4163,7 +4165,8 @@ sub get_ebtables_cmdlist { > my $pve_include = 0; > foreach my $chain (sort keys %$statushash) { > next if ($statushash->{$chain}->{action} eq 'delete'); > - $cmdlist .= ":$chain ACCEPT\n"; > + my $policy = $statushash->{$chain}->{policy} // 'ACCEPT'; > + $cmdlist .= ":$chain $policy\n"; > $pve_include = 1 if ($chain eq 'PVEFW-FORWARD'); > } > > -- > 2.20.1 > > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH v2 container] fix #2820: block adding new volume with same id if it's pending delete
if a user tries to add a mountpoint mpX which is waiting for a pending delete, hotplugging a new mountpoint with name mpX before the previous one is detached should not be allowed. do a simple check to see if the given mpX is already in the pending delete section. Signed-off-by: Oguz Bektas --- v1->v2: * use exact matching * change full stop to comma * s/mountpoint/mount point/ src/PVE/LXC/Config.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm index 0a28380..f582eb8 100644 --- a/src/PVE/LXC/Config.pm +++ b/src/PVE/LXC/Config.pm @@ -974,6 +974,9 @@ sub update_pct_config { my $value = $param->{$opt}; if ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') { $class->check_protection($conf, "can't update CT $vmid drive '$opt'"); + if ($conf->{pending}->{delete} =~ m/$opt\b/) { + die "${opt} is in pending delete queue, please choose another mount point ID\n"; + } my $mp = $class->parse_volume($opt, $value); $check_content_type->($mp) if ($mp->{type} eq 'volume'); } elsif ($opt eq 'hookscript') { -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH storage 3/5] scan_cifs: do not enforce password for users
there can be accounts with explicit null password others than the mapped guest account. Signed-off-by: Thomas Lamprecht --- PVE/Storage.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 42e769a..1de2bcb 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1198,7 +1198,6 @@ sub scan_cifs { my $cmd = ['/usr/bin/smbclient', '-m', 'smb3', '-d', '0', '-L', $server]; push @$cmd, '-N' if !defined($user); push @$cmd, '-W', $domain if defined($domain); -die "password is required\n" if defined($user) && !defined($password); local $ENV{USER} = $user if defined($user); local $ENV{PASSWD} = $password if defined($password); -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH storage 1/5] scan_cifs: add workgroup domain independent of user param
they are not really bound to each other Signed-off-by: Thomas Lamprecht --- PVE/Storage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 9ed8c07..e2a6fd0 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1199,10 +1199,10 @@ sub scan_cifs { if (defined($user)) { die "password is required\n" if !defined($password); push @$cmd, '-U', "$user\%$password"; - push @$cmd, '-W', $domain if defined($domain); } else { push @$cmd, '-N'; } +push @$cmd, '-W', $domain if defined($domain); my $res = {}; my $err = ''; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH storage 4/5] scan_cifs: do not add NT_STATUS lines to result
Signed-off-by: Thomas Lamprecht --- PVE/CLI/pvesm.pm | 1 - PVE/Storage.pm | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm index 8c86714..c5e2d91 100755 --- a/PVE/CLI/pvesm.pm +++ b/PVE/CLI/pvesm.pm @@ -504,7 +504,6 @@ __PACKAGE__->register_method ({ my $data = []; foreach my $k (keys %$res) { - next if $k =~ m/NT_STATUS_/; push @$data, { share => $k, description => $res->{$k} }; } diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 1de2bcb..e04f2ac 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1213,8 +1213,9 @@ sub scan_cifs { my $line = shift; if ($line =~ m/(\S+)\s*Disk\s*(\S*)/) { $res->{$1} = $2; - } elsif ($line =~ m/(NT_STATUS_(\S*))/) { - $res->{$1} = ''; + } elsif ($line =~ m/(NT_STATUS_(\S+))/) { + my $status = $1; + $err .= "unexpected status: $1\n" if uc($1) ne 'SUCCESS'; } }, ); -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH storage 5/5] scan storage: order scanned shares alphabetically
Signed-off-by: Thomas Lamprecht --- PVE/CLI/pvesm.pm | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm index c5e2d91..4f934d6 100755 --- a/PVE/CLI/pvesm.pm +++ b/PVE/CLI/pvesm.pm @@ -434,7 +434,7 @@ __PACKAGE__->register_method ({ my $res = PVE::Storage::scan_nfs($server); my $data = []; - foreach my $k (keys %$res) { + foreach my $k (sort keys %$res) { push @$data, { path => $k, options => $res->{$k} }; } return $data; @@ -503,7 +503,7 @@ __PACKAGE__->register_method ({ my $res = PVE::Storage::scan_cifs($server, $username, $password, $domain); my $data = []; - foreach my $k (keys %$res) { + foreach my $k (sort keys %$res) { push @$data, { share => $k, description => $res->{$k} }; } @@ -553,7 +553,7 @@ __PACKAGE__->register_method ({ my $res = PVE::Storage::scan_nfs($server); my $data = []; - foreach my $path (keys %$res) { + foreach my $path (sort keys %$res) { if ($path =~ m!^/([^\s/]+)$!) { push @$data, { volname => $1 }; } @@ -603,7 +603,7 @@ __PACKAGE__->register_method ({ my $res = PVE::Storage::scan_iscsi($param->{portal}); my $data = []; - foreach my $k (keys %$res) { + foreach my $k (sort keys %$res) { push @$data, { target => $k, portal => join(',', @{$res->{$k}}) }; } -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH storage 2/5] scan_cifs: pass user/pass over environment
As command line argument they are readable by ever user in the same PID namespace. Signed-off-by: Thomas Lamprecht --- PVE/Storage.pm | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index e2a6fd0..42e769a 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1196,13 +1196,12 @@ sub scan_cifs { # we only support Windows 2012 and newer, so just use smb3 my $cmd = ['/usr/bin/smbclient', '-m', 'smb3', '-d', '0', '-L', $server]; -if (defined($user)) { - die "password is required\n" if !defined($password); - push @$cmd, '-U', "$user\%$password"; -} else { - push @$cmd, '-N'; -} +push @$cmd, '-N' if !defined($user); push @$cmd, '-W', $domain if defined($domain); +die "password is required\n" if defined($user) && !defined($password); + +local $ENV{USER} = $user if defined($user); +local $ENV{PASSWD} = $password if defined($password); my $res = {}; my $err = ''; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: Re: [PATCH v3 storage 03/13] Add archive_remove
On 30.06.20 10:24, Fabian Ebner wrote: > Signed-off-by: Fabian Ebner > --- > > Changes in v3: > * die if unlink of archive fails > * check whether log file exists before trying to unlink it > * warn if unlink of log file fails > > PVE/Storage.pm | 17 + > 1 file changed, 17 insertions(+) > > applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: Re: [PATCH v3 storage 02/13] Extend archive_info to include filename and logfilename
On 30.06.20 10:24, Fabian Ebner wrote: > Only expect the logfilename if the archive has a standard name. > This also gives a mechanism to get an untainted filename. > > archive_info can take either a volume ID or a path as it's > currently implemented. This is useful for vzdump when there > is no storage (i.e. for 'vzdump --dumpdir'). Add a test case for this. > > Signed-off-by: Fabian Ebner > --- > PVE/Storage.pm| 13 - > test/archive_info_test.pm | 22 ++ > 2 files changed, 30 insertions(+), 5 deletions(-) > > applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: Re: [PATCH v3 storage 04/13] PBSPlugin: Add print_volid helper
On 30.06.20 10:24, Fabian Ebner wrote: > Signed-off-by: Fabian Ebner > --- > PVE/Storage/PBSPlugin.pm | 13 + > 1 file changed, 9 insertions(+), 4 deletions(-) > > applied, thanks! ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH vncterm 1/2] libvncserver: update sources to 0.9.13
Signed-off-by: Fabian Grünbichler --- LibVNCServer-0.9.11.tar.gz | Bin 1413739 -> 0 bytes LibVNCServer-0.9.13.tar.gz | Bin 0 -> 567491 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 LibVNCServer-0.9.11.tar.gz create mode 100644 LibVNCServer-0.9.13.tar.gz diff --git a/LibVNCServer-0.9.11.tar.gz b/LibVNCServer-0.9.11.tar.gz deleted file mode 100644 index c33564a..000 Binary files a/LibVNCServer-0.9.11.tar.gz and /dev/null differ diff --git a/LibVNCServer-0.9.13.tar.gz b/LibVNCServer-0.9.13.tar.gz new file mode 100644 index 000..e0d6242 Binary files /dev/null and b/LibVNCServer-0.9.13.tar.gz differ -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH vncterm 2/2] build: rebase on libvncserver 0.9.13
upstream switched to cmake from autotools. it is possible to drop systemd via a build option now, so use that instead of patching. Signed-off-by: Fabian Grünbichler --- Makefile | 7 +++--- vncpatches/tls-auth-pluging.patch | 41 +++ debian/control| 3 ++- vncpatches/series | 1 - 4 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index a84205e..da654d9 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ include /usr/share/dpkg/architecture.mk PACKAGE=vncterm GITVERSION:=$(shell cat .git/refs/heads/master) -VNCVER=0.9.11 +VNCVER=0.9.13 VNCREL=LibVNCServer-${VNCVER} VNCDIR=libvncserver-${VNCREL} VNCSRC=${VNCREL}.tar.gz -VNCLIB=${VNCDIR}/libvncserver/.libs/libvncserver.a +VNCLIB=${VNCDIR}/libvncserver.a DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb @@ -32,8 +32,7 @@ ${VNCLIB}: ${VNCSRC} tar xf ${VNCSRC} ln -s ../vncpatches ${VNCDIR}/patches cd ${VNCDIR}; quilt push -a - cd ${VNCDIR}; ./autogen.sh --without-ssl --without-websockets --without-tightvnc-filetransfer; - cd ${VNCDIR}; $(MAKE) + cd ${VNCDIR}; cmake -D WITH_GNUTLS=OFF -D WITH_OPENSSL=OFF -D WITH_WEBSOCKETS=OFF -D WITH_SYSTEMD=OFF -D WITH_TIGHTVNC_FILETRANSFER=OFF -D WITH_GCRYPT=OFF -D BUILD_SHARED_LIBS=OFF .; cmake --build . vncterm: vncterm.c wchardata.c $(VNCLIB) $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(VNC_LIBS) diff --git a/vncpatches/tls-auth-pluging.patch b/vncpatches/tls-auth-pluging.patch index 17a8c47..837612f 100644 --- a/vncpatches/tls-auth-pluging.patch +++ b/vncpatches/tls-auth-pluging.patch @@ -1,23 +1,22 @@ -Index: vnc/libvncserver/auth.c +Index: libvncserver-LibVNCServer-0.9.13/libvncserver/auth.c === -@@ -300,8 +300,9 @@ - int32_t securityType = rfbSecTypeInvalid; +--- libvncserver-LibVNCServer-0.9.13.orig/libvncserver/auth.c libvncserver-LibVNCServer-0.9.13/libvncserver/auth.c +@@ -301,7 +301,8 @@ rfbAuthNewClient(rfbClientPtr cl) if (!cl->screen->authPasswdData || cl->reverseConnection) { -- /* chk if this condition is valid or not. */ + /* chk if this condition is valid or not. */ - securityType = rfbSecTypeNone; -+ /* chk if this condition is valid or not. */ + /* we disable anonymous auth */ + // securityType = rfbSecTypeNone; } else if (cl->screen->authPasswdData) { securityType = rfbSecTypeVncAuth; } -Index: vnc/newterm/Makefile.am -Index: vnc/libvncserver/sockets.c +Index: libvncserver-LibVNCServer-0.9.13/libvncserver/sockets.c === vnc.orig/libvncserver/sockets.c2011-01-20 16:42:41.0 +0100 -+++ vnc/libvncserver/sockets.c 2011-01-21 10:20:03.0 +0100 -@@ -613,7 +613,11 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout) +--- libvncserver-LibVNCServer-0.9.13.orig/libvncserver/sockets.c libvncserver-LibVNCServer-0.9.13/libvncserver/sockets.c +@@ -638,7 +638,11 @@ rfbReadExactTimeout(rfbClientPtr cl, cha n = read(sock, buf, len); } #else @@ -30,7 +29,7 @@ Index: vnc/libvncserver/sockets.c #endif if (n > 0) { -@@ -801,7 +805,11 @@ rfbWriteExact(rfbClientPtr cl, +@@ -826,7 +830,11 @@ rfbWriteExact(rfbClientPtr cl, n = rfbssl_write(cl, buf, len); else #endif @@ -42,21 +41,21 @@ Index: vnc/libvncserver/sockets.c if (n > 0) { -Index: vnc/rfb/rfb.h +Index: libvncserver-LibVNCServer-0.9.13/rfb/rfb.h === vnc.orig/rfb/rfb.h 2011-01-20 16:36:06.0 +0100 -+++ vnc/rfb/rfb.h 2011-01-21 06:44:22.0 +0100 -@@ -397,6 +397,9 @@ - struct _rfbStatList *Next; - } rfbStatList; +--- libvncserver-LibVNCServer-0.9.13.orig/rfb/rfb.h libvncserver-LibVNCServer-0.9.13/rfb/rfb.h +@@ -411,6 +411,9 @@ typedef struct _rfbStatList { + typedef struct _rfbSslCtx rfbSslCtx; + typedef struct _wsCtx wsCtx; +typedef ssize_t (*sock_read_fn_t)(struct _rfbClientRec *cl, void *buf, size_t count); +typedef ssize_t (*sock_write_fn_t)(struct _rfbClientRec *cl, const void *buf, size_t count); + typedef struct _rfbClientRec { - - /* back pointer to the screen */ -@@ -417,6 +420,10 @@ + + /** back pointer to the screen */ +@@ -431,6 +434,10 @@ typedef struct _rfbClientRec { void* clientData; ClientGoneHookPtr clientGoneHook; @@ -64,6 +63,6 @@ Index: vnc/rfb/rfb.h +sock_read_fn_t sock_read_fn; +sock_read_fn_t sock_write_fn; + - SOCKET sock; + rfbSocket sock; char *host; diff --git a/debian/control b/debian/control index 89c0f5d..cb6c7b2 100644 --- a/debian/control +++ b/debian/control @@ -1,6 +1,7 @@ Source: vncterm Maintainer: Proxmox Support Team -Build-Depends: d
[pve-devel] [PATCH qemu-server 3/3] Use new move_config_to_node method
Signed-off-by: Fabian Ebner --- PVE/QemuMigrate.pm | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 96de0db..cd4a005 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -1179,16 +1179,9 @@ sub phase3_cleanup { PVE::QemuConfig->write_config($vmid, $conf); } -# transfer replication state before move config +# transfer replication state before moving config $self->transfer_replication_state() if $self->{replicated_volumes}; - -# move config to remote node -my $conffile = PVE::QemuConfig->config_file($vmid); -my $newconffile = PVE::QemuConfig->config_file($vmid, $self->{node}); - -die "Failed to move config to node '$self->{node}' - rename failed: $!\n" -if !rename($conffile, $newconffile); - +PVE::QemuConfig->move_config_to_node($vmid, $self->{node}); $self->switch_replication_job_target() if $self->{replicated_volumes}; if ($self->{livemigration}) { -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH guest-common 1/3] Add move_config_to_node method
Allows to mock moving the configuration for testing and reduces duplication between the migration modules by a tiny amount. Signed-off-by: Fabian Ebner --- Dependency bumps container,qemu-server -> guest-common are needed PVE/AbstractConfig.pm | 11 +++ 1 file changed, 11 insertions(+) diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm index 4c9ad2c..b9228bb 100644 --- a/PVE/AbstractConfig.pm +++ b/PVE/AbstractConfig.pm @@ -274,6 +274,17 @@ sub destroy_config { unlink $config_fn or die "failed to remove config file: $!\n"; } +# moves configuration owned by calling node to the target node. +# dies if renaming fails. +sub move_config_to_node { +my ($class, $vmid, $target_node) = @_; + +my $config_fn = $class->config_file($vmid); +my $new_config_fn = $class->config_file($vmid, $target_node); + +rename($config_fn, $new_config_fn) or die "failed to move config file to node '$target_node': $!\n"; +} + my $lock_file_full_wrapper = sub { my ($class, $vmid, $timeout, $shared, $realcode, @param) = @_; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH container 2/3] Use new move_config_to_node method
Signed-off-by: Fabian Ebner --- I felt like this makes sense as a single block now (without each line being separated by a blank), but I can send a v2 without that style change if you want. Same for the next patch. src/PVE/LXC/Migrate.pm | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm index d0be6d4..3525e9a 100644 --- a/src/PVE/LXC/Migrate.pm +++ b/src/PVE/LXC/Migrate.pm @@ -295,9 +295,6 @@ sub phase1 { PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, $storage_migrate_opts); } -my $conffile = PVE::LXC::Config->config_file($vmid); -my $newconffile = PVE::LXC::Config->config_file($vmid, $self->{node}); - if ($self->{running}) { die "implement me"; } @@ -312,15 +309,10 @@ sub phase1 { my $vollist = PVE::LXC::Config->get_vm_volumes($conf); PVE::Storage::deactivate_volumes($self->{storecfg}, $vollist); - # transfer replication state before move config +# transfer replication state before moving config $self->transfer_replication_state() if $rep_volumes; - -# move config -die "Failed to move config to node '$self->{node}' - rename failed: $!\n" - if !rename($conffile, $newconffile); - +PVE::LXC::Config->move_config_to_node($vmid, $self->{node}); $self->{conf_migrated} = 1; - $self->switch_replication_job_target() if $rep_volumes; } -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH v2 container] fix #2820: block adding new volume with same id if it's pending delete
On July 1, 2020 11:56 am, Oguz Bektas wrote: > if a user tries to add a mountpoint mpX which is waiting for a pending > delete, hotplugging a new mountpoint with name mpX before the > previous one is detached should not be allowed. > > do a simple check to see if the given mpX is already in the pending delete > section. > > Signed-off-by: Oguz Bektas > --- > > v1->v2: > * use exact matching this is still not exact matching. split the list, look for an exact match > * change full stop to comma > * s/mountpoint/mount point/ you did not address my question on why you die, instead of just blocking hotplugging.. > > > src/PVE/LXC/Config.pm | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm > index 0a28380..f582eb8 100644 > --- a/src/PVE/LXC/Config.pm > +++ b/src/PVE/LXC/Config.pm > @@ -974,6 +974,9 @@ sub update_pct_config { > my $value = $param->{$opt}; > if ($opt =~ m/^mp(\d+)$/ || $opt eq 'rootfs') { > $class->check_protection($conf, "can't update CT $vmid drive > '$opt'"); > + if ($conf->{pending}->{delete} =~ m/$opt\b/) { > + die "${opt} is in pending delete queue, please choose another > mount point ID\n"; > + } > my $mp = $class->parse_volume($opt, $value); > $check_content_type->($mp) if ($mp->{type} eq 'volume'); > } elsif ($opt eq 'hookscript') { > -- > 2.20.1 > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete
On 01.07.20 09:11, Fabian Grünbichler wrote: > - we can actually just put the new mpX into the pending queue, and > remove the entry from the pending deletion queue? (it's hotplugging > that is the problem, not queuing the pending change) Even if we could I'm not sure I want to be able to add a new mpX as pending if the old is still pending its deletion. But, tbh, I did not looked at details so I may missing something.. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH v2 widget-toolkit 3/5] add TimezonePanel for containers
On 17.06.20 15:32, Oguz Bektas wrote: > with 3 modes; > - CT managed (no action) > - match host (use same timezone as host) > - select from list > > also move 'UTC' to the top of the TimezoneStore for convenience > > Signed-off-by: Oguz Bektas > --- > > v1->v2: > no changes > > > src/Makefile | 1 + > src/data/TimezoneStore.js | 2 +- > src/panel/TimezonePanel.js | 73 ++ > 3 files changed, 75 insertions(+), 1 deletion(-) > create mode 100644 src/panel/TimezonePanel.js > > diff --git a/src/Makefile b/src/Makefile > index 659e876..e1a31e8 100644 > --- a/src/Makefile > +++ b/src/Makefile > @@ -38,6 +38,7 @@ JSSRC= \ > panel/JournalView.js\ > panel/RRDChart.js \ > panel/GaugeWidget.js\ > + panel/TimezonePanel.js \ > window/Edit.js \ > window/PasswordEdit.js \ > window/TaskViewer.js\ > diff --git a/src/data/TimezoneStore.js b/src/data/TimezoneStore.js > index a67ad8b..fcaca3e 100644 > --- a/src/data/TimezoneStore.js > +++ b/src/data/TimezoneStore.js > @@ -7,6 +7,7 @@ Ext.define('Proxmox.data.TimezoneStore', { > extend: 'Ext.data.Store', > model: 'Timezone', > data: [ > + ['UTC'], > ['Africa/Abidjan'], > ['Africa/Accra'], > ['Africa/Addis_Ababa'], > @@ -414,6 +415,5 @@ Ext.define('Proxmox.data.TimezoneStore', { > ['Pacific/Tongatapu'], > ['Pacific/Wake'], > ['Pacific/Wallis'], > - ['UTC'], > ], > }); > diff --git a/src/panel/TimezonePanel.js b/src/panel/TimezonePanel.js > new file mode 100644 > index 000..5ebac65 > --- /dev/null > +++ b/src/panel/TimezonePanel.js > @@ -0,0 +1,73 @@ > +Ext.define('PVE.panel.TimezonePanel', { > +extend: 'Proxmox.panel.InputPanel', > +alias: 'widget.PVETimezonePanel', > + > +insideWizard: false, > + > +setValues: function(values) { > + var me = this; > + > + if (!values.timezone) { > + delete values.tzmode; can you even get values.tzmode from an outside caller? > + } else if (values.timezone === 'host') { > + values.tzmode = 'host'; Don't you need to drop `values.timezone` here? > + } else { > + values.tzmode = 'select'; > + } > + return me.callParent([values]); > +}, > + > +onGetValues: function(values) { > + var me = this; > + var deletes = []; > + if (!values.tzmode) { > + deletes.push('timezone'); > + } else if (values.tzmode === 'host') { > + values.timezone = 'host'; > + } > + delete values.tzmode; > + if (deletes.length > 0) { > + values.delete = deletes; > + } > + > + return values; > +}, > + > +items: [ > + { > + xtype: 'proxmoxKVComboBox', > + name: 'tzmode', > + fieldLabel: gettext('Time zone mode'), > + value: '__default__', > + comboItems: [ > + ['__default__', 'CT managed'], > + ['host', 'use host settings'], > + ['select', 'choose from list'], misses gettext usage. Maybe it /is/ nicer to have a radio button layout, even if I said otherwise, similar to the VMs CD/DVD drive one. * gettext('Guest Managed') * gettext('Same as Host') * gettext(''): For such a limited amount of 1st level choice this is nicer, as the user needs a click less in any case they do not want the pre-selected one. But not 100% sure, so maybe play around with it and see what is easier to use from a user POV. > + ], > + listeners: { > + change: function(kvcombo, newValue, oldValue, eOpts) { > + var combo = kvcombo.up('form').down('#tzlistcombo'); If, use `let timezoneField'. I want to avoid var if not required (which it really shouldn't) and also like more telling variable names. > + if (newValue === 'select') { > + combo.enable(); > + } else if (newValue !== 'select') { > + combo.disable(); > + } if, why not just: timezoneField.setDisabled(newValue !== 'select'); reducing 5 to 1 line. > + }, > + }, > + }, > + { > + xtype: 'combobox', > + itemId: 'tzlistcombo', > + fieldLabel: gettext('Time zone'), > + disabled: true, > + name: 'timezone', > + queryMode: 'local', > + store: Ext.create('Proxmox.data.TimezoneStore'), > + displayField: 'zone', > + editable: true, > + anyMatch: true, > + forceSelection: true, > + allowBlank: false, > + }, > +], > +}); > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH qemu] PVE-Backup: remove dirty-bitmap in pvebackup_complete_cb for failed jobs
Note: We remove the device from di_list, so pvebackup_co_cleanup does not handle this case. --- pve-backup.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/pve-backup.c b/pve-backup.c index 61a8b4d2a4..1c4f6cf9e0 100644 --- a/pve-backup.c +++ b/pve-backup.c @@ -318,6 +318,12 @@ static void pvebackup_complete_cb(void *opaque, int ret) // remove self from job queue backup_state.di_list = g_list_remove(backup_state.di_list, di); +if (di->bitmap && ret < 0) { +// on error or cancel we cannot ensure synchronization of dirty +// bitmaps with backup server, so remove all and do full backup next +bdrv_release_dirty_bitmap(di->bitmap); +} + g_free(di); qemu_mutex_unlock(&backup_state.backup_mutex); -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete
On July 1, 2020 2:05 pm, Thomas Lamprecht wrote: > On 01.07.20 09:11, Fabian Grünbichler wrote: >> - we can actually just put the new mpX into the pending queue, and >> remove the entry from the pending deletion queue? (it's hotplugging >> that is the problem, not queuing the pending change) > > Even if we could I'm not sure I want to be able to add a new mpX as pending > if the old is still pending its deletion. But, tbh, I did not looked at > details > so I may missing something.. well, the sequence is - delete mp0 (queued) - set a new mp0 (queued) just like a general - delete foo (queued) - set foo (queued) where the set removes the queued deletion. in the case of mp, applying that pending change should then add the old volume ID as unused, but that IMHO does not change the semantics of '(queuing a) set overrides earlier queued delete'. but this is broken for regular hotplug without deletion as well, setting mpX with a new volume ID if the slot is already used does not queue it as pending change, but - mounts the new volume ID in addition to the old one - adds the old volume ID as unused, even though it is still mounted in the container so this is broken in more ways than just what I initially found.. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete
On 01.07.20 14:43, Fabian Grünbichler wrote: > On July 1, 2020 2:05 pm, Thomas Lamprecht wrote: >> On 01.07.20 09:11, Fabian Grünbichler wrote: >>> - we can actually just put the new mpX into the pending queue, and >>> remove the entry from the pending deletion queue? (it's hotplugging >>> that is the problem, not queuing the pending change) >> >> Even if we could I'm not sure I want to be able to add a new mpX as pending >> if the old is still pending its deletion. But, tbh, I did not looked at >> details >> so I may missing something.. > > well, the sequence is > > - delete mp0 (queued) > - set a new mp0 (queued) > > just like a general > > - delete foo (queued) > - set foo (queued) > > where the set removes the queued deletion. in the case of mp, applying > that pending change should then add the old volume ID as unused, but > that IMHO does not change the semantics of '(queuing a) set overrides > earlier queued delete'. IMO the set mpX isn't your general option setting, and I'd just not allow re-setting it with a delete still pending, to dangerous IMO. Maybe better make it clear for the user that they either need to apply the pending change (e.g., CT reboot), revert it or just use another mpX id. > > but this is broken for regular hotplug without deletion as well, setting > mpX with a new volume ID if the slot is already used does not queue it > as pending change, but > - mounts the new volume ID in addition to the old one > - adds the old volume ID as unused, even though it is still mounted in > the container gosh.. yeah that needs to fail too. > > so this is broken in more ways than just what I initially found.. > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH container] fix #2820: block adding new volume with same id if it's pending delete
fabian's variant can be done like this: --- diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm index 0a28380..ba5e548 100644 --- a/src/PVE/LXC/Config.pm +++ b/src/PVE/LXC/Config.pm @@ -1248,6 +1248,9 @@ sub vmconfig_hotplug_pending { die "skip\n"; } + if (exists($conf->{$opt})) { + die "skip\n"; + } $class->apply_pending_mountpoint($vmid, $conf, $opt, $storecfg, 1); # apply_pending_mountpoint modifies the value if it creates a new disk $value = $conf->{pending}->{$opt}; --- we just check if the mpX is already in the config, if yes then the hotplug is skipped, adding it as a pending change for the next reboot. the "replaced" disk becomes unused. On Wed, Jul 01, 2020 at 02:50:06PM +0200, Thomas Lamprecht wrote: > On 01.07.20 14:43, Fabian Grünbichler wrote: > > On July 1, 2020 2:05 pm, Thomas Lamprecht wrote: > >> On 01.07.20 09:11, Fabian Grünbichler wrote: > >>> - we can actually just put the new mpX into the pending queue, and > >>> remove the entry from the pending deletion queue? (it's hotplugging > >>> that is the problem, not queuing the pending change) > >> > >> Even if we could I'm not sure I want to be able to add a new mpX as pending > >> if the old is still pending its deletion. But, tbh, I did not looked at > >> details > >> so I may missing something.. > > > > well, the sequence is > > > > - delete mp0 (queued) > > - set a new mp0 (queued) > > > > just like a general > > > > - delete foo (queued) > > - set foo (queued) > > > > where the set removes the queued deletion. in the case of mp, applying > > that pending change should then add the old volume ID as unused, but > > that IMHO does not change the semantics of '(queuing a) set overrides > > earlier queued delete'. > > IMO the set mpX isn't your general option setting, and I'd just not allow > re-setting it with a delete still pending, to dangerous IMO. > Maybe better make it clear for the user that they either need to apply the > pending change (e.g., CT reboot), revert it or just use another mpX id. if this is too dangerous, then i'll instead make a v3, changing the match logic to work with the parse_pending_delete helper. which is better? > > > > > but this is broken for regular hotplug without deletion as well, setting > > mpX with a new volume ID if the slot is already used does not queue it > > as pending change, but > > - mounts the new volume ID in addition to the old one > > - adds the old volume ID as unused, even though it is still mounted in > > the container > > gosh.. yeah that needs to fail too. > > > > > so this is broken in more ways than just what I initially found.. > > > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] Proxmox pveproxy - "to many http header lines" - issues with Cloudflare + latest Chrome
Hi, Google Chrome is rolling out some changes to headers (UA-CH - which causes extra headers to be included), which seems to be unearthing some latent issues with Proxmox. Specifically, in the web UI, when using the latest version of Chrome, we're getting an error message: Connection failure. Network error or Proxmox VE services not running? In the pveproxy error logs (i.e. /var/log/syslog), I see: Jul 1 15:45:22 examplemtv-vm01 pveproxy[49572]: to many http header lines > Jul 1 15:45:27 examplemtv-vm01 pveproxy[49572]: problem with client > 127.0.0.1; Connection timed out >From an old PVE/HTTPServer.pm, somebody mentioned it might be this line: https://github.com/proxmox/pve-manager/blob/master/PVE/HTTPServer.pm#L37 (I'm having trouble using the new git.proxmox.com interface to search the code). Specifically the line: my $limit_max_headers = 30; which seems to limit the header count to 30. Anyhow, I searched my local Proxmox system, and it seems to be in APIServer/AnyEvent.pm now. My assumption is that this issue is unearthed, due to extra headers the Cloudflare proxy adds on, along with extra headers than the new Chrome UA-CH feature adds, causing us to hit that 30 header limit. I did edit the PVE/APIServer/AnyEvent.pm file myself on a local Proxmox server, and hand-edited it to my $limit_max_headers = 100; which resolves the issue. Is there a specific reason the header limit is set to 30? If so, would it be possible to file a bug request to amend the limit? Thanks, Victor ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] applied: [PATCH http-server] increase max headers to 64 to cope with modern browsers + proxy combinations
This is mostly a "do not allow infinity headers" limit in the sense of "it's good to have limits". With modern browsers and users behind proxies we may actually get over 30 headers, so increase it for now to 64 - hopefully enough for another decade ;) Signed-off-by: Thomas Lamprecht Reported-by: Victor Hooi --- PVE/APIServer/AnyEvent.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm index efb8168..c55da7f 100644 --- a/PVE/APIServer/AnyEvent.pm +++ b/PVE/APIServer/AnyEvent.pm @@ -46,7 +46,7 @@ use HTTP::Response; use Data::Dumper; use JSON; -my $limit_max_headers = 30; +my $limit_max_headers = 64; my $limit_max_header_size = 8*1024; my $limit_max_post = 64*1024; @@ -1184,7 +1184,7 @@ sub unshift_read_header { eval { # print "$$: got header: $line\n" if $self->{debug}; - die "to many http header lines\n" if ++$state->{count} >= $limit_max_headers; + die "too many http header lines (> $limit_max_headers)\n" if ++$state->{count} >= $limit_max_headers; die "http header too large\n" if ($state->{size} += length($line)) >= $limit_max_header_size; my $r = $reqstate->{request}; -- 2.20.1 ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] Proxmox pveproxy - "to many http header lines" - issues with Cloudflare + latest Chrome
Hi, On 02.07.20 03:46, Victor Hooi wrote: > Hi, > > Google Chrome is rolling out some changes to headers (UA-CH - which causes > extra headers to be included), which seems to be unearthing some latent > issues with Proxmox. Dominik looked into this, and it seems that not only Chrome is at fault - current beta comes at ~16 Headers. But, with an Proxy in front it may come over 30 headers it seems. > From an old PVE/HTTPServer.pm, somebody mentioned it might be this line: > > https://github.com/proxmox/pve-manager/blob/master/PVE/HTTPServer.pm#L37 > > (I'm having trouble using the new git.proxmox.com interface to search the > code). It's rather the old git.proxmox.com, we never had anything else ;) > > Is there a specific reason the header limit is set to 30? Not so the special reason for the number 30, AFAIK, it's just that having limits it's good in a performance critical section like accepting connections, so that "bad actors" can be thrown out early. > If so, would it be possible to file a bug request to amend the limit? I increased it to 64 (2^6), it doubles the amount possible and as the total 8KiB header size is still in place one cannot really sent more data as headers, just more header lines. Thanks for reporting! cheers, Thomas ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH qemu] PVE-Backup: remove dirty-bitmap in pvebackup_complete_cb for failed jobs
it should also be possible to keep the old bitmap (and associated backup checksum) in this case? this is what bitmap-mode on-success is supposed to do, but maybe errors are not triggering the right code paths? On July 1, 2020 2:17 pm, Dietmar Maurer wrote: > Note: We remove the device from di_list, so pvebackup_co_cleanup does > not handle this case. > --- > pve-backup.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/pve-backup.c b/pve-backup.c > index 61a8b4d2a4..1c4f6cf9e0 100644 > --- a/pve-backup.c > +++ b/pve-backup.c > @@ -318,6 +318,12 @@ static void pvebackup_complete_cb(void *opaque, int ret) > // remove self from job queue > backup_state.di_list = g_list_remove(backup_state.di_list, di); > > +if (di->bitmap && ret < 0) { > +// on error or cancel we cannot ensure synchronization of dirty > +// bitmaps with backup server, so remove all and do full backup next > +bdrv_release_dirty_bitmap(di->bitmap); > +} > + > g_free(di); > > qemu_mutex_unlock(&backup_state.backup_mutex); > -- > 2.20.1 > > ___ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel