[pve-devel] [PATCH pve-guest-common 1/2] Add check if guest exists.

Dietmar Maurer dietmar at proxmox.com
Fri Jun 2 12:14:00 CEST 2017


This is also totally unrelated to replication??

suggestion: move to GuestHelpers 

> On June 2, 2017 at 11:04 AM Wolfgang Link <w.link at proxmox.com> wrote:
> 
> 
> ---
>  PVE/ReplicationConfig.pm | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/PVE/ReplicationConfig.pm b/PVE/ReplicationConfig.pm
> index 092c497..87b3710 100644
> --- a/PVE/ReplicationConfig.pm
> +++ b/PVE/ReplicationConfig.pm
> @@ -186,6 +186,13 @@ sub check_for_existing_jobs {
>      return undef;
>  }
>  
> +sub guest_exists {
> +    my ($class, $vmid) = @_;
> +
> +    die "please overwrite in subclass";
> +
> +}
> +
>  package PVE::ReplicationConfig::Cluster;
>  
>  use base qw(PVE::ReplicationConfig);
> @@ -221,6 +228,14 @@ sub get_unique_target_id {
>      return "local/$data->{target}";
>  }
>  
> +sub guest_exists {
> +    my ($class, $vmid) = @_;
> +
> +    my $vmlist = PVE::Cluster::get_vmlist();
> +
> +    return defined($vmlist->{ids}->{$vmid});
> +}
> +
>  PVE::ReplicationConfig::Cluster->register();
>  PVE::ReplicationConfig->init();
>  
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list