mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-08 15:40:16 +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 {
|
sub {
|
||||||
my $res = shift;
|
my $res = shift;
|
||||||
|
|
||||||
# "our" scope for the snaptimesort function
|
|
||||||
my $snapshots = { map { $_->{name} => $_ } @$res };
|
my $snapshots = { map { $_->{name} => $_ } @$res };
|
||||||
|
|
||||||
my $root;
|
my $root;
|
||||||
@ -936,8 +935,6 @@ our $cmddef = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $prefix = '`->';
|
|
||||||
|
|
||||||
# sort the elements by snaptime - with "current" (no snaptime) highest
|
# sort the elements by snaptime - with "current" (no snaptime) highest
|
||||||
my $snaptimesort = sub {
|
my $snaptimesort = sub {
|
||||||
return +1 if !defined $snapshots->{$a}->{snaptime};
|
return +1 if !defined $snapshots->{$a}->{snaptime};
|
||||||
@ -954,15 +951,14 @@ our $cmddef = {
|
|||||||
my $description = $e->{description} || 'no-description';
|
my $description = $e->{description} || 'no-description';
|
||||||
($description) = $description =~ m/(.*)$/m;
|
($description) = $description =~ m/(.*)$/m;
|
||||||
|
|
||||||
# create the timestamp string
|
|
||||||
my $timestring = "";
|
my $timestring = "";
|
||||||
if (defined $e->{snaptime}) {
|
if (defined $e->{snaptime}) {
|
||||||
$timestring = strftime("%F %H:%M:%S", localtime($e->{snaptime}));
|
$timestring = strftime("%F %H:%M:%S", localtime($e->{snaptime}));
|
||||||
}
|
}
|
||||||
|
|
||||||
# for aligning the description
|
my $len = 30 - length($prefix); # for aligning the description
|
||||||
my $len = 30 - length($prefix);
|
|
||||||
printf("%s %-${len}s %-23s %s\n", $prefix, $root, $timestring, $description);
|
printf("%s %-${len}s %-23s %s\n", $prefix, $root, $timestring, $description);
|
||||||
|
|
||||||
if ($e->{children}) {
|
if ($e->{children}) {
|
||||||
$prefix = " $prefix";
|
$prefix = " $prefix";
|
||||||
foreach my $child (sort $snaptimesort @{$e->{children}}) {
|
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 ],
|
rollback => [ "PVE::API2::Qemu", 'rollback', ['vmid', 'snapname'], { node => $nodename } , $upid_exit ],
|
||||||
|
Loading…
Reference in New Issue
Block a user