- $guest_status_command->($remote, $vmid, 'stop', $param);
+ my $config = PVE::APIClient::Config->load();
+ my $conn = PVE::APIClient::Config->remote_conn($config, $remote);
+
+ my $resource = PVE::APIClient::Helpers::get_vmid_resource($conn, $vmid);
+
+ my $res = $conn->post("api2/json/nodes/$resource->{node}/$resource->{type}/$resource->{vmid}/spiceproxy", {});
+
+ my $vvsetup = "[virt-viewer]\n";
+ foreach my $k (keys %$res) {
+ $vvsetup .= "$k=$res->{$k}\n";
+ }
+
+ my ($fh, $filename) = tempfile( "tempXXXXX", SUFFIX => '.vv', TMPDIR => 1);
+ syswrite($fh, $vvsetup);
+
+ system("nohup remote-viewer $filename 1>/dev/null 2>&1 &");
+ if ($? != 0) {
+ print "failed to execute remote-viewer: $!\n";
+ }