From d9ca11088f5672211f7dcf4d081f83a7e917ee81 Mon Sep 17 00:00:00 2001 From: juanmont Date: Mon, 29 Jan 2018 13:37:12 +0100 Subject: [PATCH] Bug fsck: Checked the number of allocated leases with the size of AR (#1691) --- src/onedb/fsck/network.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/onedb/fsck/network.rb b/src/onedb/fsck/network.rb index 4e085a47d7..f364f4e404 100644 --- a/src/onedb/fsck/network.rb +++ b/src/onedb/fsck/network.rb @@ -225,6 +225,14 @@ module OneDBFsck leases = allocated.scan(/(\d+) (\d+)/) + size = net_ar.at_xpath("SIZE").text.to_i + if leases.length > size + log_error("VNet #{oid} AR #{ar_id} has more allocated leases (#{used_leases}) than"<< + "size (#{size}) that has the AR") + error = true + net_ar.at_xpath("SIZE").content = leases.length.to_s + end + new_leases = [] leases.each do |lease_str|