From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 5A0A27BB5E for ; Tue, 2 Nov 2021 16:03:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B5D13A93D for ; Tue, 2 Nov 2021 16:03:40 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 3AE9CA845 for ; Tue, 2 Nov 2021 16:03:37 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 12AEA46042 for ; Tue, 2 Nov 2021 16:03:37 +0100 (CET) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Tue, 2 Nov 2021 16:03:35 +0100 Message-Id: <20211102150335.2371545-10-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211102150335.2371545-1-a.lauterer@proxmox.com> References: <20211102150335.2371545-1-a.lauterer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.122 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH v4 container 9/9] api: move-volume: cleanup very long lines X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2021 15:03:41 -0000 Signed-off-by: Aaron Lauterer --- src/PVE/API2/LXC.pm | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm index afc16d7..d8afbbc 100644 --- a/src/PVE/API2/LXC.pm +++ b/src/PVE/API2/LXC.pm @@ -1847,13 +1847,15 @@ __PACKAGE__->register_method({ }), delete => { type => 'boolean', - description => "Delete the original volume after successful copy. By default the original is kept as an unused volume entry.", + description => "Delete the original volume after successful copy. By default the " . + "original is kept as an unused volume entry.", optional => 1, default => 0, }, digest => { type => 'string', - description => 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.', + description => 'Prevent changes if current configuration file has different SHA1 " . + "digest. This can be used to prevent concurrent modifications.', maxLength => 40, optional => 1, }, @@ -1936,7 +1938,11 @@ __PACKAGE__->register_method({ my $storage_realcmd = sub { eval { - PVE::Cluster::log_msg('info', $authuser, "move volume CT $vmid: move --volume $mpkey --storage $storage"); + PVE::Cluster::log_msg( + 'info', + $authuser, + "move volume CT $vmid: move --volume $mpkey --storage $storage" + ); my $conf = PVE::LXC::Config->load_config($vmid); my $storage_cfg = PVE::Storage::config(); @@ -1947,8 +1953,20 @@ __PACKAGE__->register_method({ PVE::Storage::activate_volumes($storage_cfg, [ $old_volid ]); my $bwlimit = extract_param($param, 'bwlimit'); my $source_storage = PVE::Storage::parse_volume_id($old_volid); - my $movelimit = PVE::Storage::get_bandwidth_limit('move', [$source_storage, $storage], $bwlimit); - $new_volid = PVE::LXC::copy_volume($mpdata, $vmid, $storage, $storage_cfg, $conf, undef, $movelimit); + my $movelimit = PVE::Storage::get_bandwidth_limit( + 'move', + [$source_storage, $storage], + $bwlimit + ); + $new_volid = PVE::LXC::copy_volume( + $mpdata, + $vmid, + $storage, + $storage_cfg, + $conf, + undef, + $movelimit + ); if (PVE::LXC::Config->is_template($conf)) { PVE::Storage::activate_volumes($storage_cfg, [ $new_volid ]); my $template_volid = PVE::Storage::vdisk_create_base($storage_cfg, $new_volid); @@ -1962,7 +1980,10 @@ __PACKAGE__->register_method({ $conf = PVE::LXC::Config->load_config($vmid); PVE::Tools::assert_if_modified($digest, $conf->{digest}); - $conf->{$mpkey} = PVE::LXC::Config->print_ct_mountpoint($mpdata, $mpkey eq 'rootfs'); + $conf->{$mpkey} = PVE::LXC::Config->print_ct_mountpoint( + $mpdata, + $mpkey eq 'rootfs' + ); PVE::LXC::Config->add_unused_volume($conf, $old_volid) if !$param->{delete}; -- 2.30.2