mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 17:01:46 +00:00
tree-wide trailing whitespace cleanup
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
parent
a82348eb34
commit
a022e3fdab
@ -19,8 +19,8 @@ sub setup_environment {
|
||||
}
|
||||
|
||||
__PACKAGE__->register_method({
|
||||
name => 'qmrestore',
|
||||
path => 'qmrestore',
|
||||
name => 'qmrestore',
|
||||
path => 'qmrestore',
|
||||
method => 'POST',
|
||||
description => "Restore QemuServer vzdump backups.",
|
||||
parameters => {
|
||||
@ -29,7 +29,7 @@ __PACKAGE__->register_method({
|
||||
vmid => get_standard_option('pve-vmid', { completion => \&PVE::Cluster::complete_next_vmid }),
|
||||
archive => {
|
||||
description => "The backup file. You can pass '-' to read from standard input.",
|
||||
type => 'string',
|
||||
type => 'string',
|
||||
maxLength => 255,
|
||||
completion => \&PVE::QemuServer::complete_backup_archives,
|
||||
},
|
||||
@ -39,16 +39,16 @@ __PACKAGE__->register_method({
|
||||
completion => \&PVE::QemuServer::complete_storage,
|
||||
}),
|
||||
force => {
|
||||
optional => 1,
|
||||
optional => 1,
|
||||
type => 'boolean',
|
||||
description => "Allow to overwrite existing VM.",
|
||||
},
|
||||
unique => {
|
||||
optional => 1,
|
||||
optional => 1,
|
||||
type => 'boolean',
|
||||
description => "Assign a unique random ethernet address.",
|
||||
},
|
||||
pool => {
|
||||
pool => {
|
||||
optional => 1,
|
||||
type => 'string', format => 'pve-poolid',
|
||||
description => "Add the VM to the specified pool.",
|
||||
@ -61,7 +61,7 @@ __PACKAGE__->register_method({
|
||||
}
|
||||
},
|
||||
},
|
||||
returns => {
|
||||
returns => {
|
||||
type => 'string',
|
||||
},
|
||||
code => sub {
|
||||
@ -70,9 +70,9 @@ __PACKAGE__->register_method({
|
||||
$param->{node} = PVE::INotify::nodename();
|
||||
|
||||
return PVE::API2::Qemu->create_vm($param);
|
||||
}});
|
||||
}});
|
||||
|
||||
our $cmddef = [ __PACKAGE__, 'qmrestore', ['archive', 'vmid'], undef,
|
||||
our $cmddef = [ __PACKAGE__, 'qmrestore', ['archive', 'vmid'], undef,
|
||||
sub {
|
||||
my $upid = shift;
|
||||
my $status = PVE::Tools::upid_read_status($upid);
|
||||
|
@ -57,10 +57,10 @@ my $push_cmd_to_queue = sub {
|
||||
my $execute = $cmd->{execute} || die "no command name specified";
|
||||
|
||||
my $qga = ($execute =~ /^guest\-+/) ? 1 : 0;
|
||||
|
||||
|
||||
my $sname = PVE::QemuServer::qmp_socket($vmid, $qga);
|
||||
|
||||
$self->{queue_info}->{$sname} = { qga => $qga, vmid => $vmid, sname => $sname, cmds => [] }
|
||||
$self->{queue_info}->{$sname} = { qga => $qga, vmid => $vmid, sname => $sname, cmds => [] }
|
||||
if !$self->{queue_info}->{$sname};
|
||||
|
||||
push @{$self->{queue_info}->{$sname}->{cmds}}, $cmd;
|
||||
@ -124,7 +124,7 @@ sub cmd {
|
||||
$cmd->{execute} eq 'block-job-complete' ||
|
||||
$cmd->{execute} eq 'backup-cancel' ||
|
||||
$cmd->{execute} eq 'query-savevm' ||
|
||||
$cmd->{execute} eq 'delete-drive-snapshot' ||
|
||||
$cmd->{execute} eq 'delete-drive-snapshot' ||
|
||||
$cmd->{execute} eq 'guest-shutdown' ||
|
||||
$cmd->{execute} eq 'blockdev-snapshot-internal-sync' ||
|
||||
$cmd->{execute} eq 'blockdev-snapshot-delete-internal-sync' ||
|
||||
@ -161,7 +161,7 @@ my $next_cmdid = sub {
|
||||
my $lookup_queue_info = sub {
|
||||
my ($self, $fh, $noerr) = @_;
|
||||
|
||||
my $queue_info = $self->{queue_lookup}->{$fh};
|
||||
my $queue_info = $self->{queue_lookup}->{$fh};
|
||||
if (!$queue_info) {
|
||||
warn "internal error - unable to lookup queue info" if !$noerr;
|
||||
return undef;
|
||||
@ -175,7 +175,7 @@ my $close_connection = sub {
|
||||
if (my $fh = delete $queue_info->{fh}) {
|
||||
delete $self->{queue_lookup}->{$fh};
|
||||
$self->{mux}->close($fh);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
my $open_connection = sub {
|
||||
@ -262,7 +262,7 @@ my $check_queue = sub {
|
||||
|
||||
if ($qga) {
|
||||
|
||||
$qmpcmd = to_json({ execute => 'guest-sync-delimited',
|
||||
$qmpcmd = to_json({ execute => 'guest-sync-delimited',
|
||||
arguments => { id => int($cmd->{id})}}) .
|
||||
to_json({ execute => $cmd->{execute}, arguments => $cmd->{arguments}});
|
||||
|
||||
@ -304,11 +304,11 @@ sub queue_execute {
|
||||
foreach my $sname (keys %{$self->{queue_info}}) {
|
||||
my $queue_info = $self->{queue_info}->{$sname};
|
||||
next if !scalar(@{$queue_info->{cmds}}); # no commands
|
||||
|
||||
|
||||
$queue_info->{error} = undef;
|
||||
$queue_info->{current} = undef;
|
||||
|
||||
eval {
|
||||
eval {
|
||||
&$open_connection($self, $queue_info, $timeout);
|
||||
|
||||
if (!$queue_info->{qga}) {
|
||||
@ -354,10 +354,10 @@ sub queue_execute {
|
||||
sub mux_close {
|
||||
my ($self, $mux, $fh) = @_;
|
||||
|
||||
my $queue_info = &$lookup_queue_info($self, $fh, 1);
|
||||
my $queue_info = &$lookup_queue_info($self, $fh, 1);
|
||||
return if !$queue_info;
|
||||
|
||||
$queue_info->{error} = "client closed connection\n"
|
||||
$queue_info->{error} = "client closed connection\n"
|
||||
if !$queue_info->{error};
|
||||
}
|
||||
|
||||
@ -365,16 +365,16 @@ sub mux_close {
|
||||
sub mux_input {
|
||||
my ($self, $mux, $fh, $input) = @_;
|
||||
|
||||
my $queue_info = &$lookup_queue_info($self, $fh);
|
||||
my $queue_info = &$lookup_queue_info($self, $fh);
|
||||
return if !$queue_info;
|
||||
|
||||
my $sname = $queue_info->{sname};
|
||||
my $vmid = $queue_info->{vmid};
|
||||
my $sname = $queue_info->{sname};
|
||||
my $vmid = $queue_info->{vmid};
|
||||
my $qga = $queue_info->{qga};
|
||||
|
||||
my $curcmd = $queue_info->{current};
|
||||
die "unable to lookup current command for VM $vmid ($sname)\n" if !$curcmd;
|
||||
|
||||
|
||||
my $raw;
|
||||
|
||||
if ($qga) {
|
||||
@ -399,7 +399,7 @@ sub mux_input {
|
||||
|
||||
# skip results fro previous commands
|
||||
return if $cmdid < $curcmd->{id};
|
||||
|
||||
|
||||
if ($curcmd->{id} ne $cmdid) {
|
||||
die "got wrong command id '$cmdid' (expected $curcmd->{id})\n";
|
||||
}
|
||||
@ -458,7 +458,7 @@ sub mux_input {
|
||||
sub mux_timeout {
|
||||
my ($self, $mux, $fh) = @_;
|
||||
|
||||
if (my $queue_info = &$lookup_queue_info($self, $fh)) {
|
||||
if (my $queue_info = &$lookup_queue_info($self, $fh)) {
|
||||
$queue_info->{error} = "got timeout\n";
|
||||
$self->{mux}->inbuffer($fh, ''); # clear to avoid warnings
|
||||
}
|
||||
@ -472,10 +472,10 @@ sub mux_eof {
|
||||
my $queue_info = &$lookup_queue_info($self, $fh);
|
||||
return if !$queue_info;
|
||||
|
||||
my $sname = $queue_info->{sname};
|
||||
my $vmid = $queue_info->{vmid};
|
||||
my $sname = $queue_info->{sname};
|
||||
my $vmid = $queue_info->{vmid};
|
||||
my $qga = $queue_info->{qga};
|
||||
|
||||
|
||||
my $curcmd = $queue_info->{current};
|
||||
die "unable to lookup current command for VM $vmid ($sname)\n" if !$curcmd;
|
||||
|
||||
|
@ -222,7 +222,7 @@ sub __snapshot_create_vol_snapshots_hook {
|
||||
PVE::QemuServer::vm_mon_cmd($vmid, "savevm-start");
|
||||
}
|
||||
} elsif ($hook eq "after") {
|
||||
eval {
|
||||
eval {
|
||||
PVE::QemuServer::vm_mon_cmd($vmid, "savevm-end");
|
||||
PVE::Storage::deactivate_volumes($storecfg, [$snap->{vmstate}]) if $snap->{vmstate};
|
||||
};
|
||||
|
@ -215,7 +215,7 @@ sub qemu_dimm_list {
|
||||
|
||||
sub config {
|
||||
my ($conf, $vmid, $sockets, $cores, $defaults, $hotplug_features, $cmd) = @_;
|
||||
|
||||
|
||||
my $memory = $conf->{memory} || $defaults->{memory};
|
||||
my $static_memory = 0;
|
||||
|
||||
|
@ -396,7 +396,7 @@ sub archive {
|
||||
'config-file' => $conffile,
|
||||
devlist => $devlist
|
||||
};
|
||||
|
||||
|
||||
$params->{'firewall-file'} = $firewall if -e $firewall;
|
||||
$qmpclient->queue_cmd($vmid, $backup_cb, 'backup', %$params);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user