1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

Bug #2839: Fsck now allows multiple system DS in the same cluster

This commit is contained in:
Carlos Martín 2014-04-21 11:56:16 +02:00
parent 3cf945fbcc
commit 544d155fbb

View File

@ -326,8 +326,6 @@ module OneDBFsck
cluster[row[:oid]][:hosts] = []
cluster[row[:oid]][:datastores] = []
cluster[row[:oid]][:vnets] = []
cluster[row[:oid]][:system_ds] = 0
end
hosts_fix = {}
@ -410,28 +408,7 @@ module OneDBFsck
datastores_fix[row[:oid]] = {:body => doc.to_s, :cid => -1}
else
if doc.root.get_text('TYPE').to_s != "1"
cluster_entry[:datastores] << row[:oid]
else
if cluster_entry[:system_ds] == 0
cluster_entry[:datastores] << row[:oid]
cluster_entry[:system_ds] = row[:oid]
else
log_error("System Datastore #{row[:oid]} is in Cluster #{cluster_id}, but it already contains System Datastore #{cluster_entry[:system_ds]}")
doc.root.each_element('CLUSTER_ID') do |e|
e.text = "-1"
end
doc.root.each_element('CLUSTER') do |e|
e.text = ""
end
datastores_fix[row[:oid]] = {:body => doc.to_s, :cid => -1}
next
end
end
if cluster_name != cluster_entry[:name]
log_error("Datastore #{row[:oid]} has a wrong name for cluster #{cluster_id}, #{cluster_name}. It will be changed to #{cluster_entry[:name]}")
@ -533,16 +510,6 @@ module OneDBFsck
ds_new_elem = doc.root.add_element("DATASTORES")
doc.root.each_element("SYSTEM_DS") do |e|
system_ds = e.text.to_i
if system_ds != cluster[cluster_id][:system_ds]
log_error("Cluster #{cluster_id} has System Datastore set to #{system_ds}, but it should be #{cluster[cluster_id][:system_ds]}")
e.text = cluster[cluster_id][:system_ds].to_s
end
end
cluster[cluster_id][:datastores].each do |id|
id_elem = ds_elem.elements.delete("ID[.=#{id}]")