Project

General

Profile

Actions

Bug #6754

closed

Xen list parsed badly by FusionInventory, causing VCPU to be counted badly

Added by Janos Mattyasovszky almost 6 years ago. Updated over 5 years ago.

Status:
Released
Priority:
3
Category:
Web - Nodes & inventories
Target version:
Severity:
User visibility:
Effort required:
Priority:

Description

Found strange exceptions when digging through the logs, apparently the number format expected by Java does not include decimal places:

[2015-06-12 05:05:55] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-22-17.ocs'
java.lang.NumberFormatException: For input string: "64.6" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 05:06:05] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-18-44-05.ocs'
java.lang.NumberFormatException: For input string: "0.0" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 05:06:12] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-11-29-17.ocs'
java.lang.NumberFormatException: For input string: "394.3" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 05:06:31] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-17-30.ocs'
java.lang.NumberFormatException: For input string: "6805.7" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 05:07:01] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-05-33.ocs'
java.lang.NumberFormatException: For input string: "13169.3" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 21:56:11] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-22-17.ocs'
java.lang.NumberFormatException: For input string: "64.6" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 21:56:18] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-18-44-05.ocs'
java.lang.NumberFormatException: For input string: "0.0" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 21:56:23] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-11-29-17.ocs'
java.lang.NumberFormatException: For input string: "394.3" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 21:56:35] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-17-30.ocs'
java.lang.NumberFormatException: For input string: "6805.7" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]
[2015-06-12 21:56:49] ERROR com.normation.inventory.provisioning.endpoint.FusionReportEndpoint - Exception when processing report 'XXXXXX-2015-06-09-10-05-33.ocs'
java.lang.NumberFormatException: For input string: "13169.3" 
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:77) ~[na:1.7.0]

When running the inventory by hand on one of the upper XXXXX nodes, I also get some perl errors:

+ /opt/rudder/bin/perl -I /opt/rudder/lib/perl5 /opt/rudder/bin/fusioninventory-agent --config=none --local=/var/rudder/tmp/inventory --scan-homedirs
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 6.
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 8.
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 10.
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 11.
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 12.
Use of uninitialized value $status in substitution (s///) at /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm line 68, <$handle> line 15.
[info] Inventory saved in /var/rudder/tmp/inventory/XXXXXX-2015-06-09-10-22-17.ocs
[info] task WakeOnLan execution not requested
[info] task NetDiscovery execution not requested
[info] task NetInventory execution not requested

I presume due this issue the vcpu count contains the decimal point:

# grep VCPU /var/rudder/tmp/inventory/XXXXXXX-2015-06-09-10-22-17.ocs
      <VCPU>4</VCPU>
      <VCPU>2</VCPU>
      <VCPU>4</VCPU>
      <VCPU>64.6</VCPU>
      <VCPU>2</VCPU>
      <VCPU>0.0</VCPU>
      <VCPU>2</VCPU>
      <VCPU>22.4</VCPU>
      <VCPU>1.5</VCPU>
      <VCPU>34.0</VCPU>
      <VCPU>2</VCPU>
      <VCPU>2</VCPU>
      <VCPU>47920.2</VCPU>

The $status in Xen.pm is getting its $status value from splitting the xm list line by spaces:

 my ($name, $vmid, $memory, $vcpu, $status) = split(' ', $line); 

However, this is not always correct, because if you have not running, but defined nodes, the vmid and state column is missing, and the whole output is shifted by two:

# xm list
ServerXX                                    ID   Mem VCPUs      State   Time(s)
ServerXX                                     0 12288    16     r----- 7970534.1
ServerXX                                    25  8192     4     -b---- 349087.4
ServerXX                                    13  8192     2     -b---- 326166.3
ServerXX                                    18  8192     4     -b---- 661780.8
ServerXX                                        8192     8                64.6
ServerXX                                     4  2048     2     -b---- 1705741.3
ServerXX                                        8192     4                 0.0
ServerXX                                     8  4096     2     -b---- 557608.4
ServerXX                                        4096     1                22.4
ServerXX                                        4096     2                 1.5
ServerXX                                        8192     1                34.0
ServerXX                                    22  8192     2     -b---- 289850.1
ServerXX                                    10  2048     2     -b---- 379829.4
ServerXX                                        4096     2             47920.2

This causes the Time(s) column to be identified as VCPU-Count.

Actions #1

Updated by Janos Mattyasovszky almost 6 years ago

Proposing following patch-set, it was tested OK in our xen environment:

--- /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm.orig       2015-06-12 16:35:45.000000000 -0400
+++ /opt/rudder/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/Virtualization/Xen.pm    2015-06-12 16:33:48.000000000 -0400
@@ -61,12 +61,18 @@
     my @machines;
     while (my $line = <$handle>) {
         chomp $line;
-        my ($name, $vmid, $memory, $vcpu, $status) = split(' ', $line);
-        next if $name eq 'Domain-0';
-        next if $vmid == 0;
-
-        $status =~ s/-//g;
-        $status = $status ? $status_list{$status} : 'off';
+        my ($name, $vmid, $memory, $vcpu, $status);
+        my @fields = split(' ', $line);
+        if (@fields == 4) {
+                ($name, $memory, $vcpu) = @fields;
+                $status = 'off';
+        } else {
+                ($name, $vmid, $memory, $vcpu, $status) = @fields;
+                $status =~ s/-//g;
+                $status = $status_list{$status} // 'off';
+               next if $vmid == 0;
+        }
+        next if $name eq 'Domain-0';

         my $machine = {
             MEMORY    => $memory,
Actions #2

Updated by François ARMAND almost 6 years ago

  • Assignee set to Matthieu CERDA

Janos, we are going to add that patch on our version of fusion.

Do you prefer that we handle the bug report on fusion, or do you want to do it yourself so that it is correctly attributed ? (http://forge.fusioninventory.org/issues/)

Actions #3

Updated by François ARMAND almost 6 years ago

If you want to open the ticket on fusion-inventory bugtracker by yourself, please let us know its ID here, so that we can see how/when it is incorporated upstream.

Actions #5

Updated by Vincent MEMBRÉ almost 6 years ago

Thank you for opening the issue Janos!

Actions #6

Updated by Janos Mattyasovszky almost 6 years ago

Suggested Patch applied upstream.

Actions #7

Updated by Matthieu CERDA over 5 years ago

  • Status changed from New to In progress
  • Priority changed from N/A to 3

Taking care of this :)

Thanks for the patch and the upstream report Janos!

Actions #8

Updated by Matthieu CERDA over 5 years ago

  • Target version set to 2.11.13
Actions #9

Updated by Matthieu CERDA over 5 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Matthieu CERDA to Benoît PECCATTE
  • Pull Request set to https://github.com/Normation/rudder-packages/pull/721
Actions #10

Updated by Matthieu CERDA over 5 years ago

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100
Actions #12

Updated by François ARMAND over 5 years ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 2.11.13, 3.0.8 and 3.1.1 which were released today.

Actions

Also available in: Atom PDF