mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-27 10:50:10 +03:00
parent
a2757c3c18
commit
1bb4146592
@ -192,6 +192,29 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
puts template
|
||||
end
|
||||
|
||||
def check_orphans
|
||||
orphans = []
|
||||
xpath = '/VMTEMPLATE_POOL/VMTEMPLATE/TEMPLATE/NIC'
|
||||
|
||||
pool = factory_pool
|
||||
tmpl_pool = OpenNebula::TemplatePool.new(@client, -2)
|
||||
|
||||
pool.info
|
||||
tmpl_pool.info
|
||||
|
||||
pool.each do |img|
|
||||
attrs = { :id => img['ID'],
|
||||
:name => img['NAME'],
|
||||
:uname => img['UNAME'] }
|
||||
|
||||
orphans << img['ID'] if check_orphan(tmpl_pool,
|
||||
xpath,
|
||||
'NETWORK', attrs)
|
||||
end
|
||||
|
||||
orphans
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def factory(id=nil)
|
||||
|
@ -429,4 +429,14 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
vnet.unlock
|
||||
end
|
||||
end
|
||||
|
||||
show_desc = <<-EOT.unindent
|
||||
Shows orphans vnets (i.e vnets not referenced in any template).
|
||||
EOT
|
||||
|
||||
command :orphans, show_desc do
|
||||
puts helper.check_orphans
|
||||
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user