mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
parent
53d01bd7f8
commit
4de78ab903
@ -150,6 +150,36 @@ EOT
|
||||
true
|
||||
end
|
||||
|
||||
def read_config
|
||||
begin
|
||||
require 'augeas'
|
||||
rescue Gem::LoadError
|
||||
STDERR.puts(
|
||||
'Augeas gem is not installed, run `gem install ' \
|
||||
'opennebula-augeas` to install it'
|
||||
)
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
work_file_dir = File.dirname(ONED_CONF)
|
||||
work_file_name = File.basename(ONED_CONF)
|
||||
|
||||
aug = Augeas.create(:no_modl_autoload => true,
|
||||
:no_load => true,
|
||||
:root => work_file_dir,
|
||||
:loadpath => ONED_CONF)
|
||||
|
||||
aug.clear_transforms
|
||||
aug.transform(:lens => 'Oned.lns', :incl => work_file_name)
|
||||
aug.context = "/files/#{work_file_name}"
|
||||
aug.load
|
||||
|
||||
@zone_id = aug.get('FEDERATION/ZONE_ID').to_i
|
||||
rescue StandardError => e
|
||||
STDERR.puts "Unable to parse oned.conf: #{e}"
|
||||
exit(-1)
|
||||
end
|
||||
|
||||
########################################################################
|
||||
# Acl
|
||||
########################################################################
|
||||
|
@ -85,12 +85,12 @@ module OneDBFsck
|
||||
end
|
||||
|
||||
# DATA: CHECK: Check number of clones
|
||||
doc.root.xpath("CLONING_OPS") { |e|
|
||||
if e.text != n_cloning_ops.to_s
|
||||
log_error("Image #{oid} CLONING_OPS has #{e.text} \tis\t#{n_cloning_ops}")
|
||||
e.text = n_cloning_ops
|
||||
end
|
||||
}
|
||||
cloning_ops = doc.root.at_xpath('CLONING_OPS')
|
||||
|
||||
if cloning_ops.text != n_cloning_ops.to_s
|
||||
log_error("Image #{oid} CLONING_OPS has #{cloning_ops.text} \tis\t#{n_cloning_ops}")
|
||||
cloning_ops.content = n_cloning_ops
|
||||
end
|
||||
|
||||
# re-do list of Images cloning this one
|
||||
clones_elem = doc.root.xpath("CLONES").remove
|
||||
|
@ -27,16 +27,21 @@ module OneDBFsck
|
||||
market_id = doc.root.xpath('MARKETPLACE_ID').text.to_i
|
||||
market_name = doc.root.xpath('MARKETPLACE').text
|
||||
|
||||
####################################################################
|
||||
# DATA: TODO, BUG: this code will only work for a standalone oned.
|
||||
# In a federation, the image ID will refer to a different image
|
||||
# in each zone
|
||||
####################################################################
|
||||
if doc.root.xpath('STATE').text.to_i == 2 # LOCKED
|
||||
# Note: This code will only function in the zone, where the DB was created
|
||||
# It may fail if the DB is transfered to a different zones
|
||||
origin_id = doc.root.xpath('ORIGIN_ID').text.to_i
|
||||
app_zone = doc.root.xpath('ZONE_ID').text.to_i
|
||||
|
||||
# DATA: get image origin id. Does it work?
|
||||
origin_id = doc.root.xpath('ORIGIN_ID').text.to_i
|
||||
if origin_id >= 0 && doc.root.xpath('STATE').text.to_i == 2 # LOCKED
|
||||
counters[:image][origin_id][:app_clones].add(row[:oid])
|
||||
if origin_id >= 0 && app_zone == @zone_id && !counters[:image][origin_id].nil?
|
||||
counters[:image][origin_id][:app_clones].add(row[:oid])
|
||||
|
||||
log_error("Marketplace App #{row[:oid]} is in locked state. "<<
|
||||
"The App is probably unusable and needs to be deleted or manually fixed:\n"<<
|
||||
" * Check the App data in the MarketPlace and "<<
|
||||
"set state to 1 (READY) by executing `onedb update-body marketplaceapp --id #{row[:oid]}`",
|
||||
false)
|
||||
end
|
||||
end
|
||||
|
||||
error = fix_permissions('MARKETPLACEAPP', row[:oid], doc)
|
||||
|
@ -479,6 +479,8 @@ class OneDB
|
||||
|
||||
time0 = Time.now
|
||||
|
||||
@backend.read_config
|
||||
|
||||
result = @backend.fsck
|
||||
|
||||
if !result
|
||||
|
Loading…
x
Reference in New Issue
Block a user