Revision 4269abbd
Added by Tomáš Strachota almost 9 years ago
app/models/compute_resource.rb | ||
---|---|---|
|
||
def vm_compute_attributes_for(uuid)
|
||
vm = find_vm_by_uuid(uuid)
|
||
vm.attributes.reject{|k,v| k == :id }
|
||
vm_attrs = vm.attributes rescue {}
|
||
vm_attrs = vm_attrs.reject{|k,v| k == :id }
|
||
|
||
if vm.respond_to?(:volumes)
|
||
volumes = vm.volumes || []
|
||
vm_attrs[:volumes_attributes] = Hash[volumes.each_with_index.map { |volume, idx| [idx.to_s, volume.attributes] }]
|
||
end
|
||
vm_attrs
|
||
rescue ActiveRecord::RecordNotFound
|
||
logger.warn("VM with UUID '#{uuid}' not found on #{self}")
|
||
{}
|
||
end
|
||
|
||
def user_data_supported?
|
Also available in: Unified diff
Fixes #10248 - cloning volume information for virtual machines