Onedb fsck fails during upgrade 5.0.2->5.2

Hello,

I am trying to upgrade my ONe 5.0.2 to 5.2. I ran onedb upgrade, but onedb fsck fails on me. The complete output of this command is attached:

Cluster 101 has not the proper reserved VNC ports
VNet 5 VN_MAD element is missing from the TEMPLATE
[UNREPAIRED] VNet 6 AR 0 has a wrong lease for VM 505. IP6_GLOBAL does not match: fec0:dead:beef::1 != . This can't be fixed
VNet 6 VN_MAD element is missing from the TEMPLATE
VNet 7 VN_MAD element is missing from the TEMPLATE
VNet 11 VN_MAD element is missing from the TEMPLATE
VNet 21 VN_MAD element is missing from the TEMPLATE
VNet 22 VN_MAD element is missing from the TEMPLATE
User 16 quotas: VNet 5	LEASES_USED has 1 	is	0
User 16 quotas: VNet 7	LEASES_USED has 1 	is	0
Group 1 quotas: Datastore 100	IMAGES_USED has 52 	is	53
Group 1 quotas: Datastore 100	SIZE_USED has 2601871 	is	2609871
VM Template 6 OS/BOOT contains deprecated format "hd", is was updated to disk0
VM Template 11 OS/BOOT contains deprecated format "hd", is was updated to disk0
VM Template 13 OS/BOOT contains deprecated format "cdrom,hd", is was updated to disk1,disk0
VM Template 14 OS/BOOT contains deprecated format "cdrom,hd", is was updated to disk1,disk0
VM Template 16 OS/BOOT contains deprecated format "cdrom,hd", is was updated to disk1,disk0

undefined method `content' for nil:NilClass
/usr/lib/one/ruby/onedb/fsck.rb:2640:in `get_image_from_name'
/usr/lib/one/ruby/onedb/fsck.rb:2607:in `block in get_disk_id'
/usr/share/gems/gems/nokogiri-1.6.1/lib/nokogiri/xml/node_set.rb:237:in `block in each'
/usr/share/gems/gems/nokogiri-1.6.1/lib/nokogiri/xml/node_set.rb:236:in `upto'
/usr/share/gems/gems/nokogiri-1.6.1/lib/nokogiri/xml/node_set.rb:236:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:2602:in `each_with_index'
/usr/lib/one/ruby/onedb/fsck.rb:2602:in `get_disk_id'
/usr/lib/one/ruby/onedb/fsck.rb:2158:in `block (3 levels) in fsck'
/usr/lib/one/ruby/onedb/fsck.rb:2144:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:2144:in `block (2 levels) in fsck'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/dataset/actions.rb:141:in `block in each'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:316:in `block (2 levels) in fetch_rows'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:373:in `yield_rows'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:316:in `block in fetch_rows'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:180:in `_execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/utils/mysql_mysql2.rb:36:in `block in execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `block in synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/connection_pool/threaded.rb:103:in `hold'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/utils/mysql_mysql2.rb:36:in `execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/dataset/actions.rb:970:in `execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:357:in `execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql.rb:300:in `fetch_rows'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/dataset/actions.rb:141:in `each'
/usr/lib/one/ruby/onedb/fsck.rb:2121:in `block in fsck'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/transactions.rb:163:in `_transaction'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/transactions.rb:138:in `block in transaction'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `block in synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/connection_pool/threaded.rb:107:in `hold'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/transactions.rb:104:in `transaction'
/usr/lib/one/ruby/onedb/fsck.rb:2120:in `fsck'
/usr/lib/one/ruby/onedb/onedb.rb:280:in `fsck'
/usr/bin/onedb:329: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:222:in `new'
/usr/bin/onedb:222:in `<main>'

Error running fsck version 5.2.0
The database will be restored
MySQL DB opennebula at db.fi.muni.cz restored.

fsck.rb:2640 is this:

def get_image_from_name(disk)
  name = disk.at_xpath("IMAGE").content # always defined

So apparently, it is not “always defined” in my db :-/

How can I fix this? Thanks!

-Yenya

A band-aid fix is to replace the abovementioned "name = disk.at_xpath... " line with something like this:

  image = disk.at_xpath("IMAGE")
  if image.nil?
     name = "image name unset"
  else
     name = image.content # always defined
  end

With this modification, onedb fsck continued and finished correctly (process exited with code 0). I will try to proceed with the upgrade, but maybe fsck should be made aware of this situation.