]> git.proxmox.com Git - pve-manager.git/commitdiff
api: ceph osd: drop unused variable and useless intermediate code
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 4 Sep 2023 12:22:27 +0000 (14:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 4 Sep 2023 12:22:31 +0000 (14:22 +0200)
$raw isn't used anywhere here and probably just a left over from copy
pasting, and the "int cast ternary" can be avoided by just directly
casting to int when assigning the variable in the first place.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Ceph/OSD.pm

index 38980297158b4f4cfd3699284838367f09a615b4..bcc4521f79c728bdbca370cac304fd10c2957c59 100644 (file)
@@ -685,12 +685,11 @@ __PACKAGE__->register_method ({
        die "OSD '${osdid}' does not exists on host '${nodename}'\n"
            if $nodename ne $metadata->{hostname};
 
-       my $raw = '';
        my $pid;
        my $parser = sub {
            my $line = shift;
            if ($line =~ m/^MainPID=([0-9]*)$/) {
-               $pid = $1;
+               $pid = int($1);
            }
        };
 
@@ -703,8 +702,6 @@ __PACKAGE__->register_method ({
        ];
        run_command($cmd, errmsg => 'fetching OSD PID and memory usage failed', outfunc => $parser);
 
-       $pid = defined($pid) ? int($pid) : undef;
-
        my $memory = 0;
        if ($pid && $pid > 0) {
            open (my $SMAPS, '<', "/proc/$pid/smaps_rollup")