[pve-devel] [PATCH common v3] add upid_wait method

Dietmar Maurer dietmar at proxmox.com
Tue Jan 26 06:33:50 CET 2016


comments inline:

> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index 64a57e9..58d943c 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -940,6 +940,26 @@ sub upid_read_status {
>      return "unable to read tail (got $br bytes)";
>  }
>  
> +sub upid_wait {
> +    my ($upid, $waitfunc, $sleep_intervall) = @_;
> +
> +    my $task = upid_decode($upid);
> +
> +    $sleep_intervall = $sleep_intervall ? $sleep_intervall : 1;
> +
> +    my $next_time = time + $sleep_intervall;
> +
> +    while (PVE::ProcFSTools::check_process_running($task->{pid},
> $task->{pstart})) {

You use PVE::ProcFSTools here, without adding a 'use' clause for that
library. It also introduces a cyclic library dependency:

PVE::Tools ==> PVE::ProcFSTools ==> PVE::Tools

So I guess PVE::ProcFSTools would be a better place for this helper?




More information about the pve-devel mailing list