[pve-devel] [PATCH installer 0/1] fix #4869: Show state in management interface ComboBox

2023-08-04 Thread Filip Schauer
This can be tested by modifying an existing Proxmox-VE ISO file as
described in the following forum post:

https://forum.proxmox.com/threads/create-custom-pve-iso-from-original-pve-iso.123606/post-538612

Filip Schauer (1):
  fix #4869: Show state in management interface ComboBox

 proxinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.39.2



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



[pve-devel] [PATCH installer 1/1] fix #4869: Show state in management interface ComboBox

2023-08-04 Thread Filip Schauer
Signed-off-by: Filip Schauer 
---
 proxinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index d5b2565..9316578 100755
--- a/proxinstall
+++ b/proxinstall
@@ -347,7 +347,7 @@ sub create_ipconf_view {
 
 my $get_device_desc = sub {
my $iface = shift;
-   return "$iface->{name} - $iface->{mac} ($iface->{driver})";
+   return "$iface->{name} - $iface->{mac} ($iface->{driver}) - 
$iface->{state}";
 };
 
 my $run_env = Proxmox::Install::RunEnv::get();
-- 
2.39.2



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



[pve-devel] applied: [PATCH common v4 1/2] fix #4849: download file from url: add opt parameter for a decompression command

2023-08-04 Thread Fabian Grünbichler
with a few follow-ups.

On August 1, 2023 4:46 pm, Philipp Hufnagl wrote:
> Signed-off-by: Philipp Hufnagl 
> ---
>  src/PVE/Tools.pm | 31 +--
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index 9ffac12..159ec82 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -2013,10 +2013,13 @@ sub download_file_from_url {
>   }
>  }
>  
> -my $tmpdest = "$dest.tmp.$$";
> +my $tmp_download = "$dest.tmp_dwnl.$$";
> +my $tmp_decomp = "$dest.tmp_dcom.$$";
>  eval {
>   local $SIG{INT} = sub {
> - unlink $tmpdest or warn "could not cleanup temporary file: $!";
> + unlink $tmp_download or warn "could not cleanup temporary file: $!";
> + unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
> + if $opts->{decompression_command};
>   die "got interrupted by signal\n";
>   };
>  
> @@ -2029,7 +2032,7 @@ sub download_file_from_url {
>   $ENV{https_proxy} = $opts->{https_proxy};
>   }
>  
> - my $cmd = ['wget', '--progress=dot:giga', '-O', $tmpdest, $url];
> + my $cmd = ['wget', '--progress=dot:giga', '-O', $tmp_download, 
> $url];
>  
>   if (!($opts->{verify_certificates} // 1)) { # default to true
>   push @$cmd, '--no-check-certificate';
> @@ -2041,7 +2044,7 @@ sub download_file_from_url {
>   if ($checksum_algorithm) {
>   print "calculating checksum...";
>  
> - my $checksum_got = get_file_hash($checksum_algorithm, $tmpdest);
> + my $checksum_got = get_file_hash($checksum_algorithm, 
> $tmp_download);
>  
>   if (lc($checksum_got) eq lc($checksum_expected)) {
>   print "OK, checksum verified\n";
> @@ -2051,10 +2054,26 @@ sub download_file_from_url {
>   }
>   }
>  
> - rename($tmpdest, $dest) or die "unable to rename temporary file: $!\n";
> +if (my $cmd = $opts->{decompression_command}) {
> + push @$cmd, $tmp_download;
> +my $fh;
> +if (!open($fh, ">", "$tmp_decomp")) {
> + die "cant open temporary file $tmp_decomp for decompresson: $!\n";
> +}
> + print "decompressing $tmp_download to $tmp_decomp\n";
> + eval { run_command($cmd, output => '>&'.fileno($fh)); };
> + my $err = $@;
> + unlink $tmp_download;
> + die "$err\n" if $err;
> + rename($tmp_decomp, $dest) or die "unable to rename temporary file: 
> $!\n";
> +} else {
> + rename($tmp_download, $dest) or die "unable to rename temporary file: 
> $!\n";
> +}
>  };
>  if (my $err = $@) {
> - unlink $tmpdest or warn "could not cleanup temporary file: $!";
> + unlink $tmp_download or warn "could not cleanup temporary file: $!";
> + unlink $tmp_decomp or warn "could not cleanup temporary file: $!"
> + if $opts->{decompression_command};
>   die $err;
>  }
>  
> -- 
> 2.39.2
> 
> 
> 
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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



[pve-devel] applied: [PATCH common v4 2/2] fix whitespaces

2023-08-04 Thread Fabian Grünbichler
the indentation part, skipping the alignment hunks as discussed
off-list.

On August 1, 2023 4:46 pm, Philipp Hufnagl wrote:
> Signed-off-by: Philipp Hufnagl 
> ---
>  src/PVE/Tools.pm | 30 +++---
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index 159ec82..28e70f0 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -92,23 +92,23 @@ our $EMAIL_USER_RE = qr/[\w\+\-\~]+(\.[\w\+\-\~]+)*/;
>  our $EMAIL_RE = qr/$EMAIL_USER_RE@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*/;
>  
>  use constant {CLONE_NEWNS   => 0x0002,
> -  CLONE_NEWUTS  => 0x0400,
> -  CLONE_NEWIPC  => 0x0800,
> -  CLONE_NEWUSER => 0x1000,
> -  CLONE_NEWPID  => 0x2000,
> -  CLONE_NEWNET  => 0x4000};
> + CLONE_NEWUTS  => 0x0400,
> + CLONE_NEWIPC  => 0x0800,
> + CLONE_NEWUSER => 0x1000,
> + CLONE_NEWPID  => 0x2000,
> + CLONE_NEWNET  => 0x4000};
>  
>  use constant {O_PATH=> 0x0020,
> -  O_CLOEXEC => 0x0008,
> -  O_TMPFILE => 0x0040 | O_DIRECTORY};
> + O_CLOEXEC => 0x0008,
> + O_TMPFILE => 0x0040 | O_DIRECTORY};
>  
>  use constant {AT_EMPTY_PATH => 0x1000,
> -  AT_FDCWD => -100};
> + AT_FDCWD => -100};
>  
>  # from 
>  use constant {RENAME_NOREPLACE => (1 << 0),
> -  RENAME_EXCHANGE  => (1 << 1),
> -  RENAME_WHITEOUT  => (1 << 2)};
> + RENAME_EXCHANGE  => (1 << 1),
> + RENAME_WHITEOUT  => (1 << 2)};
>  
>  sub run_with_timeout {
>  my ($timeout, $code, @param) = @_;
> @@ -579,7 +579,7 @@ sub run_command {
>   }
>   }
>  
> -alarm(0);
> + alarm(0);
>  };
>  
>  my $err = $@;
> @@ -1354,7 +1354,7 @@ sub dump_journal {
>  my $parser = sub {
>   my $line = shift;
>  
> -return if $count++ < $start;
> + return if $count++ < $start;
>   return if $limit <= 0;
>   push @$lines, { n => int($count), t => $line};
>   $limit--;
> @@ -1441,7 +1441,7 @@ sub unpack_sockaddr_in46 {
>  my ($sin) = @_;
>  my $family = Socket::sockaddr_family($sin);
>  my ($port, $host) = ($family == AF_INET6 ? 
> Socket::unpack_sockaddr_in6($sin)
> - : 
> Socket::unpack_sockaddr_in($sin));
> + : Socket::unpack_sockaddr_in($sin));
>  return ($family, $port, $host);
>  }
>  
> @@ -1485,8 +1485,8 @@ sub get_fqdn {
>  sub parse_host_and_port {
>  my ($address) = @_;
>  if ($address =~ /^($IPV4RE|[[:alnum:]\-.]+)(?::(\d+))?$/ || 
> # ipv4 or host with optional ':port'
> -$address =~ /^\[($IPV6RE|$IPV4RE|[[:alnum:]\-.]+)\](?::(\d+))?$/ || 
> # anything in brackets with optional ':port'
> -$address =~ /^($IPV6RE)(?:\.(\d+))?$/)  
> # ipv6 with optional port separated by dot
> + $address =~ /^\[($IPV6RE|$IPV4RE|[[:alnum:]\-.]+)\](?::(\d+))?$/ || # 
> anything in brackets with optional ':port'
> + $address =~ /^($IPV6RE)(?:\.(\d+))?$/)  # 
> ipv6 with optional port separated by dot
>  {
>   return ($1, $2, 1); # end with 1 to support simple if(parse...) tests
>  }
> -- 
> 2.39.2
> 
> 
> 
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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



[pve-devel] applied: [PATCH storage v4 2/2] fix whitespaces

2023-08-04 Thread Fabian Grünbichler
again, limited to the non-alignmnet changes

On August 1, 2023 4:46 pm, Philipp Hufnagl wrote:
> Signed-off-by: Philipp Hufnagl 
> ---
>  src/PVE/Storage/Plugin.pm | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 18cb5d5..1795ae3 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -264,7 +264,7 @@ sub verify_server {
>  my ($server, $noerr) = @_;
>  
>  if (!(PVE::JSONSchema::pve_verify_ip($server, 1) ||
> -  PVE::JSONSchema::pve_verify_dns_name($server, 1)))
> +   PVE::JSONSchema::pve_verify_dns_name($server, 1)))
>  {
>   return undef if $noerr;
>   die "value does not look like a valid server name or IP address\n";
> @@ -472,7 +472,7 @@ sub encode_value {
>  my ($class, $type, $key, $value) = @_;
>  
>  if ($key eq 'nodes') {
> -return join(',', keys(%$value));
> + return join(',', keys(%$value));
>  } elsif ($key eq 'content') {
>   my $res = content_hash_to_string($value) || 'none';
>   return $res;
> @@ -1153,9 +1153,9 @@ sub volume_has_feature {
>  
>  my $key = undef;
>  if($snapname){
> -$key = 'snap';
> + $key = 'snap';
>  }else{
> -$key =  $isBase ? 'base' : 'current';
> + $key =  $isBase ? 'base' : 'current';
>  }
>  
>  return 1 if defined($features->{$feature}->{$key}->{$format});
> @@ -1199,14 +1199,14 @@ sub list_images {
>   next if !$found;
>   }
>  
> -my $info = {
> + my $info = {
>   volid => $volid, format => $format,
>   size => $size, vmid => $owner, used => $used, parent => $parent
>   };
>  
> -$info->{ctime} = $ctime if $ctime;
> + $info->{ctime} = $ctime if $ctime;
>  
> -push @$res, $info;
> + push @$res, $info;
>  }
>  
>  return $res;
> @@ -1580,7 +1580,7 @@ sub volume_export {
>   run_command(['dd', "if=$file", "bs=4k"], output => 
> '>&'.fileno($fh));
>   } else {
>   run_command(['qemu-img', 'convert', '-f', $file_format, '-O', 
> 'raw', $file, '/dev/stdout'],
> - output => '>&'.fileno($fh));
> + output => '>&'.fileno($fh));
>   }
>   return;
>   } elsif ($format =~ /^(qcow2|vmdk)\+size$/) {
> @@ -1593,7 +1593,7 @@ sub volume_export {
>   goto unsupported if $file_format ne 'subvol';
>   write_common_header($fh, $size);
>   run_command(['tar', @COMMON_TAR_FLAGS, '-cf', '-', '-C', $file, 
> '.'],
> - output => '>&'.fileno($fh));
> + output => '>&'.fileno($fh));
>   return;
>   }
>  }
> @@ -1662,10 +1662,10 @@ sub volume_import {
>   or die "internal error: failed to get path to newly allocated 
> volume $volname\n";
>   if ($data_format eq 'raw' || $data_format eq 'qcow2' || $data_format eq 
> 'vmdk') {
>   run_command(['dd', "of=$file", 'conv=sparse', 'bs=64k'],
> - input => '<&'.fileno($fh));
> + input => '<&'.fileno($fh));
>   } elsif ($data_format eq 'tar') {
>   run_command(['tar', @COMMON_TAR_FLAGS, '-C', $file, '-xf', '-'],
> - input => '<&'.fileno($fh));
> + input => '<&'.fileno($fh));
>   } else {
>   die "volume import format '$format' not available for $class";
>   }
> -- 
> 2.39.2
> 
> 
> 
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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



[pve-devel] applied: [PATCH manager v4 2/2] fix whitespaces

2023-08-04 Thread Fabian Grünbichler
On August 1, 2023 4:46 pm, Philipp Hufnagl wrote:
> Signed-off-by: Philipp Hufnagl 
> ---
>  PVE/API2/Nodes.pm   | 16 
>  www/manager6/window/DownloadUrlToStorage.js |  4 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index 2bae4e6f..6fa138fb 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -496,7 +496,7 @@ __PACKAGE__->register_method({
>   # just parse the json again, it should already be validated
>   my $commands = eval { decode_json($param->{commands}); };
>  
> -foreach my $cmd (@$commands) {
> + foreach my $cmd (@$commands) {
>   eval {
>   $cmd->{args} //= {};
>  
> @@ -654,11 +654,11 @@ __PACKAGE__->register_method({
>   },
>   ds => {
>   description => "The list of datasources you want to display.",
> - type => 'string', format => 'pve-configid-list',
> + type => 'string', format => 'pve-configid-list',
>   },
>   cf => {
>   description => "The RRD consolidation function",
> - type => 'string',
> + type => 'string',
>   enum => [ 'AVERAGE', 'MAX' ],
>   optional => 1,
>   },
> @@ -699,7 +699,7 @@ __PACKAGE__->register_method({
>   },
>   cf => {
>   description => "The RRD consolidation function",
> - type => 'string',
> + type => 'string',
>   enum => [ 'AVERAGE', 'MAX' ],
>   optional => 1,
>   },
> @@ -1368,7 +1368,7 @@ __PACKAGE__->register_method({
>  description => "Read server time and time zone settings.",
>  proxyto => 'node',
>  parameters => {
> - additionalProperties => 0,
> + additionalProperties => 0,
>   properties => {
>   node => get_standard_option('pve-node'),
>   },
> @@ -1393,7 +1393,7 @@ __PACKAGE__->register_method({
>   minimum => 1297163644,
>   renderer => 'timestamp_gmt',
>   },
> -},
> + },
>  },
>  code => sub {
>   my ($param) = @_;
> @@ -2105,14 +2105,14 @@ __PACKAGE__->register_method ({
>   additionalProperties => 0,
>   properties => {
>   node => get_standard_option('pve-node'),
> -target => get_standard_option('pve-node', { description => 
> "Target node." }),
> + target => get_standard_option('pve-node', { description => "Target 
> node." }),
>   maxworkers => {
>   description => "Maximal number of parallel migration job. If 
> not set, uses"
>   ."'max_workers' from datacenter.cfg. One of both must be 
> set!",
>   optional => 1,
>   type => 'integer',
>   minimum => 1
> -},
> + },
>   vms => {
>   description => "Only consider Guests with these IDs.",
>   type => 'string',  format => 'pve-vmid-list',
> diff --git a/www/manager6/window/DownloadUrlToStorage.js 
> b/www/manager6/window/DownloadUrlToStorage.js
> index 7a472ce9..559a1c05 100644
> --- a/www/manager6/window/DownloadUrlToStorage.js
> +++ b/www/manager6/window/DownloadUrlToStorage.js
> @@ -220,7 +220,7 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>  ],
>  
>  initComponent: function() {
> -var me = this;
> + var me = this;
>  
>   if (!me.nodename) {
>   throw "no node name specified";
> @@ -241,7 +241,7 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>   });
>   }
>  
> -me.callParent();
> + me.callParent();
>  },
>  });
>  
> -- 
> 2.39.2
> 
> 
> 
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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



Re: [pve-devel] [PATCH storage v4 1/2] fix #4849: download-url: allow download and decompression of compressed ISOs

2023-08-04 Thread Fabian Grünbichler
On August 1, 2023 4:45 pm, Philipp Hufnagl wrote:

a bit of description here would be nice..

that being said,

Reviewed-by: Fabian Grünbichler 
Tested-by: Fabian Grünbichler 

can be applied with a corresponding bumped dep on libpve-common-perl
after that one has been released!

> Signed-off-by: Philipp Hufnagl 
> ---
>  src/PVE/API2/Storage/Status.pm | 14 +-
>  src/PVE/Storage.pm |  6 ++
>  src/PVE/Storage/Plugin.pm  |  3 ++-
>  3 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm
> index 2aaeff6..7875530 100644
> --- a/src/PVE/API2/Storage/Status.pm
> +++ b/src/PVE/API2/Storage/Status.pm
> @@ -578,6 +578,12 @@ __PACKAGE__->register_method({
>   requires => 'checksum-algorithm',
>   optional => 1,
>   },
> + compression => {
> + description => "Decompress the downloaded file using specified 
> compression algorithm",
> + type => 'string',
> + enum => $PVE::Storage::Plugin::KNOWN_COMPRESSION_FORMATS,
> + optional => 1,
> + },
>   'checksum-algorithm' => {
>   description => "The algorithm to calculate the checksum of the 
> file.",
>   type => 'string',
> @@ -604,7 +610,7 @@ __PACKAGE__->register_method({
>  
>   my $cfg = PVE::Storage::config();
>  
> - my ($node, $storage) = $param->@{'node', 'storage'};
> + my ($node, $storage, $compression) = $param->@{'node', 
> 'storage','compression'};
>   my $scfg = PVE::Storage::storage_check_enabled($cfg, $storage, $node);
>  
>   die "can't upload to storage type '$scfg->{type}', not a file based 
> storage!\n"
> @@ -649,6 +655,12 @@ __PACKAGE__->register_method({
>   }
>  
>   my $worker = sub {
> + if ($compression) {
> + die "decompression not supported for $content\n" if $content ne 
> 'iso';
> + my $info = PVE::Storage::decompressor_info('iso', $compression);
> + die "no decompression method found\n" if (! 
> $info->{decompressor});
> + $opts->{decompression_command} = $info->{decompressor};
> + }
>   PVE::Tools::download_file_from_url("$path/$filename", $url, $opts);
>   };
>  
> diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
> index a4d85e1..cb70113 100755
> --- a/src/PVE/Storage.pm
> +++ b/src/PVE/Storage.pm
> @@ -1531,6 +1531,12 @@ sub decompressor_info {
>   lzo => ['lzop', '-d', '-c'],
>   zst => ['zstd', '-q', '-d', '-c'],
>   },
> + iso => {
> + # zstd seem to be able to handle .gzip fine. Therefore we dont need 
> additional other tool
> + gz => ['zcat'],
> + lzo => ['lzop', '-d', '-c'],
> + zst => ['zstd', '-q', '-d', '-c'],
> + },
>  };
>  
>  die "ERROR: archive format not defined\n"
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 9d3b1ae..18cb5d5 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -19,7 +19,8 @@ use JSON;
>  
>  use base qw(PVE::SectionConfig);
>  
> -use constant COMPRESSOR_RE => 'gz|lzo|zst';
> +use constant KNOWN_COMPRESSION_FORMATS =>  ( 'gz', 'lzo', 'zst');
> +use constant COMPRESSOR_RE => join( '|', KNOWN_COMPRESSION_FORMATS);
>  
>  use constant LOG_EXT => ".log";
>  use constant NOTES_EXT => ".notes";
> -- 
> 2.39.2
> 
> 
> 
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 


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


Re: [pve-devel] [PATCH manager v4 1/2] fix #4849: download to storage: automatically dectect and configure compression

2023-08-04 Thread Fabian Grünbichler
On August 1, 2023 4:46 pm, Philipp Hufnagl wrote:

same here - please add a commit message!

with one nit below that could be folded in together with the commit
message, after pve-common and pve-storage have been bumped, since this
one requires their changes and a corresponding bump in d/control:

Reviewed-by: Fabian Grünbichler 
Tested-by: Fabian Grünbichler 

> Signed-off-by: Philipp Hufnagl 
> ---
>  PVE/API2/Nodes.pm   | 21 -
>  www/manager6/Makefile   |  1 +
>  www/manager6/form/DecompressionSelector.js  | 13 +
>  www/manager6/window/DownloadUrlToStorage.js | 17 +
>  4 files changed, 51 insertions(+), 1 deletion(-)
>  create mode 100644 www/manager6/form/DecompressionSelector.js
> 
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index 9269694d..2bae4e6f 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -1564,6 +1564,12 @@ __PACKAGE__->register_method({
>   type => 'boolean',
>   optional => 1,
>   default => 1,
> + },
> + 'detect-compression' => {
> + description => "If true an auto detect of used compression will 
> be attempted",
> + type => 'boolean',
> + optional => 1,
> + default => 0,
>   }
>   },
>  },
> @@ -1583,6 +1589,11 @@ __PACKAGE__->register_method({
>   type => 'string',
>   optional => 1,
>   },
> + compression => {
> + type => 'string',
> + enum => $PVE::Storage::Plugin::KNOWN_COMPRESSION_FORMATS,
> + optional => 1,
> + },
>   },
>  },
>  code => sub {
> @@ -1606,6 +1617,8 @@ __PACKAGE__->register_method({
>   );
>   }
>  
> + my $detect_compression = $param->{'detect-compression'};
> +
>   my $req = HTTP::Request->new(HEAD => $url);
>   my $res = $ua->request($req);
>  
> @@ -1614,7 +1627,7 @@ __PACKAGE__->register_method({
>   my $size = $res->header("Content-Length");
>   my $disposition = $res->header("Content-Disposition");
>   my $type = $res->header("Content-Type");
> -
> + my $compression;
>   my $filename;
>  
>   if ($disposition && ($disposition =~ m/filename="([^"]*)"/ || 
> $disposition =~ m/filename=([^;]*)/)) {
> @@ -1628,10 +1641,16 @@ __PACKAGE__->register_method({
>   $type = $1;
>   }
>  
> + if ($detect_compression && $filename =~ 
> m!^((.+)\.(${\PVE::Storage::Plugin::COMPRESSOR_RE}))$!) {
> + $filename = $2;
> + $compression = $3;
> + }
> +
>   my $ret = {};
>   $ret->{filename} = $filename if $filename;
>   $ret->{size} = $size + 0 if $size;
>   $ret->{mimetype} = $type if $type;
> + $ret->{compression} = $compression if $compression;
>  
>   return $ret;
>  }});
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 7ec9d7a5..42a27548 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -34,6 +34,7 @@ JSSRC=  
> \
>   form/ContentTypeSelector.js \
>   form/ControllerSelector.js  \
>   form/DayOfWeekSelector.js   \
> + form/DecompressionSelector.js   \
>   form/DiskFormatSelector.js  \
>   form/DiskStorageSelector.js \
>   form/EmailNotificationSelector.js   \
> diff --git a/www/manager6/form/DecompressionSelector.js 
> b/www/manager6/form/DecompressionSelector.js
> new file mode 100644
> index ..b85e050c
> --- /dev/null
> +++ b/www/manager6/form/DecompressionSelector.js
> @@ -0,0 +1,13 @@
> +Ext.define('PVE.form.DecompressionSelector', {
> +extend: 'Proxmox.form.KVComboBox',
> +alias: ['widget.pveDecompressionSelector'],
> +config: {
> + deleteEmpty: false,
> +},
> +comboItems: [
> + ['__default__', Proxmox.Utils.noneText],

nit: this should be NoneText , not noneText, to get the right
capitalization.

> + ['lzo', 'LZO'],
> + ['gz', 'GZIP'],
> + ['zst', 'ZSTD'],
> +],
> +});
> diff --git a/www/manager6/window/DownloadUrlToStorage.js 
> b/www/manager6/window/DownloadUrlToStorage.js
> index 48543d28..7a472ce9 100644
> --- a/www/manager6/window/DownloadUrlToStorage.js
> +++ b/www/manager6/window/DownloadUrlToStorage.js
> @@ -49,6 +49,9 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>   vm.set('size', '-');
>   vm.set('mimetype', '-');
>   },
> + decompressionPossible: function() {
> + return this.view.content === 'iso';
> + },
>  
>   urlCheck: function(field) {
>   let me = this;
> @@ -66,6 +69,7 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>   params: {
>   url: queryParam.url,
>   'verify-certificates': queryParam['verify-cer

[pve-devel] [PATCH qemu] backup: drop broken BACKUP_FORMAT_DIR

2023-08-04 Thread Fiona Ebner
Since upstream QEMU 8.0, it's no longer possible to call
bdrv_img_create() from a coroutine anymore, meaning a backup with the
directory format would crash the QEMU instance.

The feature is only exposed via the monitor and was intended to be
experimental. There were no user reports about the breakage and it
only was noticed during the rebase for QEMU 8.1, because other parts
of the backup code needed adaptation and I decided to check the
BACKUP_FORMAT_DIR case too.

It should not stay in a broken state of course, but avoid the
maintenance cost and just make it a removed feature for Proxmox VE 8
retroactively.

Signed-off-by: Fiona Ebner 
---
 ...ckup-Proxmox-backup-patches-for-QEMU.patch | 92 +--
 ...k-driver-to-map-backup-archives-into.patch |  8 +-
 ...igrate-dirty-bitmap-state-via-savevm.patch | 10 +-
 3 files changed, 32 insertions(+), 78 deletions(-)

diff --git 
a/debian/patches/pve/0030-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch 
b/debian/patches/pve/0030-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch
index 3753eff..1f88285 100644
--- a/debian/patches/pve/0030-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch
+++ b/debian/patches/pve/0030-PVE-Backup-Proxmox-backup-patches-for-QEMU.patch
@@ -83,20 +83,20 @@ Signed-off-by: Wolfgang Bumiller 
 Signed-off-by: Fiona Ebner 
 ---
  block/meson.build  |5 +
- block/monitor/block-hmp-cmds.c |   40 ++
+ block/monitor/block-hmp-cmds.c |   39 ++
  blockdev.c |1 +
  hmp-commands-info.hx   |   14 +
- hmp-commands.hx|   31 +
+ hmp-commands.hx|   29 +
  include/monitor/hmp.h  |3 +
  meson.build|1 +
  monitor/hmp-cmds.c |   72 +++
  proxmox-backup-client.c|  146 +
  proxmox-backup-client.h|   60 ++
- pve-backup.c   | 1097 
- qapi/block-core.json   |  226 +++
+ pve-backup.c   | 1051 
+ qapi/block-core.json   |  229 +++
  qapi/common.json   |   13 +
  qapi/machine.json  |   15 +-
- 14 files changed, 1711 insertions(+), 13 deletions(-)
+ 14 files changed, 1665 insertions(+), 13 deletions(-)
  create mode 100644 proxmox-backup-client.c
  create mode 100644 proxmox-backup-client.h
  create mode 100644 pve-backup.c
@@ -118,10 +118,10 @@ index f580f95395..5bcebb934b 100644
  softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
  softmmu_ss.add(files('block-ram-registrar.c'))
 diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
-index ca2599de44..636509b83e 100644
+index ca2599de44..6efe28cef5 100644
 --- a/block/monitor/block-hmp-cmds.c
 +++ b/block/monitor/block-hmp-cmds.c
-@@ -1029,3 +1029,43 @@ void hmp_change_medium(Monitor *mon, const char 
*device, const char *target,
+@@ -1029,3 +1029,42 @@ void hmp_change_medium(Monitor *mon, const char 
*device, const char *target,
  qmp_blockdev_change_medium(device, NULL, target, arg, true, force,
 !!read_only, read_only_mode, errp);
  }
@@ -139,7 +139,6 @@ index ca2599de44..636509b83e 100644
 +{
 +Error *error = NULL;
 +
-+int dir = qdict_get_try_bool(qdict, "directory", 0);
 +const char *backup_file = qdict_get_str(qdict, "backupfile");
 +const char *devlist = qdict_get_try_str(qdict, "devlist");
 +int64_t speed = qdict_get_try_int(qdict, "speed", 0);
@@ -157,7 +156,7 @@ index ca2599de44..636509b83e 100644
 +false, false, // PBS use-dirty-bitmap
 +false, false, // PBS compress
 +false, false, // PBS encrypt
-+true, dir ? BACKUP_FORMAT_DIR : BACKUP_FORMAT_VMA,
++true, BACKUP_FORMAT_VMA,
 +NULL, NULL,
 +devlist, qdict_haskey(qdict, "speed"), speed,
 +false, 0, // BackupPerf max-workers
@@ -203,10 +202,10 @@ index a166bff3d5..4b75966c2e 100644
  {
  .name   = "usernet",
 diff --git a/hmp-commands.hx b/hmp-commands.hx
-index d9f9f42d11..775518fb09 100644
+index d9f9f42d11..ddb9678dc3 100644
 --- a/hmp-commands.hx
 +++ b/hmp-commands.hx
-@@ -101,6 +101,37 @@ ERST
+@@ -101,6 +101,35 @@ ERST
  SRST
  ``block_stream``
Copy data from a backing file into a block device.
@@ -214,11 +213,9 @@ index d9f9f42d11..775518fb09 100644
 +
 +   {
 +.name   = "backup",
-+.args_type  = "directory:-d,backupfile:s,speed:o?,devlist:s?",
-+.params = "[-d] backupfile [speed [devlist]]",
-+.help   = "create a VM Backup."
-+  "\n\t\t\t Use -d to dump data into a directory instead"
-+  "\n\t\t\t of using VMA format.",
++.args_type  = "backupfile:s,speed:o?,devlist:s?",
++.params = "backupfile [speed [devlist]]",
++.help   = "create a VM backup (VMA format).",
 +.cmd = hmp_backup,
 +.coroutine  = true,
 +},
@@ -587,10 +584,10 @@ index 00..8c