public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 guest-common 1/5] Add move_config_to_node method
@ 2020-08-20  9:11 Fabian Ebner
  2020-08-20  9:11 ` [pve-devel] [PATCH v2 container 2/5] Use new " Fabian Ebner
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Fabian Ebner @ 2020-08-20  9:11 UTC (permalink / raw)
  To: pve-devel

allows to mock it when testing and a few lines less duplication
between the migration modules.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-24  7:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  9:11 [pve-devel] [PATCH v2 guest-common 1/5] Add move_config_to_node method Fabian Ebner
2020-08-20  9:11 ` [pve-devel] [PATCH v2 container 2/5] Use new " Fabian Ebner
2020-08-20  9:11 ` [pve-devel] [PATCH v2 qemu-server 3/5] " Fabian Ebner
2020-08-20  9:11 ` [pve-devel] [PATCH v2 qemu-server 4/5] migration: factor out starting remote tunnel Fabian Ebner
2020-08-20  9:11 ` [pve-devel] [PATCH v2 qemu-server 5/5] create test environment for QemuMigrate.pm Fabian Ebner
2020-08-24  7:45 ` [pve-devel] applied: [PATCH v2 guest-common 1/5] Add move_config_to_node method Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal