5
0
mirror of git://git.proxmox.com/git/pve-guest-common.git synced 2024-12-24 21:34:13 +03:00

PVE::ReplicationState::extract_vmid_tranfer_state - new helper

moved from PVE::QemuMigrate
This commit is contained in:
Dietmar Maurer 2017-06-21 12:24:06 +02:00
parent 18c369255d
commit 210a5f7970

View File

@ -62,6 +62,20 @@ sub extract_job_state {
return $state;
}
sub extract_vmid_tranfer_state {
my ($stateobj, $vmid, $old_target, $new_target) = @_;
my $oldid = PVE::ReplicationConfig::Cluster->get_unique_target_id({ target => $old_target });
my $newid = PVE::ReplicationConfig::Cluster->get_unique_target_id({ target => $new_target });
if (defined(my $vmstate = $stateobj->{$vmid})) {
$vmstate->{$newid} = delete($vmstate->{$oldid}) if defined($vmstate->{$oldid});
return $vmstate;
}
return {};
}
sub read_job_state {
my ($jobcfg) = @_;