1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #3718: Monitor regular disk snapshots

This commit is contained in:
Jaime Melis 2015-07-09 10:54:55 +02:00
parent cd51b67f3f
commit 3d4bfa63a8

View File

@ -357,7 +357,7 @@ module KVM
data[:snapshot_size] << { :id => snap_id, :disk_id => disk_id, :size => snapshot_size.round}
end
else file
else
# Regular Disk
text = `qemu-img info --output=json #{file}`
next if !$? || !$?.success?
@ -369,10 +369,23 @@ module KVM
disk_size = json['actual-size'].to_f/1024/1024
data[:disk_size] << {:id => disk_id, :size => disk_size.round}
# Get snapshots
Dir[file + '.snap/*'].each do |snap|
text = `qemu-img info --output=json #{snap}`
next if !$? || !$?.success?
json = JSON.parse(text)
snap_id = snap.split("/")[-1]
snap_size = json['actual-size'].to_f/1024/1024
data[:snapshot_size] << { :id => snap_id, :disk_id => disk_id, :size => snap_size.round}
end
end
end
data
end