[pve-devel] Submit patch on Proxmox on /usr/share/perl5/PVE/Tools.pm

Cottalorda Sébastien scottalorda at monaco-parkings.mc
Wed Jun 25 12:04:00 CEST 2014



Hi all 

I encountered few days ago a problem on my proxmox cluster
because of too long uptime. 

When I try to migrate a VM or take a console,
I got : 

UNABLE TO PARSE WORKER UPID '......' 

I found that it was du to
the regexp contained in Tools.pm that do not allow 9 digits caracters for
/proc/_PID_NUMBER_/state --> pstate value.
I then modify that perl module
like this : 

--- /usr/share/perl5/PVE/Tools_20140618.pm 2014-06-18
14:20:40.000000000 +0200
+++ /usr/share/perl5/PVE/Tools.pm 2014-06-24
12:37:49.000000000 +0200
@@ -16,6 +16,7 @@
 use Digest::SHA;
 use
Text::ParseWords;
 use String::ShellQuote;
+use Math::BigInt; # Fortunately
this module is available - let's load it !

 our @EXPORT_OK = qw(

lock_file 
@@ -758,11 +759,11 @@
 my $filename;

 #
"UPID:$node:$pid:$pstart:$startime:$dtype:$id:$user"
- if ($upid =~
m/^UPID:([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([^:s]+):([^:s]*):([^:s]+):$/)
{
+ if ($upid =~
m/^UPID:([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?):([0-9A-Fa-f]{8,16}):([0-9A-Fa-f]{8,16}):([0-9A-Fa-f]{8,16}):([^:s]+):([^:s]*):([^:s]+):$/)
{
 $res->{node} = $1;
- $res->{pid} = hex($3);
- $res->{pstart} =
hex($4);
- $res->{starttime} = hex($5);
+ $res->{pid} =
Math::BigInt->from_hex($3);
+ $res->{pstart} =
Math::BigInt->from_hex($4);
+ $res->{starttime} =
Math::BigInt->from_hex($5);
 $res->{type} = $6;
 $res->{id} = $7;

$res->{user} = $8; 

Note that I need to load Math::BigInt perl module.
If
you do not do that, you'll get that warning : 

_HEXADECIMAL NUMBER >
0XFFFFFFFF NON-PORTABLE AT TOOLS.PM LINE ...._ 

But it works. The problem
is that it can be intercepted by an eval {} and cause an exception. 

I
modify too the pvemanagerlib.js file because it use the same regexp than
previous perl module. 

---
/usr/share/pve-manager/ext4/pvemanagerlib_20140618.js 2014-06-18
14:24:26.000000000 +0200
+++ /usr/share/pve-manager/ext4/pvemanagerlib.js
2014-06-24 12:36:52.000000000 +0200
@@ -529,7 +529,7 @@
 parse_task_upid:
function(upid) {
 var task = {};

- var res =
upid.match(/^UPID:(S+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8}):([^:s]+):([^:s]*):([^:s]+):$/);
+
var res =
upid.match(/^UPID:(S+):([0-9A-Fa-f]{8,16}):([0-9A-Fa-f]{8,16}):([0-9A-Fa-f]{8,16}):([^:s]+):([^:s]*):([^:s]+):$/);

if (!res) {
 throw "unable to parse upid '" + upid + "'";
 } 

Hope this
helps. 

Cheers. 

-- 
-------------------------

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20140625/667e60d0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vcard.vcf
Type: text/x-vcard
Size: 149 bytes
Desc: not available
URL: <http://lists.proxmox.com/pipermail/pve-devel/attachments/20140625/667e60d0/attachment.vcf>


More information about the pve-devel mailing list