5
0
mirror of git://git.proxmox.com/git/pve-guest-common.git synced 2025-03-12 20:58:20 +03:00

Add move_config_to_node method

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>
This commit is contained in:
Fabian Ebner 2020-08-20 11:11:38 +02:00 committed by Thomas Lamprecht
parent 0d9520c415
commit 659061237c

View File

@ -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) = @_;