diff --git a/PVE/API2/OpenVZ.pm b/PVE/API2/OpenVZ.pm index 938e4a420..1e6514b6b 100644 --- a/PVE/API2/OpenVZ.pm +++ b/PVE/API2/OpenVZ.pm @@ -864,7 +864,11 @@ __PACKAGE__->register_method ({ my $remcmd = $remip ? ['/usr/bin/ssh', '-c', 'blowfish-cbc', '-t', $remip] : []; - my $shcmd = [ '/usr/sbin/vzctl', 'enter', $vmid ]; + mkdir "/var/run/dtach"; + my $shcmd = [ '/usr/bin/dtach', '-A', + "/var/run/dtach/vzctlconsole$vmid", + '-r', 'winch', '-z', + '/usr/sbin/vzctl', 'console', $vmid ]; my $realcmd = sub { my $upid = shift; diff --git a/bin/pvestatd b/bin/pvestatd index 1f106c5aa..5513c8577 100755 --- a/bin/pvestatd +++ b/bin/pvestatd @@ -6,7 +6,7 @@ use POSIX ":sys_wait_h"; use Fcntl ':flock'; use Getopt::Long; use Time::HiRes qw (gettimeofday); -use PVE::Tools; +use PVE::Tools qw(dir_glob_foreach file_read_firstline); use PVE::ProcFSTools; use Filesys::Df; use PVE::INotify; @@ -199,6 +199,45 @@ sub update_qemu_status { } } +sub find_vzctl_console_pids { + + my $res = {}; + + dir_glob_foreach('/proc', '\d+', sub { + my ($pid) = @_; + + my $cmdline = file_read_firstline("/proc/$pid/cmdline"); + return if !$cmdline; + + my @args = split(/\0/, $cmdline); + + # serach for vzctl console + return if scalar(@args) != 3; + return if $args[1] ne 'console'; + return if $args[2] !~ m/^\d+$/; + return if $args[0] !~ m|^(/usr/sbin/)?vzctl$|; + + my $vmid = $args[2]; + + push @{$res->{$vmid}}, $pid; + }); + + return $res; +} +sub remove_stale_openvz_consoles { + + my $vmstatus = PVE::OpenVZ::vmstatus(); + my $pidhash = find_vzctl_console_pids(); + + foreach my $vmid (keys %$pidhash) { + next if defined($vmstatus->{$vmid}); + syslog('info', "remove stale vzctl console for CT $vmid"); + foreach my $pid (@{$pidhash->{$vmid}}) { + kill(9, $pid); + } + } +} + sub update_openvz_status { my $ctime = time(); @@ -281,6 +320,12 @@ sub update_status { }; $err = $@; syslog('err', "storage status update error: $err") if $err; + + eval { + remove_stale_openvz_consoles(); + }; + $err = $@; + syslog('err', "openvz console cleanup error: $err") if $err; } my $next_update = 0; diff --git a/debian/changelog.Debian b/debian/changelog.Debian index ada8c32b4..d93ec72bd 100644 --- a/debian/changelog.Debian +++ b/debian/changelog.Debian @@ -1,3 +1,15 @@ +pve-manager (2.2-20) unstable; urgency=low + + * openvz: use real console instead of 'vzctl enter' + + * openvz: remove init-logger pagers + + * dpenend on dtach (used by openvz console) + + * pvestatd: remove stale 'vzctl console' processes + + -- Proxmox Support Team Tue, 02 Oct 2012 06:49:12 +0200 + pve-manager (2.2-19) unstable; urgency=low * fix bug 178: use new API call to get next free VMID diff --git a/debian/control.in b/debian/control.in index bbe32aa66..4f822391a 100644 --- a/debian/control.in +++ b/debian/control.in @@ -3,7 +3,7 @@ Version: @VERSION@-@PACKAGERELEASE@ Section: admin Priority: optional Architecture: all -Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, redhat-cluster-pve, resource-agents-pve, fence-agents-pve, cstream, mail-transport-agent, libxml-parser-perl, perl-suid, lzop +Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, redhat-cluster-pve, resource-agents-pve, fence-agents-pve, cstream, mail-transport-agent, libxml-parser-perl, perl-suid, lzop, dtach Conflicts: netcat-openbsd, vzdump Replaces: vzdump Provides: vzdump diff --git a/defines.mk b/defines.mk index 6e0bc332e..a7f733aa9 100644 --- a/defines.mk +++ b/defines.mk @@ -2,7 +2,7 @@ RELEASE=2.2 VERSION=2.2 PACKAGE=pve-manager -PACKAGERELEASE=19 +PACKAGERELEASE=20 BINDIR=${DESTDIR}/usr/bin PERLLIBDIR=${DESTDIR}/usr/share/perl5 diff --git a/www/manager/VNCConsole.js b/www/manager/VNCConsole.js index edce4aed0..4be014ddd 100644 --- a/www/manager/VNCConsole.js +++ b/www/manager/VNCConsole.js @@ -360,7 +360,7 @@ Ext.define('PVE.OpenVZConsole', { { text: gettext('Start'), handler: function() { - vm_command("start", {}, 1); + vm_command("start"); } }, { @@ -387,14 +387,7 @@ Ext.define('PVE.OpenVZConsole', { }); } }, - // Note: no migrate here, because we can't display migrate log - // and openvz migrate does not work if console is open - { - text: gettext('Console'), - handler: function() { - PVE.Utils.openConoleWindow('openvz', me.vmid, me.nodename, me.vmname); - } - }, + // Note: no migrate here, because we can't display migrate log '->', { text: gettext('Refresh'), diff --git a/www/manager/openvz/Config.js b/www/manager/openvz/Config.js index 7452f95f0..0fbe76e10 100644 --- a/www/manager/openvz/Config.js +++ b/www/manager/openvz/Config.js @@ -152,16 +152,6 @@ Ext.define('PVE.openvz.Config', { ] }); - - if (caps.vms['VM.Console']) { - me.items.push({ - title: "InitLog", - itemId: 'initlog', - xtype: 'pveLogView', - url: '/api2/extjs/nodes/' + nodename + '/openvz/' + vmid + '/initlog' - }); - } - if (caps.vms['VM.Backup']) { me.items.push({ title: gettext('Backup'),