1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-14 19:24:10 +03:00

feature #3782: fix monitoring of persistent images

This commit is contained in:
Javi Fontan 2015-08-26 16:04:30 +02:00
parent 3a89a0d107
commit d840ce3eb3
2 changed files with 29 additions and 0 deletions

View File

@ -1118,6 +1118,15 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t" << default_raw << endl;
}
// ------------------------------------------------------------------------
// Metadata used by drivers
// ------------------------------------------------------------------------
file << "\t<metadata>" << endl;
file << "\t\t<system_datastore>" << vm->get_remote_system_dir() <<
"</system_datastore>" << endl;
file << "\t</metadata>" << endl;
file << "</domain>" << endl;
file.close();

View File

@ -318,6 +318,8 @@ module KVM
doc = REXML::Document.new(xml)
size = 0
systemds = doc.elements['domain/metadata/system_datastore'] rescue nil
systemds = systemds.text.gsub(/\/+/, '/') if systemds
data = {
:disk_size => [],
@ -358,6 +360,24 @@ module KVM
end
else
# Search the disk in system datastore when the source
# is a persistent image with snapshots
if !file.match(/.*disk\.\d+$/) && systemds
source = file.gsub(%r{/+}, '/')
disks = Dir["#{systemds}/disk.*"]
disks.each do |disk|
next if !File.symlink?(disk)
link = File.readlink(disk).gsub(%r{/+}, '/')
if link == source
file = disk
break
end
end
end
# Regular Disk
text = `qemu-img info --output=json #{file}`
next if !$? || !$?.success?