Address family mismatch - onedb fsck / upgrade

Hi,

i am currently investigating a problem (address family mismatch) when onedb fsck runs:

oneadmin@cloud000-dev-lab:~$ onedb fsck -S localhost -u oneadmin -p XXXXX -d opennebula
MySQL dump stored in /var/lib/one/mysql_localhost_opennebula_2016-7-26_21:0:40.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file


Host 0 CPU_USAGE has 7520 	is	7519

address family mismatch
/usr/lib/ruby/2.1.0/ipaddr.rb:500:in `initialize'
/usr/lib/one/ruby/onedb/fsck.rb:1350:in `new'
/usr/lib/one/ruby/onedb/fsck.rb:1350:in `block (3 levels) in fsck'
/usr/lib/one/ruby/onedb/fsck.rb:1337:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:1337:in `block (2 levels) in fsck'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:139:in `block in each'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:312:in `block (2 levels) in fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:367:in `yield_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:312:in `block in fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:177:in `_execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/shared/mysql_prepared_statements.rb:34:in `block in execute'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `block in synchronize'
/usr/lib/ruby/vendor_ruby/sequel/connection_pool/threaded.rb:91:in `hold'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `synchronize'
/usr/lib/ruby/vendor_ruby/sequel/adapters/shared/mysql_prepared_statements.rb:34:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:906:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:351:in `execute'
/usr/lib/ruby/vendor_ruby/sequel/adapters/mysql.rb:296:in `fetch_rows'
/usr/lib/ruby/vendor_ruby/sequel/dataset/actions.rb:139:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:1328:in `block in fsck'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:126:in `_transaction'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:100:in `block in transaction'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `block in synchronize'
/usr/lib/ruby/vendor_ruby/sequel/connection_pool/threaded.rb:104:in `hold'
/usr/lib/ruby/vendor_ruby/sequel/database/connecting.rb:250:in `synchronize'
/usr/lib/ruby/vendor_ruby/sequel/database/transactions.rb:89:in `transaction'
/usr/lib/one/ruby/onedb/fsck.rb:1327:in `fsck'
/usr/lib/one/ruby/onedb/onedb.rb:278:in `fsck'
/usr/bin/onedb:317:in `block (2 levels) in <main>'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `call'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `run'
/usr/lib/one/ruby/cli/command_parser.rb:76:in `initialize'
/usr/bin/onedb:210:in `new'
/usr/bin/onedb:210:in `<main>'

Error running fsck version 4.11.80
The database will be restored
MySQL DB opennebula at localhost restored.

First i seen this error after planning the change to upgrade One from 4.14.12 to 5.0.2 after upgrading the packages to 5.0.2
I revert to the original 4.14.12 version by snapshot in my lab environment and there the same error occurs with V 4.14.12.

In /usr/lib/ruby/2.1.0/ipaddr.rb i found the following code at line 500:

499     if family != Socket::AF_UNSPEC && @family != family
500       raise AddressFamilyError, "address family mismatch"
501     end

Any ideas where i had to look for ?

Best regards,

Sebastian

Hi,

Please open a bug ticket at http://dev.opennebula.org

Meanwhile, maybe you can try to see what is failing with a ‘puts net_ar.at_xpath(“IP”).text’ before this line:

Hi Carlos,

here`s the new bug ticket: http://dev.opennebula.org/issues/4695

I already tried to debug this issue. I checked the sourcecode of fsck.rb and found it fails at the following AR:

<AR>
  <AR_ID><![CDATA[34]]></AR_ID>
  <IP><![CDATA[212.62.194.47	]]></IP>
  <MAC><![CDATA[02:00:d4:3e:c2:2f]]></MAC>
  <SIZE><![CDATA[1]]></SIZE>
  <TYPE><![CDATA[IP4]]></TYPE>
  <MAC_END><![CDATA[02:00:d4:3e:c2:2f]]></MAC_END>
  <IP_END><![CDATA[212.62.194.47]]></IP_END>
  <USED_LEASES>1</USED_LEASES>
  <LEASES>
    <LEASE>
      <IP><![CDATA[212.62.194.47]]></IP>
      <MAC><![CDATA[02:00:d4:3e:c2:2f]]></MAC>
      <VM><![CDATA[657]]></VM>
    </LEASE>
  </LEASES>
</AR>

As you can see, there are whitespaces at the first <IP> element. This is not allowed.

The Sunstone shows the AR 34 correct:

In the CLI you can see the whitspaces:

The AR with ID 34 was created with Sunstone from one of our customers.
I just tried to create a new AR with an IP which has some whitespaces - Sunstone checks it correctly:

[VirtualNetworkAddAddressRange] Error modifying network leases. Wrong or empty IP attribute

So long. I dont think there is a Bug in OpenNebula. Perphaps we can add .strip to IPAddr.new(net_ar.at_xpath("IP").text

Best regards,

Sebastian