Re: [pve-devel] proxmox 2018 : add support for "virtual" network and network plugins ?

2018-01-22 Thread Alexandre DERUMIER
Hi,

we have done a POC at work, with vxlan + ebgp-vpn,
and we have tested a very nice feature : anycast gateway.

basicaly, each vmbrX of a specific tenant, have the same ipaddress/mac address.
This ip is the default gateway of the vm.

That mean that vm can be migrate across hosts :)

(openstack have a network model like this called "dvr", distributed virtual 
routing, vmware :nsx Distributed Logical Router (DLR))

I think this model works very fine with proxmox, as all proxmox nodes are 
master.


This open a lot of possiblities:

- distributed dhcp on all cluster nodes (btw, http://kea.isc.org seem to be a 
very good candidate, can be extended with custom backend)
- distributed dns
- S-nat for vm private only -> internet. (need 1 public ip on each hosts)
- 1:1 nat (aka floating ip in openstack,google cloud,...) : a public ip is 
created on host, and "migrate" at the same time than a vm
  https://assafmuller.com/2015/04/15/distributed-virtual-routing-floating-ips/
- cloudinit metadata-server should be easy to implement
- add vrf support to isolate host (avoid connect from vm to the host gateway 
ip), or prevent inter-routing between tenants
- maybe other cool stuffs I don't have think yet about :)



I really like the vxlan bgp evpn, because it's a standard, with no central 
controller,
and we can also use it on physical switch/routers, differents proxmox 
clusters,and also on docker/kubernetes cluster.

Also, this fully supported in current linux kernel. (cumulus network work hard 
on it, and use it on their switch).
We only need : the linux kernel + a bgp routing deamon (quagga, frr, bird, 
gobgp,...)


I can already configure manually each brige and vtep from each network in 
/etc/network/interfaces 
(with ifupdown2, https://github.com/CumulusNetworks/ifupdown2/tree/v1.0.0, 
already support new kernel 4.14 features).
I have checked systemd-networkd, seem to be good, with some missing optional 
features like arp suppression (kernel 4.14)

But this could be done easy with some custom code with ip commands.


basicaly we need to define something like

local on each node
---
/etc/pve/node/

host1:
--
vtep :  myvtep
dstport 4789 
address 203.0.113.1 
learningmode nolearning

(each node have a loopback with this ip address, which is used to generate vtep 
and the local bgp config too from this)

host2:
vtep :  myvtep
dstport 4789 
address 203.0.113.2 
learningmode nolearning

global
--
/etc/pve/networks.cfg

vxlanebgp: tenantnetwork1
   gateway_address 10.0.1.1/24
   gateway_macaddress a2:ed:21:06:e7:48
   vni 1
   vtep myvtep


vxlanebgp: tenantnetwork2
   gateway_address 10.0.2.1/24
   gateway_macaddress a2:ed:21:06:e7:48
   vni 2
   vtep myvtep



Then when vm start, we can generate the bridge with anycast address, 
create a vtep and plug it on the bridge (differents vtep reuse the same 
loopback address)


manual config:

host1 config

/etc/network/interfaces
---
auto lo
iface lo inet loopback
pre-up ip addr add 203.0.113.1/32 dev lo

auto vmbr1
iface vmbr1 inet static
address 10.0.1.1/24
bridge_ports vxlan1
bridge_stp off
bridge_fd 0
pre-up ip link add vxlan1 type vxlan id 1 dstport 4789 local 
203.0.113.1 nolearning
pre-up ip link set dev vmbr1 address a2:ed:21:06:e7:48
pre-up brctl addif vmbr1 vxlan1

auto vmbr2
iface vmbr2 inet static
address 10.0.2.1/24
bridge_ports vxlan1
bridge_stp off
bridge_fd 0
pre-up ip link add vxlan2 type vxlan id 2 dstport 4789 local 
203.0.113.1 nolearning
pre-up ip link set dev vmbr2 address a2:ed:21:06:e7:48
pre-up brctl addif vmbr2 vxlan2

quagga bgp config:
--


router bgp 65000
  bgp router-id 203.0.113.1
  no bgp default ipv4-unicast
  neighbor fabric peer-group
  neighbor fabric remote-as 65000
  neighbor fabric capability extended-nexthop
  ! BGP sessions with route reflectors or full mesh with all proxmox hosts or 
routers..
  neighbor 203.0.113.2 peer-group fabric
  neighbor 203.0.113.254 peer-group fabric
  !
  address-family evpn
   neighbor fabric activate
   advertise-all-vni
  exit-address-family
  !
  exit
!


host2 config

/etc/network/interfaces
---
auto lo
iface lo inet loopback
pre-up ip addr add 203.0.113.2/32 dev lo

auto vmbr1
iface vmbr1 inet static
address 10.0.1.1/24
bridge_ports vxlan1
bridge_stp off
bridge_fd 0
pre-up ip link add vxlan1 type vxlan id 1 dstport 4789 local 
203.0.113.2 nolearning
pre-up ip link set dev vmbr1 address a2:ed:21:06:e7:48
pre-up brctl addif vmbr1 vxlan1

auto vmbr2
iface vmbr2 inet static
address 10.0.2.1/24
bridge_ports vxlan1
bridge_stp off
bridge_fd 0
pre-up ip link add vxlan2 type 

[pve-devel] [PATCH cluster] avoid harmful '<>' pattern, explicitly read from STDIN

2018-01-22 Thread Thomas Lamprecht
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht 
---
 data/PVE/CLI/pvecm.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm
index 6d0d704..321c130 100755
--- a/data/PVE/CLI/pvecm.pm
+++ b/data/PVE/CLI/pvecm.pm
@@ -872,7 +872,7 @@ __PACKAGE__->register_method ({
print "tunnel online\n";
*STDOUT->flush();
 
-   while (my $line = <>) {
+   while (my $line = ) {
chomp $line;
last if $line =~ m/^quit$/;
}
-- 
2.14.2


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


[pve-devel] [PATCH apiclient] avoid harmful '<>' pattern, explicitly read from STDIN

2018-01-22 Thread Thomas Lamprecht
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht 
---
 PVE/APIClient/LWP.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/APIClient/LWP.pm b/PVE/APIClient/LWP.pm
index 20e3b56..31df3c5 100755
--- a/PVE/APIClient/LWP.pm
+++ b/PVE/APIClient/LWP.pm
@@ -146,7 +146,7 @@ sub manual_verify_fingerprint {
"X509 SHA256 key fingerprint is $fingerprint.\n" .
"Are you sure you want to continue connecting (yes/no)? ";
 
-my $answer = <>;
+my $answer = ;
 
 my $valid = ($answer =~ m/^\s*yes\s*$/i) ? 1 : 0;
 
-- 
2.14.2


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


[pve-devel] avoid possible harmful <> pattern when reading from STDIN

2018-01-22 Thread Thomas Lamprecht
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

After I saw that all usages of this pattern in our code base are not
required, and even rather dangerous I assembled this series by using:

find -iname '*.pm' -exec sed -i 's/= <>/= /g' {} \;


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


[pve-devel] [PATCH qemu-server] avoid harmful '<>' pattern, explicitly read from STDIN

2018-01-22 Thread Thomas Lamprecht
Fixes problems in CLIHandler using the code pattern:

while (my $line = <>) {
...
}

For why this causes only _now_ problems lets first look how <>
behaves:

"The null filehandle <> is special: [...] Input from <> comes either
from standard input, or from each file listed on the command line.
Here's how it works: the first time <> is evaluated, the @ARGV array
is checked, and if it is empty, $ARGV[0] is set to "-" , which when
opened gives you standard input.  The @ARGV array is then processed
as a list of filenames." - 'perldoc perlop'

Recent changes in the CLIHandler code changed how we modfiied @ARGV
Earlier we assumed that the first argument must be the command and
thus shifted it out of @ARGV, now we can have multiple levels of
(sub)commands. This change also changed how we handle @ARGV, we do
not unshift anything but go through the arguments until we got to
the final command and copy the rest of @ARGV as we know that this
must be the commandos arguments.

For '<>' this means that ARGV was still fully populated and perl
tried to open element as a file, which naturally failed.
Thus the change in pve-common only exposed this 'dangerous' code
pattern.

Signed-off-by: Thomas Lamprecht 
---
 PVE/API2/Qemu.pm | 2 +-
 PVE/CLI/qm.pm| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 0983ce6..b277a26 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1849,7 +1849,7 @@ __PACKAGE__->register_method({
# read spice ticket from STDIN
my $spice_ticket;
if ($stateuri && ($stateuri eq 'tcp') && $migratedfrom && 
($rpcenv->{type} eq 'cli')) {
-   if (defined(my $line = <>)) {
+   if (defined(my $line = )) {
chomp $line;
$spice_ticket = $line;
}
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 564e443..04beb48 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -286,7 +286,7 @@ __PACKAGE__->register_method ({
$tunnel_write->("tunnel online");
$tunnel_write->("ver 1");
 
-   while (my $line = <>) {
+   while (my $line = ) {
chomp $line;
if ($line =~ /^quit$/) {
$tunnel_write->("OK");
-- 
2.14.2


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


[pve-devel] [PATCH common] CLIHandler: use resolved command definition

2018-01-22 Thread Thomas Lamprecht
For sub commands we resolve the real $cmd, $def and its arguments,
thus we should also get the handler from the resolved $def, not the
global one.

No change for normal (consisting of only the first argument)
commands, for them $cmddef == $def.
This sneaked in in a respin/rebase of the series.

Signed-off-by: Thomas Lamprecht 
---

 src/PVE/CLIHandler.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
index caa7ca6..45c0427 100644
--- a/src/PVE/CLIHandler.pm
+++ b/src/PVE/CLIHandler.pm
@@ -485,7 +485,7 @@ my $handle_cmd  = sub {
 
 &$preparefunc() if $preparefunc;
 
-my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef->{$cmd} || 
[]};
+my ($class, $name, $arg_param, $uri_param, $outsub) = @{$def || []};
 $abort->("unknown command '$cmd_str'") if !$class;
 
 my $prefix = "$exename $cmd_str";
-- 
2.14.2


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


[pve-devel] applied: [PATCH common] CLIHandler: use resolved command definition

2018-01-22 Thread Wolfgang Bumiller
applied

On Mon, Jan 22, 2018 at 11:00:07AM +0100, Thomas Lamprecht wrote:
> For sub commands we resolve the real $cmd, $def and its arguments,
> thus we should also get the handler from the resolved $def, not the
> global one.
> 
> No change for normal (consisting of only the first argument)
> commands, for them $cmddef == $def.
> This sneaked in in a respin/rebase of the series.
> 
> Signed-off-by: Thomas Lamprecht 
> ---
> 
>  src/PVE/CLIHandler.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
> index caa7ca6..45c0427 100644
> --- a/src/PVE/CLIHandler.pm
> +++ b/src/PVE/CLIHandler.pm
> @@ -485,7 +485,7 @@ my $handle_cmd  = sub {
>  
>  &$preparefunc() if $preparefunc;
>  
> -my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef->{$cmd} 
> || []};
> +my ($class, $name, $arg_param, $uri_param, $outsub) = @{$def || []};
>  $abort->("unknown command '$cmd_str'") if !$class;
>  
>  my $prefix = "$exename $cmd_str";
> -- 
> 2.14.2

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


[pve-devel] [PATCH pve-common 2/2] INotify.pm - new helper poll_changes

2018-01-22 Thread Dietmar Maurer
Useful to detect file changes.

Signed-off-by: Dietmar Maurer 
---
 src/PVE/INotify.pm | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index 1e5687b..445c034 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -199,6 +199,16 @@ sub discard_changes {
 return read_file ($filename, $full);
 }
 
+sub poll_changes {
+my ($filename) = @_;
+
+poll() if $inotify; # read new inotify events
+
+$versions->{$filename} = 0 if !defined ($versions->{$filename});
+
+return $versions->{$filename};
+}
+
 sub read_file {
 my ($fileid, $full) = @_;
 
@@ -211,11 +221,7 @@ sub read_file {
 my $fd;
 my $shadow;
 
-poll() if $inotify; # read new inotify events
-
-$versions->{$filename} = 0 if !defined ($versions->{$filename});
-
-my $cver = $versions->{$filename};
+my $cver = poll_changes($filename);
 
 if (my $copy = $shadowfiles->{$filename}) {
if ($fd = IO::File->new ($copy, "r")) {
-- 
2.11.0


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


[pve-devel] [PATCH pve-common 1/2] read_file: replace $versions->{$filename} with $cver

2018-01-22 Thread Dietmar Maurer
Signed-off-by: Dietmar Maurer 
---
 src/PVE/INotify.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
index a383040..1e5687b 100644
--- a/src/PVE/INotify.pm
+++ b/src/PVE/INotify.pm
@@ -240,11 +240,11 @@ sub read_file {
 
 # file unchanged?
 if (!$ccinfo->{nocache} &&
-   $inotify && $versions->{$filename} &&
+   $inotify && $cver &&
defined ($ccinfo->{data}) &&
defined ($ccinfo->{version}) &&
($ccinfo->{readonce} ||
-($ccinfo->{version} == $versions->{$filename}))) {
+($ccinfo->{version} == $cver))) {
 
my $ret;
if (!$noclone && ref ($ccinfo->{data})) {
-- 
2.11.0


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


[pve-devel] applied: [PATCH i18n v2] make only one po file per language

2018-01-22 Thread Dominik Csapak
applied, and also pushed directly the commit which delete the old po 
files and adds the po files from pve-manager


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


[pve-devel] applied: [PATCH i18n 1/2] add missing langs from pve

2018-01-22 Thread Dominik Csapak

applied

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


[pve-devel] [PATCH manager] use pve-i18n package

2018-01-22 Thread Dominik Csapak
Signed-off-by: Dominik Csapak 
---
 PVE/Service/pveproxy.pm | 3 ++-
 debian/control  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm
index ec1eb9a5..77dfaef1 100755
--- a/PVE/Service/pveproxy.pm
+++ b/PVE/Service/pveproxy.pm
@@ -49,6 +49,7 @@ my $basedirs = {
 novnc => '/usr/share/novnc-pve',
 extjs => '/usr/share/javascript/extjs',
 manager => '/usr/share/pve-manager',
+i18n => '/usr/share/pve-i18n',
 docs => '/usr/share/pve-docs',
 fontawesome => '/usr/share/fonts-font-awesome',
 xtermjs => '/usr/share/pve-xtermjs',
@@ -70,7 +71,7 @@ sub init {
 
 my $dirs = {};
 
-add_dirs($dirs, '/pve2/locale/', "$basedirs->{manager}/locale/");
+add_dirs($dirs, '/pve2/locale/', "$basedirs->{i18n}/");
 add_dirs($dirs, '/pve2/touch/', "$basedirs->{manager}/touch/");
 add_dirs($dirs, '/pve2/ext6/', "$basedirs->{extjs}/");
 add_dirs($dirs, '/pve2/images/' =>  "$basedirs->{manager}/images/");
diff --git a/debian/control b/debian/control
index c7d5a717..2ebfd94a 100644
--- a/debian/control
+++ b/debian/control
@@ -60,6 +60,7 @@ Depends: apt-transport-https,
  pve-docs,
  pve-firewall,
  pve-ha-manager,
+ pve-i18n (>= 1.0-3),
  pve-xtermjs (>= 0.1-1),
  qemu-server (>= 1.1-1),
  rsync,
-- 
2.11.0


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


[pve-devel] [PATCH i18n] buildsys: call lintian only on the package we built

2018-01-22 Thread Thomas Lamprecht
Else we call lintian on both packages twice.

Signed-off-by: Thomas Lamprecht 
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 65127f1..44e7705 100644
--- a/Makefile
+++ b/Makefile
@@ -24,8 +24,7 @@ $(DEBS): | submodule
rsync -a debian dest
make DESTDIR=dest install 
cd dest; dpkg-buildpackage -b -us -uc
-   lintian ${PMG_I18N_DEB}
-   lintian ${PVE_I18N_DEB}
+   lintian $@
 
 .PHONY: submodule
 submodule:
-- 
2.14.2


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


[pve-devel] applied: [PATCH i18n] buildsys: call lintian only on the package we built

2018-01-22 Thread Dominik Csapak

applied

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


[pve-devel] applied: [PATCH pve-common 1/2] read_file: replace $versions->{$filename} with $cver

2018-01-22 Thread Wolfgang Bumiller
applied both patches

On Mon, Jan 22, 2018 at 12:12:40PM +0100, Dietmar Maurer wrote:
> Signed-off-by: Dietmar Maurer 
> ---
>  src/PVE/INotify.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index a383040..1e5687b 100644
> --- a/src/PVE/INotify.pm
> +++ b/src/PVE/INotify.pm
> @@ -240,11 +240,11 @@ sub read_file {
>  
>  # file unchanged?
>  if (!$ccinfo->{nocache} &&
> - $inotify && $versions->{$filename} &&
> + $inotify && $cver &&
>   defined ($ccinfo->{data}) &&
>   defined ($ccinfo->{version}) &&
>   ($ccinfo->{readonce} ||
> -  ($ccinfo->{version} == $versions->{$filename}))) {
> +  ($ccinfo->{version} == $cver))) {
>  
>   my $ret;
>   if (!$noclone && ref ($ccinfo->{data})) {
> -- 
> 2.11.0

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


[pve-devel] applied: avoid possible harmful <> pattern when reading from STDIN

2018-01-22 Thread Wolfgang Bumiller
applied all patches

On Mon, Jan 22, 2018 at 10:52:10AM +0100, Thomas Lamprecht wrote:
> Fixes problems in CLIHandler using the code pattern:
> 
> while (my $line = <>) {
> ...
> }
> 
> For why this causes only _now_ problems lets first look how <>
> behaves:
> 
> "The null filehandle <> is special: [...] Input from <> comes either
> from standard input, or from each file listed on the command line.
> Here's how it works: the first time <> is evaluated, the @ARGV array
> is checked, and if it is empty, $ARGV[0] is set to "-" , which when
> opened gives you standard input.  The @ARGV array is then processed
> as a list of filenames." - 'perldoc perlop'
> 
> Recent changes in the CLIHandler code changed how we modfiied @ARGV
> Earlier we assumed that the first argument must be the command and
> thus shifted it out of @ARGV, now we can have multiple levels of
> (sub)commands. This change also changed how we handle @ARGV, we do
> not unshift anything but go through the arguments until we got to
> the final command and copy the rest of @ARGV as we know that this
> must be the commandos arguments.
> 
> For '<>' this means that ARGV was still fully populated and perl
> tried to open element as a file, which naturally failed.
> Thus the change in pve-common only exposed this 'dangerous' code
> pattern.
> 
> After I saw that all usages of this pattern in our code base are not
> required, and even rather dangerous I assembled this series by using:
> 
> find -iname '*.pm' -exec sed -i 's/= <>/= /g' {} \;

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


Re: [pve-devel] istgt in Debian Stretch

2018-01-22 Thread Andreas Steinel
On Sun, Jan 21, 2018 at 2:19 PM, Gilberto Nunes 
wrote:

> > Proxmox only accept COMSTAR, ISTGT and IET for ZFS over iSCSI backend.
> That's right?
>

According to the source code, yes
___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


Re: [pve-devel] istgt in Debian Stretch

2018-01-22 Thread Andreas Steinel
On Sun, Jan 21, 2018 at 1:14 PM, Gilberto Nunes 
wrote:

> Why not using some server with Ubuntu 16.04 which is LTS 'till 2021??
> This Ubuntu bring iSCSI Enterprise Target (iscsitarget-dkms).
> I have implemented this with some customers (iscsitarget + zfs), and work
> very well!
>

I also used it, yet iscsitarget-dkms is dead and xenial is the last Ubuntu
version with it. Debian Stretch has already dropped it, so I have to move
on.

You should also read about LTS, because iscsitarget-dkms is in universe,
so no LT(S) support exists.
___
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] [PATCH novnc v2 1/2] buildsys: write actual checked out git revision to SOURCE

2018-01-22 Thread Thomas Lamprecht
---

changes v1 -> v2:
* do not export SOURCE_DATE_EPOCH, already done by
  /usr/share/dpkg/pkg-info.mk

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 70d1925..537cd70 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,8 @@ PKGREL=4
 SRCDIR=novnc
 
 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
-GITVERSION:=$(shell cat .git/refs/heads/master)
+
+GITVERSION:=$(shell git rev-parse HEAD)
 
 DEB=${PACKAGE}_${VER}-${PKGREL}_${ARCH}.deb
 
-- 
2.14.2


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


[pve-devel] [PATCH novnc v2 2/2] buildsys: ad BUILDDIR variable

2018-01-22 Thread Thomas Lamprecht
allows easier reading
---

no changes

 Makefile | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 537cd70..427ac9f 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ VER=0.6
 PKGREL=4
 
 SRCDIR=novnc
+BUILDDIR=${SRCDIR}.tmp
 
 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
@@ -16,11 +17,11 @@ all: ${DEB}
 .PHONY: deb
 deb: ${DEB}
 ${DEB}: | submodule
-   rm -rf ${SRCDIR}.tmp
-   cp -rpa ${SRCDIR} ${SRCDIR}.tmp
-   cp -a debian ${SRCDIR}.tmp/
-   echo "git clone git://git.proxmox.com/git/novnc-pve.git\\ngit checkout 
${GITVERSION}" > ${SRCDIR}.tmp/debian/SOURCE
-   cd ${SRCDIR}.tmp; dpkg-buildpackage -rfakeroot -b -uc -us
+   rm -rf ${BUILDDIR}
+   cp -rpa ${SRCDIR} ${BUILDDIR}
+   cp -a debian ${BUILDDIR}
+   echo "git clone git://git.proxmox.com/git/novnc-pve.git\\ngit checkout 
${GITVERSION}" > ${BUILDDIR}/debian/SOURCE
+   cd ${BUILDDIR}; dpkg-buildpackage -rfakeroot -b -uc -us
lintian ${DEB}
@echo ${DEB}
 
@@ -41,7 +42,7 @@ distclean: clean
 
 .PHONY: clean
 clean:
-   rm -rf *~ debian/*~ *_${ARCH}.deb ${SRCDIR}.tmp *_all.deb *.changes 
*.dsc *.buildinfo
+   rm -rf *~ debian/*~ *.deb ${BUILDDIR} *.changes *.dsc *.buildinfo
 
 .PHONY: dinstall
 dinstall: deb
-- 
2.14.2


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