]> git.proxmox.com Git - qemu-server.git/commitdiff
minor followup cleanups
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 13 May 2019 05:49:31 +0000 (05:49 +0000)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 13 May 2019 05:50:37 +0000 (05:50 +0000)
remove now out of date commen about 'our', left over from previous
revision

Pass firs $prefix directly to function and some other small stuff

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/CLI/qm.pm

index 279d0d96860ef8ba4925a3b25e2c50cb08065fc1..c489ec2d74c49cb210f6f1d957abd2f405fd87b3 100755 (executable)
@@ -924,7 +924,6 @@ our $cmddef = {
                    sub {
                        my $res = shift;
 
-                       # "our" scope for the snaptimesort function
                        my $snapshots = { map { $_->{name} => $_ } @$res };
 
                        my $root;
@@ -936,8 +935,6 @@ our $cmddef = {
                            }
                        }
 
-                       my $prefix = '`->';
-
                        # sort the elements by snaptime - with "current" (no snaptime) highest
                        my $snaptimesort = sub {
                            return +1 if !defined $snapshots->{$a}->{snaptime};
@@ -954,15 +951,14 @@ our $cmddef = {
                            my $description = $e->{description} || 'no-description';
                            ($description) = $description =~ m/(.*)$/m;
 
-                           # create the timestamp string
                            my $timestring = "";
                            if (defined $e->{snaptime}) {
                                $timestring = strftime("%F %H:%M:%S", localtime($e->{snaptime}));
                            }
 
-                           # for aligning the description
-                           my $len = 30 - length($prefix);
+                           my $len = 30 - length($prefix); # for aligning the description
                            printf("%s %-${len}s %-23s %s\n", $prefix, $root, $timestring, $description);
+
                            if ($e->{children}) {
                                $prefix = "    $prefix";
                                foreach my $child (sort $snaptimesort @{$e->{children}}) {
@@ -971,7 +967,7 @@ our $cmddef = {
                            }
                        };
 
-                       $snapshottree->($prefix, $root, $snapshots);
+                       $snapshottree->('->', $root, $snapshots);
                    }],
 
     rollback => [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],