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 164BD62141 for ; Thu, 20 Aug 2020 11:11:49 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F152F2BB6E for ; Thu, 20 Aug 2020 11:11:48 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 AD5E12BB4D for ; Thu, 20 Aug 2020 11:11:47 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5F7BF44741 for ; Thu, 20 Aug 2020 11:11:47 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Thu, 20 Aug 2020 11:11:38 +0200 Message-Id: <20200820091142.23210-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.003 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [abstractconfig.pm] Subject: [pve-devel] [PATCH v2 guest-common 1/5] Add move_config_to_node method 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: Thu, 20 Aug 2020 09:11:49 -0000 allows to mock it when testing and a few lines less duplication between the migration modules. Signed-off-by: Fabian Ebner --- Dependency bumps {qemu-server,container} -> guest-common are needed. Changes from v1: * collect patches into one series * many new tests and improvements to the test modules, see last patch PVE/AbstractConfig.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm index 4c9ad2c..5d1b662 100644 --- a/PVE/AbstractConfig.pm +++ b/PVE/AbstractConfig.pm @@ -274,6 +274,18 @@ sub destroy_config { unlink $config_fn or die "failed to remove config file: $!\n"; } +# moves configuration owned by calling node to the target node. +# dies if renaming fails. +sub move_config_to_node { + my ($class, $vmid, $target_node) = @_; + + my $config_fn = $class->config_file($vmid); + my $new_config_fn = $class->config_file($vmid, $target_node); + + rename($config_fn, $new_config_fn) + or die "failed to move config file to node '$target_node': $!\n"; +} + my $lock_file_full_wrapper = sub { my ($class, $vmid, $timeout, $shared, $realcode, @param) = @_; -- 2.20.1