Bug #6754
closedXen list parsed badly by FusionInventory, causing VCPU to be counted badly
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.
Added by Matthieu CERDA over 9 years ago
Added by Benoît PECCATTE over 9 years ago
Merge pull request #721 from Kegeruneku/bug_6754/xen_list_parsed_badly_by_fusioninventory_causing_vcpu_to_be_counted_badly
Fixes #6754: Xen list parsed badly by FusionInventory, causing VCPU to be counted badly
Fixes #6754: Xen list parsed badly by FusionInventory, causing VCPU to be counted badly