mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-01 11:11:20 +00:00
add ability to run without graphic card ('vga: serial[n]')
This commit is contained in:
parent
f409f8dc50
commit
ef5e2be2a4
@ -1273,6 +1273,8 @@ __PACKAGE__->register_method({
|
||||
my $vmid = $param->{vmid};
|
||||
my $node = $param->{node};
|
||||
|
||||
my $conf = PVE::QemuServer::load_config($vmid); # check if VM exists
|
||||
|
||||
my $authpath = "/vms/$vmid";
|
||||
|
||||
my $ticket = PVE::AccessControl::assemble_vnc_ticket($authuser, $authpath);
|
||||
@ -1283,14 +1285,14 @@ __PACKAGE__->register_method({
|
||||
my $port = PVE::Tools::next_vnc_port();
|
||||
|
||||
my $remip;
|
||||
my $remcmd = [];
|
||||
|
||||
if ($node ne 'localhost' && $node ne PVE::INotify::nodename()) {
|
||||
$remip = PVE::Cluster::remote_node_ip($node);
|
||||
# NOTE: kvm VNC traffic is already TLS encrypted
|
||||
$remcmd = ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes', $remip];
|
||||
}
|
||||
|
||||
# NOTE: kvm VNC traffic is already TLS encrypted
|
||||
my $remcmd = $remip ? ['/usr/bin/ssh', '-T', '-o', 'BatchMode=yes', $remip] : [];
|
||||
|
||||
my $timeout = 10;
|
||||
|
||||
my $realcmd = sub {
|
||||
@ -1298,12 +1300,24 @@ __PACKAGE__->register_method({
|
||||
|
||||
syslog('info', "starting vnc proxy $upid\n");
|
||||
|
||||
my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
|
||||
my $cmd;
|
||||
|
||||
my $qmstr = join(' ', @$qmcmd);
|
||||
if ($conf->{vga} =~ m/^serial\d+$/) {
|
||||
|
||||
# also redirect stderr (else we get RFB protocol errors)
|
||||
my $cmd = ['/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr 2>/dev/null"];
|
||||
my $termcmd = [ '/usr/sbin/qm', 'terminal', $vmid, '-iface', $conf->{vga} ];
|
||||
#my $termcmd = "/usr/bin/qm terminal -iface $conf->{vga}";
|
||||
$cmd = ['/usr/bin/vncterm', '-rfbport', $port,
|
||||
'-timeout', $timeout, '-authpath', $authpath,
|
||||
'-perm', 'Sys.Console', '-c', @$remcmd, @$termcmd];
|
||||
} else {
|
||||
|
||||
my $qmcmd = [@$remcmd, "/usr/sbin/qm", 'vncproxy', $vmid];
|
||||
|
||||
my $qmstr = join(' ', @$qmcmd);
|
||||
|
||||
# also redirect stderr (else we get RFB protocol errors)
|
||||
$cmd = ['/bin/nc', '-l', '-p', $port, '-w', $timeout, '-c', "$qmstr 2>/dev/null"];
|
||||
}
|
||||
|
||||
PVE::Tools::run_command($cmd);
|
||||
|
||||
|
@ -335,8 +335,8 @@ EODESC
|
||||
vga => {
|
||||
optional => 1,
|
||||
type => 'string',
|
||||
description => "Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'. Default is 'std' for win8/win7/w2k8, and 'cirrur' for other OS types. Option 'qxl' enables the SPICE display sever.",
|
||||
enum => [qw(std cirrus vmware qxl)],
|
||||
description => "Select VGA type. If you want to use high resolution modes (>= 1280x1024x16) then you should use option 'std' or 'vmware'. Default is 'std' for win8/win7/w2k8, and 'cirrur' for other OS types. Option 'qxl' enables the SPICE display sever. You can also run without any graphic card using a serial devive as terminal.",
|
||||
enum => [qw(std cirrus vmware qxl serial0 serial1 serial2 serial3)],
|
||||
},
|
||||
watchdog => {
|
||||
optional => 1,
|
||||
@ -2306,6 +2306,7 @@ sub config_to_command {
|
||||
} else {
|
||||
$tablet = $defaults->{tablet};
|
||||
$tablet = 0 if vga_conf_has_spice($vga); # disable for spice because it is not needed
|
||||
$tablet = 0 if $vga =~ m/^serial\d+$/; # disable if we use serial terminal (no vga card)
|
||||
}
|
||||
|
||||
push @$devices, '-device', 'usb-tablet,id=tablet,bus=uhci.0,port=1' if $tablet;
|
||||
@ -2385,7 +2386,7 @@ sub config_to_command {
|
||||
|
||||
push @$cmd, '-no-reboot' if defined($conf->{reboot}) && $conf->{reboot} == 0;
|
||||
|
||||
push @$cmd, '-vga', $vga if $vga; # for kvm 77 and later
|
||||
push @$cmd, '-vga', $vga if $vga && $vga !~ m/^serial\d+$/; # for kvm 77 and later
|
||||
|
||||
# time drift fix
|
||||
my $tdf = defined($conf->{tdf}) ? $conf->{tdf} : $defaults->{tdf};
|
||||
|
Loading…
Reference in New Issue
Block a user