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,
my $serialdesc = {
optional => 1,
type => 'string',
- pattern => '/dev/ttyS\d+',
+ pattern => '(/dev/ttyS\d+|socket)',
description => <<EODESCR,
-Map host serial devices (n is 0 to 3).
+Create a serial device inside the VM (n is 0 to 3), and pass through a host serial device, or create a unix socket on the host side (use 'qm terminal' to open a terminal connection).
Note: This option allows direct access to host hardware. So it is no longer possible to migrate such machines - use with special care.
my $paralleldesc= {
optional => 1,
type => 'string',
- pattern => '/dev/parport\d+',
+ pattern => '/dev/parport\d+|/dev/usb/lp\d+',
description => <<EODESCR,
Map host parallel devices (n is 0 to 2).
}
}
+sub vga_conf_has_spice {
+ my ($vga) = @_;
+
+ return $vga && ($vga eq 'qxl');
+}
+
sub config_to_command {
my ($storecfg, $vmid, $conf, $defaults, $forcemachine) = @_;
$tablet = $conf->{tablet};
} else {
$tablet = $defaults->{tablet};
- $tablet = 0 if $vga eq 'qxl'; # disable for spice because it is not needed
+ $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;
# serial devices
for (my $i = 0; $i < $MAX_SERIAL_PORTS; $i++) {
if (my $path = $conf->{"serial$i"}) {
- die "no such serial device\n" if ! -c $path;
- push @$devices, '-chardev', "tty,id=serial$i,path=$path";
- push @$devices, '-device', "isa-serial,chardev=serial$i";
+ if ($path eq 'socket') {
+ my $socket = "/var/run/qemu-server/${vmid}.serial$i";
+ push @$devices, '-chardev', "socket,id=serial$i,path=$socket,server,nowait";
+ push @$devices, '-device', "isa-serial,chardev=serial$i";
+ } else {
+ die "no such serial device\n" if ! -c $path;
+ push @$devices, '-chardev', "tty,id=serial$i,path=$path";
+ push @$devices, '-device', "isa-serial,chardev=serial$i";
+ }
}
}
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};
}
my $spice_port;
- if ($vga eq 'qxl') {
+ if (vga_conf_has_spice($vga)) {
my $pciaddr = print_pci_addr("spice", $bridges);
$spice_port = PVE::Tools::next_unused_port(61000, 61099);
my ($cmd, $vollist, $spice_port) = config_to_command($storecfg, $vmid, $conf, $defaults, $forcemachine);
my $migrate_port = 0;
-
+ my $migrate_uri;
if ($statefile) {
if ($statefile eq 'tcp') {
+ my $localip = "localhost";
+ my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg');
+ if ($datacenterconf->{migration_unsecure}) {
+ my $nodename = PVE::INotify::nodename();
+ $localip = PVE::Cluster::remote_node_ip($nodename, 1);
+ }
$migrate_port = PVE::Tools::next_migrate_port();
- my $migrate_uri = "tcp:localhost:${migrate_port}";
+ $migrate_uri = "tcp:${localip}:${migrate_port}";
push @$cmd, '-incoming', $migrate_uri;
push @$cmd, '-S';
} else {
my $err = $@;
die "start failed: $err" if $err;
- print "migration listens on port $migrate_port\n" if $migrate_port;
+ print "migration listens on $migrate_uri\n" if $migrate_uri;
if ($statefile && $statefile ne 'tcp') {
eval { vm_mon_cmd_nocheck($vmid, "cont"); };