[pve-devel] [PATCH container] lxc: fall back to 'unmanaged' when no OS detected

2020-05-28 Thread Arnout Engelen
This is useful when the uploaded CT does not contain a full OS. When the
autodetection detects an OS, that OS is returned. When it does not
successfully detect a supported OS, but /etc/os-release exists and has an ID
other than 'unmanaged', then the setup fails.

Signed-off-by: Arnout Engelen 
---
 src/PVE/LXC/Setup.pm | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index c738e64..6ebd465 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -70,8 +70,12 @@ my $autodetect_type = sub {
return "alpine";
 } elsif (-f  "$rootdir/etc/gentoo-release") {
return "gentoo";
+} elsif (-f "$rootdir/etc/os-release") {
+   die "unable to detect OS distribution\n";
+} else {
+   warn "/etc/os-release file not found and autodetection failed, falling 
back to 'unmanaged'\n";
+   return "unmanaged";
 }
-die "unable to detect OS distribution\n";
 };
 
 sub new {
@@ -94,6 +98,11 @@ sub new {
if $type ne $expected_type;
 }
 
+if ($type eq 'unmanaged') {
+   $conf->{ostype} = $type;
+   return $self;
+}
+
 my $plugin_class = $plugins->{$type} ||
"no such OS type '$type'\n";
 
-- 
2.26.2

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] applied: Re: [PATCH widget-toolkit 1/2] Utils: add duration format/render

2020-05-28 Thread Thomas Lamprecht
On 5/28/20 1:02 PM, Dominik Csapak wrote:
> from pve-manager
> 
> Signed-off-by: Dominik Csapak 
> ---
>  Utils.js | 27 +++
>  1 file changed, 27 insertions(+)
> 
>

applied, but followed up/adapted the format_duration_short quite a bit.

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] [PATCH firewall 3/3] introduce new icmp-type parameter

2020-05-28 Thread Thomas Lamprecht
On 4/29/20 3:45 PM, Mira Limbeck wrote:
> Currently icmp types are handled via 'dport'. This is not documented
> anywhere except for a single line of comment in the code. To untangle
> the icmp-type handling from the dport handling a new 'icmp-type'
> parameter is introduced.
> 
> The valid 'icmp-type' values are limited to either the names
> (icmp[v6]_type_names hash in the code, same as ip[6]tables provides) or
> the combination of type and optional code (e.g. '3/0' for 
> network-unreachable).
> As both type and code can be values between 0 and 255, though not all
> valid combinations, the checks limit it to range between 0/0 and
> 255/255.
> 
> Support for ipv6-icmp is added to icmp-type parameter handling. This makes it
> possible to specify icmpv6 types via the GUI.
> 
> Signed-off-by: Mira Limbeck 
> ---
>  src/PVE/API2/Firewall/Rules.pm |  4 +++
>  src/PVE/Firewall.pm| 63 --
>  2 files changed, 64 insertions(+), 3 deletions(-)
> 

Would you please rebase this on current master?


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH qemu-server] fix #2748: make order of interfaces consistent

2020-05-28 Thread Mira Limbeck
As perl hashes have random order, sort them before iterating through.
This makes the output of 'qm cloudinit dump  network' consistent
between calls if the config has not changed.

Signed-off-by: Mira Limbeck 
---
 PVE/QemuServer/Cloudinit.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
index b3ae57b..439de99 100644
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm
@@ -172,7 +172,7 @@ sub configdrive2_network {
 }
 
 my @ifaces = grep(/^net(\d+)$/, keys %$conf);
-foreach my $iface (@ifaces) {
+foreach my $iface (sort @ifaces) {
(my $id = $iface) =~ s/^net//;
next if !$conf->{"ipconfig$id"};
my $net = PVE::QemuServer::parse_ipconfig($conf->{"ipconfig$id"});
@@ -252,7 +252,7 @@ sub nocloud_network_v2 {
 my $dns_done;
 
 my @ifaces = grep(/^net(\d+)$/, keys %$conf);
-foreach my $iface (@ifaces) {
+foreach my $iface (sort @ifaces) {
(my $id = $iface) =~ s/^net//;
next if !$conf->{"ipconfig$id"};
 
@@ -323,7 +323,7 @@ sub nocloud_network {
 . "config:\n";
 
 my @ifaces = grep(/^net(\d+)$/, keys %$conf);
-foreach my $iface (@ifaces) {
+foreach my $iface (sort @ifaces) {
(my $id = $iface) =~ s/^net//;
next if !$conf->{"ipconfig$id"};
 
-- 
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 manager 2/2] error message on failed config dump command

2020-05-28 Thread Alwin Antreich
Prior Ceph Nautilus the ceph config dump command was not available.
This patch provides a more meaningful info for the user.

Signed-off-by: Alwin Antreich 
---
 PVE/API2/Ceph.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index afc1bdbd..fc4ee535 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -231,7 +231,8 @@ __PACKAGE__->register_method ({
PVE::Ceph::Tools::check_ceph_inited();
 
my $rados = PVE::RADOS->new();
-   my $res = $rados->mon_command( { prefix => 'config dump', format => 
'json' });
+   my $res = eval { $rados->mon_command( { prefix => 'config dump', format 
=> 'json' }) };
+   die "ceph config dump not available, $@\n" if $@;
foreach my $entry (@$res) {
$entry->{can_update_at_runtime} = $entry->{can_update_at_runtime}? 
1 : 0; # JSON::true/false -> 1/0
}
-- 
2.26.2


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH manager 1/2] Make PVE6 compatible with supported ceph versions

2020-05-28 Thread Alwin Antreich
Luminous, Nautilus and Octopus. In Octopus the mon_status was dropped.
Also the ceph status was cleaned up and doesn't provide the mgrmap and
monmap.

The rados queries used in the ceph status API endpoints (cluster / node)
were factored out and merged to one place.

Signed-off-by: Alwin Antreich 
---
note: as discussed off-list with Dominik, the status API call could also
  be split into multiple API calls. To provide mgrmap, monmap and
  status separately.

 PVE/API2/Ceph.pm  |  5 +
 PVE/API2/Ceph/MON.pm  |  6 +++---
 PVE/API2/Ceph/OSD.pm  |  2 +-
 PVE/API2/Cluster/Ceph.pm  |  5 +
 PVE/Ceph/Tools.pm | 13 +
 www/manager6/ceph/StatusDetail.js |  7 ---
 6 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 85a04101..afc1bdbd 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -580,10 +580,7 @@ __PACKAGE__->register_method ({
 
PVE::Ceph::Tools::check_ceph_inited();
 
-   my $rados = PVE::RADOS->new();
-   my $status = $rados->mon_command({ prefix => 'status' });
-   $status->{health} = $rados->mon_command({ prefix => 'health', detail => 
'detail' });
-   return $status;
+   return PVE::Ceph::Tools::ceph_cluster_status();
 }});
 
 __PACKAGE__->register_method ({
diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm
index 3baeac52..b33b8700 100644
--- a/PVE/API2/Ceph/MON.pm
+++ b/PVE/API2/Ceph/MON.pm
@@ -130,7 +130,7 @@ __PACKAGE__->register_method ({
my $monhash = PVE::Ceph::Services::get_services_info("mon", $cfg, 
$rados);
 
if ($rados) {
-   my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+   my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
 
my $mons = $monstat->{monmap}->{mons};
foreach my $d (@$mons) {
@@ -338,7 +338,7 @@ __PACKAGE__->register_method ({
my $monsection = "mon.$monid";
 
my $rados = PVE::RADOS->new();
-   my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+   my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
my $monlist = $monstat->{monmap}->{mons};
my $monhash = PVE::Ceph::Services::get_services_info('mon', $cfg, 
$rados);
 
@@ -356,7 +356,7 @@ __PACKAGE__->register_method ({
# reopen with longer timeout
$rados = PVE::RADOS->new(timeout => 
PVE::Ceph::Tools::get_config('long_rados_timeout'));
$monhash = PVE::Ceph::Services::get_services_info('mon', $cfg, 
$rados);
-   $monstat = $rados->mon_command({ prefix => 'mon_status' });
+   $monstat = $rados->mon_command({ prefix => 'quorum_status' });
$monlist = $monstat->{monmap}->{mons};
 
my $addr;
diff --git a/PVE/API2/Ceph/OSD.pm b/PVE/API2/Ceph/OSD.pm
index a514c502..ceaed129 100644
--- a/PVE/API2/Ceph/OSD.pm
+++ b/PVE/API2/Ceph/OSD.pm
@@ -344,7 +344,7 @@ __PACKAGE__->register_method ({
 
# get necessary ceph infos
my $rados = PVE::RADOS->new();
-   my $monstat = $rados->mon_command({ prefix => 'mon_status' });
+   my $monstat = $rados->mon_command({ prefix => 'quorum_status' });
 
die "unable to get fsid\n" if !$monstat->{monmap} || 
!$monstat->{monmap}->{fsid};
my $fsid = $monstat->{monmap}->{fsid};
diff --git a/PVE/API2/Cluster/Ceph.pm b/PVE/API2/Cluster/Ceph.pm
index e18d421e..c0277221 100644
--- a/PVE/API2/Cluster/Ceph.pm
+++ b/PVE/API2/Cluster/Ceph.pm
@@ -142,10 +142,7 @@ __PACKAGE__->register_method ({
 
PVE::Ceph::Tools::check_ceph_inited();
 
-   my $rados = PVE::RADOS->new();
-   my $status = $rados->mon_command({ prefix => 'status' });
-   $status->{health} = $rados->mon_command({ prefix => 'health', detail => 
'detail' });
-   return $status;
+   return PVE::Ceph::Tools::ceph_cluster_status();
 }
 });
 
diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
index 3273c7d1..b4a83f2e 100644
--- a/PVE/Ceph/Tools.pm
+++ b/PVE/Ceph/Tools.pm
@@ -468,4 +468,17 @@ sub get_real_flag_name {
 return $flagmap->{$flag} // $flag;
 }
 
+sub ceph_cluster_status {
+my ($rados) = @_;
+$rados = PVE::RADOS->new() if !$rados;
+
+my $status = $rados->mon_command({ prefix => 'status' });
+
+$status->{health} = $rados->mon_command({ prefix => 'health', detail => 
'detail' });
+$status->{monmap} = $rados->mon_command({ prefix => 'mon dump' });
+$status->{mgrmap} = $rados->mon_command({ prefix => 'mgr dump' });
+
+return $status;
+}
+
 1;
diff --git a/www/manager6/ceph/StatusDetail.js 
b/www/manager6/ceph/StatusDetail.js
index 8185e3bb..6561eba3 100644
--- a/www/manager6/ceph/StatusDetail.js
+++ b/www/manager6/ceph/StatusDetail.js
@@ -263,9 +263,10 @@ Ext.define('PVE.ceph.StatusDetail', {
 
// update osds counts
 
-   var total_osds = osdmap.osdmap.num_osds || 0;
-   var in_osds = osdmap.osdmap.num_i

[pve-devel] [PATCH container] fix #1423: set container timezone to match host in post-create

2020-05-28 Thread Oguz Bektas
we cache the /etc/localtime symlink path from the node and set it in the
container rootfs if zone file exists in the container

Signed-off-by: Oguz Bektas 
---
 src/PVE/LXC/Setup.pm  |  3 +++
 src/PVE/LXC/Setup/Base.pm | 20 +---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index c738e64..929f75b 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -5,6 +5,8 @@ use warnings;
 use POSIX;
 use PVE::Tools;
 
+use Cwd 'abs_path';
+
 use PVE::LXC::Setup::Debian;
 use PVE::LXC::Setup::Ubuntu;
 use PVE::LXC::Setup::CentOS;
@@ -103,6 +105,7 @@ sub new {
 
 # Cache some host files we need access to:
 $plugin->{host_resolv_conf} = PVE::INotify::read_file('resolvconf');
+$plugin->{host_localtime} = abs_path('/etc/localtime');
 
 # pass on user namespace information:
 my ($id_map, $rootuid, $rootgid) = PVE::LXC::parse_id_maps($conf);
diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
index 93dace7..e94e802 100644
--- a/src/PVE/LXC/Setup/Base.pm
+++ b/src/PVE/LXC/Setup/Base.pm
@@ -451,6 +451,19 @@ my $randomize_crontab = sub {
}
 };
 
+sub set_timezone {
+my ($self) = @_;
+
+my $zoneinfo = $self->{host_localtime};
+
+($zoneinfo) = $zoneinfo =~ m/^(.*)$/; # untaint
+
+if ($self->ct_file_exists($zoneinfo)) {
+   $self->ct_unlink("/etc/localtime");
+   $self->ct_symlink($zoneinfo, "/etc/localtime");
+}
+}
+
 sub pre_start_hook {
 my ($self, $conf) = @_;
 
@@ -466,16 +479,17 @@ sub post_create_hook {
 my ($self, $conf, $root_password, $ssh_keys) = @_;
 
 $self->template_fixup($conf);
-
+
 &$randomize_crontab($self, $conf);
-
+
 $self->set_user_password($conf, 'root', $root_password);
 $self->set_user_authorized_ssh_keys($conf, 'root', $ssh_keys) if $ssh_keys;
 $self->setup_init($conf);
 $self->setup_network($conf);
 $self->set_hostname($conf);
 $self->set_dns($conf);
-
+$self->set_timezone();
+
 # fixme: what else ?
 }
 
-- 
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 kernel v2] add pve-kernel-libc-dev headers package

2020-05-28 Thread Thomas Lamprecht
This was long overdue, allows to access the full feature set of our
kernel for some tools using the Linux API directly.

Packaging mostly taken from Debian[0]

[0]: 
https://salsa.debian.org/kernel-team/linux/-/blob/debian/4.19.118-2/debian/rules.real#L367

Signed-off-by: Thomas Lamprecht 
Reviewed-By: Fabian Grünbichler 
---

changes v1 -> v2:
* dropped Kernel maj.minor from package name
* added Fabians R-b tag, thanks!

 debian/control.in | 12 
 debian/rules  | 22 --
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/debian/control.in b/debian/control.in
index 9b807c1d40c5..b9809f16c97d 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -69,3 +69,15 @@ Depends: busybox,
 Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub-efi-arm64,
 Description: The Proxmox PVE Kernel Image
  This package contains the linux kernel and initial ramdisk used for booting
+
+Package: pve-kernel-libc-dev
+Section: devel
+Priority: optional
+Architecture: any
+Provides: linux-libc-dev,
+Conflicts: linux-libc-dev,
+Replaces: linux-libc-dev,
+Depends: ${misc:Depends}
+Description: Linux support headers for userspace development
+ This package provides userspaces headers from the Linux kernel.  These headers
+ are used by the installed headers for GNU libc and other system libraries.
diff --git a/debian/rules b/debian/rules
index e530eb548707..f531ac5fd80c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,6 +15,7 @@ CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate)
 
 PVE_KERNEL_PKG=pve-kernel-${KVNAME}
 PVE_HEADER_PKG=pve-headers-${KVNAME}
+PVE_USR_HEADER_PKG=pve-kernel-libc-dev
 LINUX_TOOLS_PKG=linux-tools-${KERNEL_MAJMIN}
 KERNEL_SRC_COPY=${KERNEL_SRC}_tmp
 
@@ -87,7 +88,7 @@ debian/control: $(wildcard debian/*.in)
 
 build: .compile_mark .tools_compile_mark .modules_compile_mark
 
-install: .install_mark .tools_install_mark .headers_install_mark
+install: .install_mark .tools_install_mark .headers_install_mark 
.usr_headers_install_mark
dh_installdocs -A debian/copyright debian/SOURCE
dh_installchangelogs
dh_installman
@@ -97,7 +98,7 @@ install: .install_mark .tools_install_mark 
.headers_install_mark
 
 binary: install
debian/rules fwcheck abicheck
-   dh_strip -N${PVE_HEADER_PKG}
+   dh_strip -N${PVE_HEADER_PKG} -N${PVE_USR_HEADER_PKG}
dh_makeshlibs
dh_shlibdeps
dh_installdeb
@@ -207,6 +208,23 @@ binary: install
ln -sf /usr/src/linux-headers-${KVNAME} 
debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}/build
touch $@
 
+.usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG}
+.usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr
+.usr_headers_install_mark: .config_mark
+   rm -rf '${PKG_DIR}'
+   mkdir -p  '${PKG_DIR}'
+   $(MAKE) -C ${KERNEL_SRC} headers_check ARCH=$(KERNEL_HEADER_ARCH)
+   $(MAKE) -C ${KERNEL_SRC} headers_install ARCH=$(KERNEL_HEADER_ARCH) 
INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
+   rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
+   find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) 
-execdir rm {} +
+
+# Move include/asm to arch-specific directory
+   mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
+   mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+   test ! -d $(OUT_DIR)/include/arch || \
+   mv $(OUT_DIR)/include/arch 
$(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
+   touch $@
+
 .modules_compile_mark: ${MODULES}/zfs.ko
touch $@
 
-- 
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-series: Re: [PATCH qemu 0/4] Fix vmstate-snapshots w/ iothread=1

2020-05-28 Thread Thomas Lamprecht
On 5/27/20 11:33 AM, Stefan Reiter wrote:
> Once again, iothreads making trouble. When enabled, snapshots including RAM
> deadlock QEMU, because our async-snapshot implementation (which recently moved
> back to using coroutines) tries to access and modify the state of disks 
> running
> in seperate iothreads from the main one.
> 
> Patch 1/4 fixes the issue and can be applied standalone, patches 2 and 3 
> improve
> snapshot performance for iothread-disks and patch 4 adds some useful debug
> prints for testing the aforementioned performance patches. See individual 
> patch
> notes for more.
> 
> For easier reviewing I sent the patches for the QEMU source itself, if 
> necessary
> I can also apply them and then send pve-qemu patches including them as .patch
> files.
> 
> Kevin Wolf (1):
>   util/async: Add aio_co_reschedule_self()
> 
> Stefan Reiter (3):
>   savevm-async: move more code to cleanup and rename to finalize
>   savevm-async: flush IOThread-drives async before entering blocking
> part
>   savevm-async: add debug timing prints
> 
>  include/block/aio.h |  10 
>  savevm-async.c  | 124 +++-
>  util/async.c|  30 +++
>  3 files changed, 129 insertions(+), 35 deletions(-)
> 



applied series, thanks! Adapted the last patch to avoid the unused variable 
errors
if the debug parameter wasn't defined.

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [pve-network 2/3] vlan: ovs: use dot1q-tunnel when vlanaware is enabled

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 PVE/Network/SDN/Zones/VlanPlugin.pm | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm 
b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 8364451..987c553 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -61,7 +61,12 @@ sub generate_sdn_config {
@iface_config = ();
push @iface_config, "ovs_type OVSIntPort";
push @iface_config, "ovs_bridge $bridge";
-   push @iface_config, "ovs_options tag=$tag";
+   if($vnet->{vlanaware}) {
+   push @iface_config, "ovs_options vlan_mode=dot1q-tunnel tag=$tag";
+   } else {
+   push @iface_config, "ovs_options tag=$tag";
+   }
+
push(@{$config->{$vnet_uplink}}, @iface_config) if 
!$config->{$vnet_uplink};
 
@iface_config = ();
-- 
2.20.1

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [pve-network 3/3] qinq|vlan: ovs: add ovsint interfaces to ovs-ports list

2020-05-28 Thread Alexandre Derumier
if not, on reload, interfaces are unplug/replugged with packet
loss.

Signed-off-by: Alexandre Derumier 
---
 PVE/Network/SDN/Zones/QinQPlugin.pm | 4 
 PVE/Network/SDN/Zones/VlanPlugin.pm | 6 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm 
b/PVE/Network/SDN/Zones/QinQPlugin.pm
index 9077713..e3423ef 100644
--- a/PVE/Network/SDN/Zones/QinQPlugin.pm
+++ b/PVE/Network/SDN/Zones/QinQPlugin.pm
@@ -73,6 +73,10 @@ sub generate_sdn_config {
push @iface_config, "ovs_options vlan_mode=dot1q-tunnel tag=$stag 
other_config:qinq-ethtype=$vlanprotocol";
push(@{$config->{$svlan_iface}}, @iface_config) if 
!$config->{$svlan_iface};
 
+   #redefine main ovs bridge, ifupdown2 will merge ovs_ports
+   @iface_config = ();
+   push @iface_config, "ovs_ports $svlan_iface";
+   push(@{$config->{$bridge}}, @iface_config); 
 
#zone vlan aware bridge
@iface_config = ();
diff --git a/PVE/Network/SDN/Zones/VlanPlugin.pm 
b/PVE/Network/SDN/Zones/VlanPlugin.pm
index 987c553..aeff1a4 100644
--- a/PVE/Network/SDN/Zones/VlanPlugin.pm
+++ b/PVE/Network/SDN/Zones/VlanPlugin.pm
@@ -66,9 +66,13 @@ sub generate_sdn_config {
} else {
push @iface_config, "ovs_options tag=$tag";
}
-
push(@{$config->{$vnet_uplink}}, @iface_config) if 
!$config->{$vnet_uplink};
 
+   #redefine main ovs bridge, ifupdown2 will merge ovs_ports
+   @iface_config = ();
+   push @iface_config, "ovs_ports $vnet_uplink";
+   push(@{$config->{$bridge}}, @iface_config);
+
@iface_config = ();
push @iface_config, "ovs_type OVSBridge";
push @iface_config, "ovs_ports $vnet_uplink";
-- 
2.20.1

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [pve-network 0/3] vlanaware vnets

2020-05-28 Thread Alexandre Derumier
This ass support for vlan-aware vnets.
patch1 && 2 were already submit on the mailing

patch3 is a small fix to avoid packet lost on reload
with ovs + qinq|vlan plugins


Alexandre Derumier (3):
  add vnet vlan-aware option
  vlan: ovs: use dot1q-tunnel when vlanaware is enabled
  qinq|vlan: ovs: add ovsint interfaces to ovs-ports list

 PVE/Network/SDN/VnetPlugin.pm|  5 +
 PVE/Network/SDN/Zones.pm | 14 +
 PVE/Network/SDN/Zones/EvpnPlugin.pm  |  1 +
 PVE/Network/SDN/Zones/Plugin.pm  | 31 +---
 PVE/Network/SDN/Zones/QinQPlugin.pm  |  8 +++
 PVE/Network/SDN/Zones/VlanPlugin.pm  | 15 +-
 PVE/Network/SDN/Zones/VxlanPlugin.pm |  4 
 7 files changed, 38 insertions(+), 40 deletions(-)

-- 
2.20.1

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [pve-network 1/3] add vnet vlan-aware option

2020-05-28 Thread Alexandre Derumier
Some users would like to be able to defined vlans at
vm level, or allow trunks,  on top of already
tagged vnet. (including vlan on top of vxlan tunnel)

Allow it on all layer2 plugins, and add a warn
for evpn layer3 plugin.

Signed-off-by: Alexandre Derumier 
---
 PVE/Network/SDN/VnetPlugin.pm|  5 +
 PVE/Network/SDN/Zones.pm | 14 +
 PVE/Network/SDN/Zones/EvpnPlugin.pm  |  1 +
 PVE/Network/SDN/Zones/Plugin.pm  | 31 +---
 PVE/Network/SDN/Zones/QinQPlugin.pm  |  4 
 PVE/Network/SDN/Zones/VlanPlugin.pm  |  4 
 PVE/Network/SDN/Zones/VxlanPlugin.pm |  4 
 7 files changed, 24 insertions(+), 39 deletions(-)

diff --git a/PVE/Network/SDN/VnetPlugin.pm b/PVE/Network/SDN/VnetPlugin.pm
index 179bfa4..2433013 100644
--- a/PVE/Network/SDN/VnetPlugin.pm
+++ b/PVE/Network/SDN/VnetPlugin.pm
@@ -58,6 +58,10 @@ sub properties {
 type => 'integer',
 description => "vlan or vxlan id",
},
+   vlanaware => {
+   type => 'boolean',
+   description => 'Allow vm VLANs to pass through this vnet.',
+   },
 alias => {
 type => 'string',
 description => "alias name of the vnet",
@@ -89,6 +93,7 @@ sub options {
 ipv4 => { optional => 1 },
 ipv6 => { optional => 1 },
 mac => { optional => 1 },
+vlanaware => { optional => 1 },
 };
 }
 
diff --git a/PVE/Network/SDN/Zones.pm b/PVE/Network/SDN/Zones.pm
index 436b103..b8dc54c 100644
--- a/PVE/Network/SDN/Zones.pm
+++ b/PVE/Network/SDN/Zones.pm
@@ -214,18 +214,6 @@ sub status {
 return($zone_status, $vnet_status);
 }
 
-sub get_bridge_vlan {
-my ($vnetid) = @_;
-
-my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
-
-return ($vnetid, undef) if !$vnet; # fallback for classic bridge
-
-my $plugin_config = get_plugin_config($vnet);
-my $plugin = 
PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
-return $plugin->get_bridge_vlan($plugin_config, $vnetid, $vnet->{tag});
-}
-
 sub tap_create {
 my ($iface, $bridge) = @_;
 
@@ -270,7 +258,7 @@ sub tap_plug {
if $plugin_config->{nodes} && 
!defined($plugin_config->{nodes}->{$nodename});
 
 my $plugin = 
PVE::Network::SDN::Zones::Plugin->lookup($plugin_config->{type});
-$plugin->tap_plug($plugin_config, $vnet, $iface, $bridge, $firewall, 
$rate);
+$plugin->tap_plug($plugin_config, $vnet, $tag, $iface, $bridge, $firewall, 
$trunks, $rate);
 }
 
 1;
diff --git a/PVE/Network/SDN/Zones/EvpnPlugin.pm 
b/PVE/Network/SDN/Zones/EvpnPlugin.pm
index 973e8e0..95fbb64 100644
--- a/PVE/Network/SDN/Zones/EvpnPlugin.pm
+++ b/PVE/Network/SDN/Zones/EvpnPlugin.pm
@@ -50,6 +50,7 @@ sub generate_sdn_config {
 my $vrfvxlan = $plugin_config->{'vrf-vxlan'};
 
 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 ($ifaceip, $iface) = 
PVE::Network::SDN::Zones::Plugin::find_local_ip_interface_peers(\@peers);
diff --git a/PVE/Network/SDN/Zones/Plugin.pm b/PVE/Network/SDN/Zones/Plugin.pm
index 9ea7a50..0633b78 100644
--- a/PVE/Network/SDN/Zones/Plugin.pm
+++ b/PVE/Network/SDN/Zones/Plugin.pm
@@ -205,44 +205,23 @@ sub status {
 }
 
 
-sub get_bridge_vlan {
-my ($class, $plugin_config, $vnetid, $tag) = @_;
-
-my $bridge = $vnetid;
-$tag = undef;
-
-die "bridge $bridge is missing" if !-d "/sys/class/net/$bridge/";
-
-return ($bridge, $tag);
-}
-
 sub tap_create {
 my ($class, $plugin_config, $vnet, $iface, $vnetid) = @_;
 
-my $tag = $vnet->{tag};
-my ($bridge, undef) = $class->get_bridge_vlan($plugin_config, $vnetid, 
$tag);
-die "unable to get bridge setting\n" if !$bridge;
-
-PVE::Network::tap_create($iface, $bridge);
+PVE::Network::tap_create($iface, $vnetid);
 }
 
 sub veth_create {
 my ($class, $plugin_config, $vnet, $veth, $vethpeer, $vnetid, $hwaddr) = 
@_;
 
-my $tag = $vnet->{tag};
-my ($bridge, undef) = $class->get_bridge_vlan($plugin_config, $vnetid, 
$tag);
-die "unable to get bridge setting\n" if !$bridge;
-
-PVE::Network::veth_create($veth, $vethpeer, $bridge, $hwaddr);
+PVE::Network::veth_create($veth, $vethpeer, $vnetid, $hwaddr);
 }
 
 sub tap_plug {
-my ($class, $plugin_config, $vnet, $iface, $vnetid, $firewall, $rate) = @_;
-
-my $tag = $vnet->{tag};
+my ($class, $plugin_config, $vnet, $tag, $iface, $vnetid, $firewall, 
$trunks, $rate) = @_;
 
-($vnetid, $tag) = $class->get_bridge_vlan($plugin_config, $vnetid, $tag);
-my $trunks = undef;
+my $vlan_aware = 
PVE::Tools::file_read_firstline("/sys/class/net/$vnetid/bridge/vlan_filtering");
+die "vm vlans are not allowed on vnet $vnetid" if !$vlan_aware && ($tag || 
$trunks);
 
 PVE::Network::tap_plug($iface, $vnetid, $tag, $firewall, $trunks, $rate);
 }
diff --git a/PVE/Network/SDN/Zones/QinQPlugin.pm 
b/PVE/Network

[pve-devel] [PATCH ifupdown2 3/9] rebase 0007-networking.service-fix-dependencies-and-ordering.patch

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 service-fix-dependencies-and-ordering.patch | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git 
a/debian/patches/pve/0007-networking.service-fix-dependencies-and-ordering.patch
 
b/debian/patches/pve/0007-networking.service-fix-dependencies-and-ordering.patch
index 1c49ccd..66d1e18 100644
--- 
a/debian/patches/pve/0007-networking.service-fix-dependencies-and-ordering.patch
+++ 
b/debian/patches/pve/0007-networking.service-fix-dependencies-and-ordering.patch
@@ -1,4 +1,4 @@
-From 0aa90eb35e22ca156f6ab8fafd30071211bc3e50 Mon Sep 17 00:00:00 2001
+From e8ce294b4db6039216b72e353a51d1bac0c5313d Mon Sep 17 00:00:00 2001
 From: Thomas Lamprecht 
 Date: Thu, 30 Jan 2020 12:48:23 +0100
 Subject: [PATCH] networking.service: fix dependencies and ordering
@@ -17,14 +17,14 @@ ONCE!!
 Signed-off-by: Thomas Lamprecht 
 ---
  debian/ifupdown2-pre.service| 13 +
- debian/ifupdown2.networking.service |  7 +--
+ debian/ifupdown2.networking.service |  8 ++--
  debian/rules|  1 +
- 3 files changed, 19 insertions(+), 2 deletions(-)
+ 3 files changed, 20 insertions(+), 2 deletions(-)
  create mode 100644 debian/ifupdown2-pre.service
 
 diff --git a/debian/ifupdown2-pre.service b/debian/ifupdown2-pre.service
 new file mode 100644
-index 000..f0fb308
+index 000..b129a62
 --- /dev/null
 +++ b/debian/ifupdown2-pre.service
 @@ -0,0 +1,13 @@
@@ -42,7 +42,7 @@ index 000..f0fb308
 +EnvironmentFile=-/etc/default/networking
 +ExecStart=/bin/udevadm settle
 diff --git a/debian/ifupdown2.networking.service 
b/debian/ifupdown2.networking.service
-index b2acd97..8f54dc6 100644
+index 32f21f6..a49d1ba 100644
 --- a/debian/ifupdown2.networking.service
 +++ b/debian/ifupdown2.networking.service
 @@ -2,8 +2,11 @@
@@ -58,14 +58,15 @@ index b2acd97..8f54dc6 100644
  
  [Service]
  Type=oneshot
-@@ -15,4 +18,4 @@ ExecStop=/sbin/ifdown -a
- ExecReload=/sbin/ifreload -a
+@@ -16,4 +19,5 @@ ExecStop=/usr/share/ifupdown2/sbin/start-networking stop
+ ExecReload=/usr/share/ifupdown2/sbin/start-networking reload
  
  [Install]
 -WantedBy=basic.target network.target shutdown.target
 +WantedBy=multi-user.target network-online.target
++
 diff --git a/debian/rules b/debian/rules
-index 6274b3a..9168c08 100755
+index ea6f434..fcb304f 100755
 --- a/debian/rules
 +++ b/debian/rules
 @@ -15,6 +15,7 @@ override_dh_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] [PATCH ifupdown2 7/9] add extra patch: 0004-fix-start-networking-permission.patch

2020-05-28 Thread Alexandre Derumier
https://github.com/CumulusNetworks/ifupdown2/commit/5cbe13d17a28e1ce4a411092f0bd659360406572
Signed-off-by: Alexandre Derumier 
---
 .../0004-fix-start-networking-permission.patch  | 13 +
 debian/patches/series   |  1 +
 2 files changed, 14 insertions(+)
 create mode 100644 
debian/patches/extra/0004-fix-start-networking-permission.patch

diff --git a/debian/patches/extra/0004-fix-start-networking-permission.patch 
b/debian/patches/extra/0004-fix-start-networking-permission.patch
new file mode 100644
index 000..5357e31
--- /dev/null
+++ b/debian/patches/extra/0004-fix-start-networking-permission.patch
@@ -0,0 +1,13 @@
+From 5cbe13d17a28e1ce4a411092f0bd659360406572 Mon Sep 17 00:00:00 2001
+From: bauen1 
+Date: Fri, 15 May 2020 17:16:04 +0200
+Subject: [PATCH] allow systemd to execute the helper script
+
+---
+ ifupdown2/sbin/start-networking | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ mode change 100644 => 100755 ifupdown2/sbin/start-networking
+
+diff --git a/ifupdown2/sbin/start-networking b/ifupdown2/sbin/start-networking
+old mode 100644
+new mode 100755
diff --git a/debian/patches/series b/debian/patches/series
index e6a1270..92b4af5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,7 @@
 extra/0001-ovs-ovs-ports-condone-regex.patch
 extra/0002-nllistener-increase-buffer.patch
 extra/0003-ovs-multiple-ovsport.patch
+extra/0004-fix-start-networking-permission.patch
 pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
 pve/0002-add-dummy-mtu-bridgevlanport-modules.patch
 pve/0003-allow-vlan-subinterface-in-a-vlan-aware-bridge.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] [PATCH ifupdown2 6/9] add extra patch: 0003-ovs-multiple-ovsport.patch

2020-05-28 Thread Alexandre Derumier
https://github.com/CumulusNetworks/ifupdown2/pull/164
Signed-off-by: Alexandre Derumier 
---
 .../extra/0003-ovs-multiple-ovsport.patch | 53 +++
 debian/patches/series |  1 +
 2 files changed, 54 insertions(+)
 create mode 100644 debian/patches/extra/0003-ovs-multiple-ovsport.patch

diff --git a/debian/patches/extra/0003-ovs-multiple-ovsport.patch 
b/debian/patches/extra/0003-ovs-multiple-ovsport.patch
new file mode 100644
index 000..bb18056
--- /dev/null
+++ b/debian/patches/extra/0003-ovs-multiple-ovsport.patch
@@ -0,0 +1,53 @@
+From 6cdb2b3d220fdf60ea8d0a2982a90c583dec467e Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier 
+Date: Thu, 28 May 2020 11:21:55 +0200
+Subject: [PATCH] addons: openvswitch: allow multiple ovs-ports + glob/regex
+
+---
+ ifupdown2/addons/openvswitch.py | 18 +++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/ifupdown2/addons/openvswitch.py b/ifupdown2/addons/openvswitch.py
+index 468d7df..936c871 100644
+--- a/ifupdown2/addons/openvswitch.py
 b/ifupdown2/addons/openvswitch.py
+@@ -37,6 +37,12 @@ class openvswitch(Addon, moduleBase):
+ 'help': 'Interfaces to be part of this ovs bridge.',
+ 'validvals': [''],
+ 'required': False,
++"multivalue": True,
++"example": [
++"ovs-ports swp1.100 swp2.100 swp3.100",
++"ovs-ports glob swp1-3.100",
++"ovs-ports regex (swp[1|2|3].100)"
++]
+ },
+ 'ovs-type': {
+ 'help': 'ovs interface type',
+@@ -87,10 +93,15 @@ def _is_ovs_bridge (self, ifaceobj):
+ return False
+ 
+ def _get_ovs_ports (self, ifaceobj):
+-ovs_ports = ifaceobj.get_attr_value_first('ovs-ports')
++ovs_ports = []
++
++for port in ifaceobj.get_attr_value('ovs-ports') or []:
++ovs_ports.extend(port.split())
++
+ if ovs_ports:
+-return sorted (ovs_ports.split ())
+-return None
++return self.parse_port_list(ifaceobj.name, ' '.join(ovs_ports))
++else:
++return None
+ 
+ def _get_running_ovs_ports (self, iface):
+ output = utils.exec_command("/usr/bin/ovs-vsctl list-ports %s" %iface)
+@@ -152,6 +163,7 @@ def _addbridge (self, ifaceobj):
+ ovs_ports = self._get_ovs_ports(ifaceobj)
+ running_ovs_ports = self._get_running_ovs_ports(iface)
+ 
++missingports = []
+ if running_ovs_ports is not None and ovs_ports is not None:
+ missingports = list(set(running_ovs_ports) - set(ovs_ports))
+ 
diff --git a/debian/patches/series b/debian/patches/series
index e57723c..e6a1270 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,6 @@
 extra/0001-ovs-ovs-ports-condone-regex.patch
 extra/0002-nllistener-increase-buffer.patch
+extra/0003-ovs-multiple-ovsport.patch
 pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
 pve/0002-add-dummy-mtu-bridgevlanport-modules.patch
 pve/0003-allow-vlan-subinterface-in-a-vlan-aware-bridge.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] [PATCH ifupdown2 0/9] 3.0.0-1 version

2020-05-28 Thread Alexandre Derumier
Hi,

This patch series update ifupdown2 to 3.0.0-1.

Please bump the proxmox git mirror to 3.0.0-1 tag.

Main change  python2 to python3 conversion.

I have tested it since 2 weeks with differents sdn setup,
I don't have seen regression. 


I have added extra patches from master branch, on top
of 3.0.0-1 tag. 

They are some fix for ovs plugin, and some new interfaces
like veth pair are supported too. (I need them for sdn).



Alexandre Derumier (9):
  remove extra patches
  rebase 0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
  rebase 0007-networking.service-fix-dependencies-and-ordering.patch
  remove 0008-add-openvswitch-addon.patch
  add extra patch: 0002-nllistener-increase-buffer.patch
  add extra patch: 0003-ovs-multiple-ovsport.patch
  add extra patch: 0004-fix-start-networking-permission.patch
  control: update python3
  changelog: bump to 3.0.0-1

 debian/changelog  |   6 +
 debian/control|  13 +-
 ...g-option-to-common_argparse-to-avoid.patch |  44 --
 .../0001-ovs-ovs-ports-condone-regex.patch|  66 ++
 .../extra/0002-fix-default-forwarding.patch   | 100 ---
 .../0002-nllistener-increase-buffer.patch |  25 +
 .../extra/0003-ovs-multiple-ovsport.patch |  53 ++
 ...0004-fix-start-networking-permission.patch |  13 +
 ...-veth-fwpr-interfaces-from-bridge-on.patch |  29 +-
 ...ervice-fix-dependencies-and-ordering.patch |  17 +-
 .../pve/0008-add-openvswitch-addon.patch  | 595 --
 debian/patches/series |   7 +-
 12 files changed, 191 insertions(+), 777 deletions(-)
 delete mode 100644 
debian/patches/extra/0001-argv-move-nldebug-option-to-common_argparse-to-avoid.patch
 create mode 100644 debian/patches/extra/0001-ovs-ovs-ports-condone-regex.patch
 delete mode 100644 debian/patches/extra/0002-fix-default-forwarding.patch
 create mode 100644 debian/patches/extra/0002-nllistener-increase-buffer.patch
 create mode 100644 debian/patches/extra/0003-ovs-multiple-ovsport.patch
 create mode 100644 
debian/patches/extra/0004-fix-start-networking-permission.patch
 delete mode 100644 debian/patches/pve/0008-add-openvswitch-addon.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] [PATCH ifupdown2 2/9] rebase 0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 ...-veth-fwpr-interfaces-from-bridge-on.patch | 29 +--
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git 
a/debian/patches/pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
 
b/debian/patches/pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
index 869f0f3..36b256e 100644
--- 
a/debian/patches/pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
+++ 
b/debian/patches/pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
@@ -1,43 +1,30 @@
-From 874ba884a7ff8f0059e069aac2855c2ffd5cacd2 Mon Sep 17 00:00:00 2001
+From e048d4f3c6516c4b7519112de13f79f70d56d44b Mon Sep 17 00:00:00 2001
 From: Alexandre Derumier 
 Date: Wed, 16 May 2018 02:11:45 +0200
-Subject: [PATCH 1/7] don't remove (tap|veth|fwpr) interfaces from bridge on
- ifup bridge
+Subject: [PATCH] don't remove (tap|veth|fwpr) interfaces from bridge on ifup
+ bridge
 
 as proxmox don't defined them in /etc/network/interfaces
 
 Signed-off-by: Thomas Lamprecht 
 Signed-off-by: Alexandre Derumier 
 ---
- debian/rules   | 2 +-
  ifupdown2/addons/bridge.py | 4 
- 2 files changed, 5 insertions(+), 1 deletion(-)
+ 1 file changed, 4 insertions(+)
 
-diff --git a/debian/rules b/debian/rules
-index 6274b3a..dfd460f 100755
 a/debian/rules
-+++ b/debian/rules
-@@ -1,6 +1,6 @@
- #!/usr/bin/make -f
- 
--#export DH_VERBOSE=1
-+export DH_VERBOSE=1
- export PYBUILD_NAME=ifupdown2
- export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/ 
--install-scripts=/usr/share/
- 
 diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py
-index 00b1eaa..35944ac 100644
+index d990b66..365e87d 100644
 --- a/ifupdown2/addons/bridge.py
 +++ b/ifupdown2/addons/bridge.py
-@@ -440,6 +440,7 @@ class bridge(Addon, moduleBase):
+@@ -439,6 +439,7 @@ class bridge(Addon, moduleBase):
  "bridge-ports-condone-regex": {
  "help": "bridge ports to ignore/condone when reloading 
config / removing interfaces",
  "required": False,
 +"default": "^(tap|veth|fwpr)",
  "example": ["bridge-ports-condone-regex 
^[a-zA-Z0-9]+_v[0-9]{1,4}$"]
  },
- }
-@@ -1006,6 +1007,9 @@ class bridge(Addon, moduleBase):
+ "bridge-vlan-vni-map": {
+@@ -1013,6 +1014,9 @@ class bridge(Addon, moduleBase):
  # up a compiled regex to be used in a match later. This way we try to 
avoid
  # a race condition where an (possibly VM) interface is created after 
this
  # function has been called but before the bridgeports are validated.
-- 
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 ifupdown2 1/9] remove extra patches

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 ...g-option-to-common_argparse-to-avoid.patch |  44 
 .../extra/0002-fix-default-forwarding.patch   | 100 --
 debian/patches/series |   2 -
 3 files changed, 146 deletions(-)
 delete mode 100644 
debian/patches/extra/0001-argv-move-nldebug-option-to-common_argparse-to-avoid.patch
 delete mode 100644 debian/patches/extra/0002-fix-default-forwarding.patch

diff --git 
a/debian/patches/extra/0001-argv-move-nldebug-option-to-common_argparse-to-avoid.patch
 
b/debian/patches/extra/0001-argv-move-nldebug-option-to-common_argparse-to-avoid.patch
deleted file mode 100644
index f02574f..000
--- 
a/debian/patches/extra/0001-argv-move-nldebug-option-to-common_argparse-to-avoid.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 8e9960454d58f648547fcb086a8b4352a4aa4faa Mon Sep 17 00:00:00 2001
-From: Julien Fortin 
-Date: Tue, 31 Dec 2019 20:25:44 +0100
-Subject: [PATCH] argv: move --nldebug option to common_argparse to avoid
- exception in ifreload
-
-Signed-off-by: Julien Fortin 
-Signed-off-by: Thomas Lamprecht 

- ifupdown2/ifupdown/argv.py | 14 +++---
- 1 file changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/ifupdown2/ifupdown/argv.py b/ifupdown2/ifupdown/argv.py
-index e560b40..a96a390 100644
 a/ifupdown2/ifupdown/argv.py
-+++ b/ifupdown2/ifupdown/argv.py
-@@ -148,13 +148,6 @@ class Parse:
-help='type of interface entry (iface or vlan). 
'
- 'This option can be used in case of 
ambiguity between '
- 'a vlan interface and an iface interface 
of the same name')
--argparser.add_argument(
--"--nldebug",
--dest="nldebug",
--action="store_true",
--default=False,
--help="print netlink debug messages"
--)
- 
- def update_ifupdown_argparser(self, argparser):
- """ common arg parser for ifup and ifdown """
-@@ -248,3 +241,10 @@ class Parse:
- ''' general parsing rules '''
- 
- argparser.add_argument('-V', '--version', action=VersionAction, 
nargs=0)
-+argparser.add_argument(
-+"--nldebug",
-+dest="nldebug",
-+action="store_true",
-+default=False,
-+help="print netlink debug messages"
-+)
--- 
-2.20.1
-
diff --git a/debian/patches/extra/0002-fix-default-forwarding.patch 
b/debian/patches/extra/0002-fix-default-forwarding.patch
deleted file mode 100644
index c1a72a3..000
--- a/debian/patches/extra/0002-fix-default-forwarding.patch
+++ /dev/null
@@ -1,100 +0,0 @@
-From 85a93e870777f774e5901bd4443ddff2e8eaa444 Mon Sep 17 00:00:00 2001
-From: Alexandre Derumier 
-Date: Mon, 24 Feb 2020 15:18:56 +0100
-Subject: [PATCH] fix default forwarding
-
-Signed-off-by: Alexandre Derumier 

- ifupdown2/addons/address.py | 70 +
- 1 file changed, 40 insertions(+), 30 deletions(-)
-
-diff --git a/ifupdown2/addons/address.py b/ifupdown2/addons/address.py
-index 83974d7..b9a16ee 100644
 a/ifupdown2/addons/address.py
-+++ b/ifupdown2/addons/address.py
-@@ -821,42 +821,52 @@ class address(Addon, moduleBase):
-'bridge port' %ifaceobj.name)
- return
- setting_default_value = False
-+
-+
- if not ipforward:
- setting_default_value = True
--ipforward = (self.ipforward or
-- self.get_mod_subattr('ip-forward', 'default'))
--ipforward = int(utils.get_boolean_from_string(ipforward))
--running_ipforward = self.cache.get_netconf_forwarding(socket.AF_INET, 
ifaceobj.name)
--if ipforward != running_ipforward:
--try:
--self.sysctl_set('net.ipv4.conf.%s.forwarding'
--%('/'.join(ifaceobj.name.split("."))),
--ipforward)
--except Exception as e:
--if not setting_default_value:
--ifaceobj.status = ifaceStatus.ERROR
--self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
-+  ipforward = self.ipforward
-+
-+if ipforward:
-+
-+ipforward = int(utils.get_boolean_from_string(ipforward))
-+running_ipforward = 
self.cache.get_netconf_forwarding(socket.AF_INET, ifaceobj.name)
-+
-+if ipforward != running_ipforward:
-+try:
-+self.sysctl_set('net.ipv4.conf.%s.forwarding'
-+%('/'.join(ifaceobj.name.split("."))),
-+ipforward)
-+except Exception as e:
-+if not setting_default_value:
-+ifaceobj.status = ifaceStatus.ERROR
-+self.logger.error('%s: %s' %(ifaceobj.name, str(e)))
- 
- setting_default_value = False
-+
-+

[pve-devel] [PATCH ifupdown2 5/9] add extra patch: 0002-nllistener-increase-buffer.patch

2020-05-28 Thread Alexandre Derumier
https://github.com/CumulusNetworks/ifupdown2/commit/523b347ad49234efb7787f6f084070034de7e977
Signed-off-by: Alexandre Derumier 
---
 .../0002-nllistener-increase-buffer.patch | 25 +++
 debian/patches/series |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/extra/0002-nllistener-increase-buffer.patch

diff --git a/debian/patches/extra/0002-nllistener-increase-buffer.patch 
b/debian/patches/extra/0002-nllistener-increase-buffer.patch
new file mode 100644
index 000..72a4f06
--- /dev/null
+++ b/debian/patches/extra/0002-nllistener-increase-buffer.patch
@@ -0,0 +1,25 @@
+From 523b347ad49234efb7787f6f084070034de7e977 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier 
+Date: Wed, 27 May 2020 15:49:49 +0200
+Subject: [PATCH] nllistener: increase netlink buffer to 64k
+
+Currently 4k buffer is too small to handle some netlink messages
+
+(Like bridge vlans for example, with 32k messages detected).
+---
+ ifupdown2/nlmanager/nllistener.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ifupdown2/nlmanager/nllistener.py 
b/ifupdown2/nlmanager/nllistener.py
+index b40b058..e319dc4 100644
+--- a/ifupdown2/nlmanager/nllistener.py
 b/ifupdown2/nlmanager/nllistener.py
+@@ -44,7 +44,7 @@ class NetlinkListener(Thread):
+ # As defined in asm/socket.h
+ _SO_ATTACH_FILTER = 26
+ 
+-RECV_BUFFER = 4096  # 1024 * 1024
++RECV_BUFFER = 65536  # 1024 * 1024
+ 
+ def __init__(self, manager, groups, pid_offset=1, 
error_notification=False, rcvbuf_sz=1000, bpf_filter=None):
+ """
diff --git a/debian/patches/series b/debian/patches/series
index 8363c15..e57723c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
 extra/0001-ovs-ovs-ports-condone-regex.patch
+extra/0002-nllistener-increase-buffer.patch
 pve/0001-don-t-remove-tap-veth-fwpr-interfaces-from-bridge-on.patch
 pve/0002-add-dummy-mtu-bridgevlanport-modules.patch
 pve/0003-allow-vlan-subinterface-in-a-vlan-aware-bridge.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] [PATCH ifupdown2 8/9] control: update python3

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 debian/control | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 62358f6..5a95659 100644
--- a/debian/control
+++ b/debian/control
@@ -5,12 +5,13 @@ Maintainer: Proxmox Support Team 
 Build-Depends: debhelper (>=9),
dh-systemd,
dh-python,
-   python-all,
-   python-setuptools,
-   python-docutils
+   python3,
+   python3-all,
+   python3-setuptools,
+   python3-docutils
 Standards-Version: 3.9.8
 Homepage: https://github.com/cumulusnetworks/ifupdown2
-X-Python-Version: >= 2.7
+X-Python-Version: >= 3.7
 
 Package: ifupdown2
 Architecture: all
@@ -18,8 +19,8 @@ Provides: ifupdown
 Conflicts: ifupdown
 Replaces: ifupdown
 Breaks: libpve-common-perl (<< 6.0-14)
-Depends: ${python:Depends}, ${misc:Depends}, iproute2, python-argcomplete, 
python-ipaddr
-Suggests: isc-dhcp-client, bridge-utils, ethtool, python-gvgen, python-mako
+Depends: ${python3:Depends}, ${misc:Depends}, iproute2
+Suggests: isc-dhcp-client, bridge-utils, ethtool, python3-gvgen, python3-mako
 Description: Network Interface Management tool similar to ifupdown
  ifupdown2 is ifupdown re-written in Python. It replaces ifupdown and provides
  the same user interface as ifupdown for network interface configuration.
-- 
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 ifupdown2 9/9] changelog: bump to 3.0.0-1

2020-05-28 Thread Alexandre Derumier
Signed-off-by: Alexandre Derumier 
---
 debian/changelog | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7ca7226..ff13c56 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+ifupdown2 (3.0.0-1+pve1) pve; urgency=medium
+
+  * Bump to 3.0.0-1
+
+ -- Proxmox Support Team   Tue, 28 May 2020 11:10:20 +0200
+
 ifupdown2 (2.0.1-1+pve10) pve; urgency=medium
 
   * avoid bringing network config in sync if pve-common isn't available
-- 
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 ifupdown2 4/9] remove 0008-add-openvswitch-addon.patch

2020-05-28 Thread Alexandre Derumier
openvswitch is now upstream

add extra-patch for ovs-ports-condone-regex
https://github.com/CumulusNetworks/ifupdown2/pull/157

Signed-off-by: Alexandre Derumier 
---
 .../0001-ovs-ovs-ports-condone-regex.patch|  66 ++
 .../pve/0008-add-openvswitch-addon.patch  | 595 --
 debian/patches/series |   2 +-
 3 files changed, 67 insertions(+), 596 deletions(-)
 create mode 100644 debian/patches/extra/0001-ovs-ovs-ports-condone-regex.patch
 delete mode 100644 debian/patches/pve/0008-add-openvswitch-addon.patch

diff --git a/debian/patches/extra/0001-ovs-ovs-ports-condone-regex.patch 
b/debian/patches/extra/0001-ovs-ovs-ports-condone-regex.patch
new file mode 100644
index 000..745c5e0
--- /dev/null
+++ b/debian/patches/extra/0001-ovs-ovs-ports-condone-regex.patch
@@ -0,0 +1,66 @@
+From 5efdf225e1f0e2705d44f36887c3e00207dd69d2 Mon Sep 17 00:00:00 2001
+From: Alexandre Derumier 
+Date: Sat, 16 May 2020 08:11:22 +0200
+Subject: [PATCH] addon: openvswitch : add ovs-ports-condone-regex option
+
+Like for bridge, add a option to skip delete a regex list of interfaces.
+(can be usefull for hypervisor, when vm interfaces are dynamically plugged)
+---
+ ifupdown2/addons/openvswitch.py | 18 ++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/ifupdown2/addons/openvswitch.py b/ifupdown2/addons/openvswitch.py
+index 767d09a..468d7df 100644
+--- a/ifupdown2/addons/openvswitch.py
 b/ifupdown2/addons/openvswitch.py
+@@ -63,6 +63,11 @@ class openvswitch(Addon, moduleBase):
+ 'example': ['ovs_extra set bridge ${IFACE} 
other-config:hwaddr=00:59:cf:9c:84:3a -- br-set-external-id ${IFACE} bridge-id 
${IFACE}']
+ 
+ },
++'ovs-ports-condone-regex': {
++"help": "ovs ports to ignore/condone when reloading 
config / removing interfaces",
++"required": False,
++"example": ["ovs-ports-condone-regex 
^[a-zA-Z0-9]+_v[0-9]{1,4}$"]
++},
+ }
+ }
+ 
+@@ -94,6 +99,14 @@ def _get_running_ovs_ports (self, iface):
+ return ovs_ports
+ return None
+ 
++def _get_ovs_port_condone_regex(self, ifaceobj, get_string = False):
++ovs_port_condone_regex = 
ifaceobj.get_attr_value_first('ovs-ports-condone-regex')
++if ovs_port_condone_regex:
++if get_string:
++return ovs_port_condone_regex
++return re.compile (r"%s" % ovs_port_condone_regex)
++return None
++
+ def _ovs_vsctl(self, ifaceobj, cmdlist):
+ 
+ if cmdlist:
+@@ -122,6 +135,7 @@ def _addbridge (self, ifaceobj):
+ ovsoptions = ifaceobj.get_attr_value_first ('ovs-options')
+ ovsextra = ifaceobj.get_attr_value('ovs-extra')
+ ovsmtu = ifaceobj.get_attr_value_first ('ovs-mtu')
++ovsportscondoneregex = self._get_ovs_port_condone_regex(ifaceobj)
+ 
+ cmd_list = []
+ 
+@@ -137,11 +151,15 @@ def _addbridge (self, ifaceobj):
+ # on update, delete active ports not in the new port list
+ ovs_ports = self._get_ovs_ports(ifaceobj)
+ running_ovs_ports = self._get_running_ovs_ports(iface)
++
+ if running_ovs_ports is not None and ovs_ports is not None:
+ missingports = list(set(running_ovs_ports) - set(ovs_ports))
+ 
+ if missingports is not None:
+ for port in missingports:
++if ovsportscondoneregex and 
ovsportscondoneregex.match(port):
++self.logger.info("%s: port %s will stay enslaved as 
it matches with ovs-ports-condone-regex" % (ifaceobj.name, port))
++continue
+ cmd = "--if-exists del-port %s %s"%(iface, port)
+ cmd_list.append(cmd)
+ 
diff --git a/debian/patches/pve/0008-add-openvswitch-addon.patch 
b/debian/patches/pve/0008-add-openvswitch-addon.patch
deleted file mode 100644
index 847c0bf..000
--- a/debian/patches/pve/0008-add-openvswitch-addon.patch
+++ /dev/null
@@ -1,595 +0,0 @@
-From 4311f4deb9b95e67694c04ced13782a3608a176b Mon Sep 17 00:00:00 2001
-From: Alexandre Derumier 
-Date: Mon, 17 Feb 2020 13:32:18 +0100
-Subject: [PATCH] add openvswitch addon
-
-Signed-off-by: Alexandre Derumier 

- etc/network/ifupdown2/addons.conf|   4 +
- ifupdown2/addons/openvswitch.py  | 248 
- ifupdown2/addons/openvswitch_port.py | 274 +++
- ifupdown2/lib/iproute2.py|   3 +
- ifupdown2/nlmanager/nlpacket.py  |   1 +
- 5 files changed, 530 insertions(+)
- create mode 100644 ifupdown2/addons/openvswitch.py
- create mode 100644 ifupdown2/addons/openvswitch_port.py
-
-diff --git a/etc/network/ifupdown2/addons.conf 
b/etc/network/ifupdown2/addons.conf
-index c43d377..8811cc2 100644
 a/etc/network/ifupdown2/addons.conf
-+++ b/etc/network/ifupdown2/addons.conf
-@@ -1,3 +1,5 @@
-+pre-up,openvswitch
-+pre-up,openvswitch_

Re: [pve-devel] [PATCH kernel] add pve-kernel-X.Y-libc-dev package

2020-05-28 Thread Fabian Grünbichler
On May 27, 2020 7:03 pm, Thomas Lamprecht wrote:
> This was long overdue, allows to access the full feature set of our
> kernel for some tools using the Linux API directly.
> 
> Packaging mostly taken from Debian[0]
> 
> [0]: 
> https://salsa.debian.org/kernel-team/linux/-/blob/debian/4.19.118-2/debian/rules.real#L367
> 
> Signed-off-by: Thomas Lamprecht 
> ---
> 
> Package name could be probably better, just took the first thing coming to my
> mind. Also, the approach of butting Kernel MAJ.MIN version in there or using
> the kernel package version, or none at all, should be evaluated.
> 
> I'd guess none could be preferred as it should be backwards compatible anyway
> (never break userspace™) so the newest one is always wanted.

IMHO we should not encode the version in the package name, since we 
always only want one version of the package installed and different 
-libc packages for different kernel versions are not co-installable 
anyway. The only caveat is that we need to be careful when building new 
opt-in kernels and NOT upload the -libc package until we switch over the 
default kernel series, but even if we do, it should not break anything.

Besides that, but without a full rebuild-test:

Reviewed-By: Fabian Grünbichler 

> 
> note: This was working really quick, almost suspicious... Tested by building
> QEMU (which inspired my doing this now in the first place due to the sizeof 
> bug
> we have with Debian's plin linux-libc-dev package on build)
> 
>  debian/control.in | 12 
>  debian/rules  | 22 --
>  2 files changed, 32 insertions(+), 2 deletions(-)
> 
> diff --git a/debian/control.in b/debian/control.in
> index 9b807c1d40c5..c457564eafe9 100644
> --- a/debian/control.in
> +++ b/debian/control.in
> @@ -69,3 +69,15 @@ Depends: busybox,
>  Recommends: grub-pc | grub-efi-amd64 | grub-efi-ia32 | grub-efi-arm64,
>  Description: The Proxmox PVE Kernel Image
>   This package contains the linux kernel and initial ramdisk used for booting
> +
> +Package: pve-kernel-@KVMAJMIN@-libc-dev
> +Section: devel
> +Priority: optional
> +Architecture: any
> +Provides: linux-libc-dev,
> +Conflicts: linux-libc-dev,
> +Replaces: linux-libc-dev,
> +Depends: ${misc:Depends}
> +Description: Linux support headers for userspace development
> + This package provides userspaces headers from the Linux kernel.  These 
> headers
> + are used by the installed headers for GNU libc and other system libraries.
> diff --git a/debian/rules b/debian/rules
> index e530eb548707..dc839b127507 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -15,6 +15,7 @@ CHANGELOG_DATE:=$(shell dpkg-parsechangelog -SDate)
>  
>  PVE_KERNEL_PKG=pve-kernel-${KVNAME}
>  PVE_HEADER_PKG=pve-headers-${KVNAME}
> +PVE_USR_HEADER_PKG=pve-kernel-${KERNEL_MAJMIN}-libc-dev
>  LINUX_TOOLS_PKG=linux-tools-${KERNEL_MAJMIN}
>  KERNEL_SRC_COPY=${KERNEL_SRC}_tmp
>  
> @@ -87,7 +88,7 @@ debian/control: $(wildcard debian/*.in)
>  
>  build: .compile_mark .tools_compile_mark .modules_compile_mark
>  
> -install: .install_mark .tools_install_mark .headers_install_mark
> +install: .install_mark .tools_install_mark .headers_install_mark 
> .usr_headers_install_mark
>   dh_installdocs -A debian/copyright debian/SOURCE
>   dh_installchangelogs
>   dh_installman
> @@ -97,7 +98,7 @@ install: .install_mark .tools_install_mark 
> .headers_install_mark
>  
>  binary: install
>   debian/rules fwcheck abicheck
> - dh_strip -N${PVE_HEADER_PKG}
> + dh_strip -N${PVE_HEADER_PKG} -N${PVE_USR_HEADER_PKG}
>   dh_makeshlibs
>   dh_shlibdeps
>   dh_installdeb
> @@ -207,6 +208,23 @@ binary: install
>   ln -sf /usr/src/linux-headers-${KVNAME} 
> debian/${PVE_HEADER_PKG}/lib/modules/${KVNAME}/build
>   touch $@
>  
> +.usr_headers_install_mark: PKG_DIR = debian/${PVE_USR_HEADER_PKG}
> +.usr_headers_install_mark: OUT_DIR = ${PKG_DIR}/usr
> +.usr_headers_install_mark: .config_mark
> + rm -rf '${PKG_DIR}'
> + mkdir -p  '${PKG_DIR}'
> + $(MAKE) -C ${KERNEL_SRC} headers_check ARCH=$(KERNEL_HEADER_ARCH)
> + $(MAKE) -C ${KERNEL_SRC} headers_install ARCH=$(KERNEL_HEADER_ARCH) 
> INSTALL_HDR_PATH='$(CURDIR)'/$(OUT_DIR)
> + rm -rf $(OUT_DIR)/include/drm $(OUT_DIR)/include/scsi
> + find $(OUT_DIR)/include \( -name .install -o -name ..install.cmd \) 
> -execdir rm {} +
> +
> +# Move include/asm to arch-specific directory
> + mkdir -p $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)
> + mv $(OUT_DIR)/include/asm $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
> + test ! -d $(OUT_DIR)/include/arch || \
> + mv $(OUT_DIR)/include/arch 
> $(OUT_DIR)/include/$(DEB_HOST_MULTIARCH)/
> + touch $@
> +
>  .modules_compile_mark: ${MODULES}/zfs.ko
>   touch $@
>  
> -- 
> 2.20.1
> 
> 
> ___
> pve-devel mailing list
> pve-devel@pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 

___
p

[pve-devel] applied: Re: [PATCH widget-toolkit 2/2] css: add icon colors

2020-05-28 Thread Thomas Lamprecht
On 5/28/20 1:02 PM, Dominik Csapak wrote:
> from pve-manager
> 
> Signed-off-by: Dominik Csapak 
> ---
>  css/ext6-pmx.css | 25 +
>  1 file changed, 25 insertions(+)
> 
>

applied, thanks!

___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH widget-toolkit/manager] some refactorings

2020-05-28 Thread Dominik Csapak
just moving things to widget-toolkit
manager patches need the toolkit ones,
but they are not breaking manager

proxmox-widget-toolkit:

Dominik Csapak (2):
  Utils: add duration format/render
  css: add icon colors

 Utils.js | 27 +++
 css/ext6-pmx.css | 25 +
 2 files changed, 52 insertions(+)

pve-manager:

Dominik Csapak (2):
  ui: Replication: use render_duration from widget-toolkit
  css: remove icon colors

 www/css/ext6-pve.css | 25 -
 www/manager6/Utils.js| 27 ---
 www/manager6/grid/Replication.js |  2 +-
 3 files changed, 1 insertion(+), 53 deletions(-)

-- 
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 manager 1/2] ui: Replication: use render_duration from widget-toolkit

2020-05-28 Thread Dominik Csapak
Signed-off-by: Dominik Csapak 
---
 www/manager6/Utils.js| 27 ---
 www/manager6/grid/Replication.js |  2 +-
 2 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 676f56a8..5c81d7f8 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -536,26 +536,6 @@ Ext.define('PVE.Utils', { utilities: {
return msg;
 },
 
-format_duration_short: function(ut) {
-
-   if (ut < 60) {
-   return ut.toFixed(1) + 's';
-   }
-
-   if (ut < 3600) {
-   var mins = ut / 60;
-   return mins.toFixed(1) + 'm';
-   }
-
-   if (ut < 86400) {
-   var hours = ut / 3600;
-   return hours.toFixed(1) + 'h';
-   }
-
-   var days = ut / 86400;
-   return days.toFixed(1) + 'd';
-},
-
 contentTypes: {
'images': gettext('Disk image'),
'backup': gettext('VZDump backup file'),
@@ -836,13 +816,6 @@ Ext.define('PVE.Utils', { utilities: {
return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s');
 },
 
-render_duration: function(value) {
-   if (value === undefined) {
-   return '-';
-   }
-   return PVE.Utils.format_duration_short(value);
-},
-
 calculate_mem_usage: function(data) {
if (!Ext.isNumeric(data.mem) ||
data.maxmem === 0 ||
diff --git a/www/manager6/grid/Replication.js b/www/manager6/grid/Replication.js
index 40f15982..eabf5524 100644
--- a/www/manager6/grid/Replication.js
+++ b/www/manager6/grid/Replication.js
@@ -382,7 +382,7 @@ Ext.define('PVE.grid.ReplicaView', {
text: gettext('Duration'),
dataIndex: 'duration',
width: 60,
-   renderer: PVE.Utils.render_duration
+   renderer: Proxmox.Utils.render_duration
},
{
text: gettext('Next Sync'),
-- 
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 widget-toolkit 1/2] Utils: add duration format/render

2020-05-28 Thread Dominik Csapak
from pve-manager

Signed-off-by: Dominik Csapak 
---
 Utils.js | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/Utils.js b/Utils.js
index 56b1c9a..328164d 100644
--- a/Utils.js
+++ b/Utils.js
@@ -145,6 +145,26 @@ Ext.define('Proxmox.Utils', { utilities: {
return Ext.Date.format(date, "Y-m-d");
 },
 
+format_duration_short: function(ut) {
+
+   if (ut < 60) {
+   return ut.toFixed(1) + 's';
+   }
+
+   if (ut < 3600) {
+   var mins = ut / 60;
+   return mins.toFixed(1) + 'm';
+   }
+
+   if (ut < 86400) {
+   var hours = ut / 3600;
+   return hours.toFixed(1) + 'h';
+   }
+
+   var days = ut / 86400;
+   return days.toFixed(1) + 'd';
+},
+
 format_duration_long: function(ut) {
 
var days = Math.floor(ut / 86400);
@@ -643,6 +663,13 @@ Ext.define('Proxmox.Utils', { utilities: {
return task;
 },
 
+render_duration: function(value) {
+   if (value === undefined) {
+   return '-';
+   }
+   return Proxmox.Utils.format_duration_short(value);
+},
+
 render_timestamp: function(value, metaData, record, rowIndex, colIndex, 
store) {
var servertime = new Date(value * 1000);
return Ext.Date.format(servertime, 'Y-m-d H:i:s');
-- 
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 manager 2/2] css: remove icon colors

2020-05-28 Thread Dominik Csapak
they are now in the widget-toolkit

Signed-off-by: Dominik Csapak 
---
 www/css/ext6-pve.css | 25 -
 1 file changed, 25 deletions(-)

diff --git a/www/css/ext6-pve.css b/www/css/ext6-pve.css
index 4294f659..8f0407df 100644
--- a/www/css/ext6-pve.css
+++ b/www/css/ext6-pve.css
@@ -532,31 +532,6 @@ div.right-aligned {
 color: #000;
 }
 
-/* some icons have to be color manually */
-.black {
-color: #000;
-}
-
-.normal {
-color: #c2ddf2;
-}
-
-.faded {
-color: #cfcfcf;
-}
-
-.good {
-color: #21BF4B;
-}
-
-.warning {
-color: #fc0;
-}
-
-.critical {
-color: #FF6C59;
-}
-
 /* for the ceph monitor widgets */
 div.monitor {
text-align:left;
-- 
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 widget-toolkit 2/2] css: add icon colors

2020-05-28 Thread Dominik Csapak
from pve-manager

Signed-off-by: Dominik Csapak 
---
 css/ext6-pmx.css | 25 +
 1 file changed, 25 insertions(+)

diff --git a/css/ext6-pmx.css b/css/ext6-pmx.css
index 9b15392..37ee6aa 100644
--- a/css/ext6-pmx.css
+++ b/css/ext6-pmx.css
@@ -13,3 +13,28 @@
 .proxmox-invalid-row {
 background-color: #f3d6d7;
 }
+
+/* some icons have to be color manually */
+.black {
+color: #000;
+}
+
+.normal {
+color: #c2ddf2;
+}
+
+.faded {
+color: #cfcfcf;
+}
+
+.good {
+color: #21BF4B;
+}
+
+.warning {
+color: #fc0;
+}
+
+.critical {
+color: #FF6C59;
+}
-- 
2.20.1


___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel