mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 13:41:54 +00:00
minor followup cleanups
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>
This commit is contained in:
parent
5f1dc9af73
commit
e85263a20e
@ -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 ],
|
||||
|
Loading…
Reference in New Issue
Block a user