[pve-devel] [pve-guest-common 1/2] get_jobid

Dietmar Maurer dietmar at proxmox.com
Fri Jun 9 11:43:34 CEST 2017



> On June 9, 2017 at 11:17 AM Fabian Grünbichler <f.gruenbichler at proxmox.com>
> wrote:
> 
> 
> On Fri, Jun 09, 2017 at 08:19:47AM +0200, Wolfgang Link wrote:
> > ---
> >  PVE/ReplicationConfig.pm | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
> > index 01e7206..b4f0fe9 100644
> > --- a/PVE/ReplicationConfig.pm
> > +++ b/PVE/ReplicationConfig.pm
> > @@ -209,6 +209,20 @@ sub check_for_existing_jobs {
> >      return undef;
> >  }
> >  
> > +sub get_jobid {
> > +    my ($cfg, $vmid, $target) = @_;
> > +
> > +    foreach my $id (keys %{$cfg->{ids}}) {
> > +	my $data = $cfg->{ids}->{$id};
> > +
> > +	if ($data->{target} eq $target) {
> > +	    return $id;
> > +	}
> > +    }
> > +
> > +    return undef;
> > +}
> 
> doesn't this return the first job which has this target node? and not
> the only job which has this guest ID and target node?

We may also have different replication job types in future, and not all
of them have a 'target' property...




More information about the pve-devel mailing list