Method: Fog::Compute::Libvirt::Volume#xml_from_template
- Defined in:
- lib/fog/libvirt/models/compute/volume.rb
#xml_from_template ⇒ Object
Create a valid xml for the volume based on the template
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/fog/libvirt/models/compute/volume.rb', line 92 def xml_from_template allocation_size,allocation_unit=split_size_unit(self.allocation) capacity_size,capacity_unit=split_size_unit(self.capacity) ={ :name => self.name, :format_type => self.format_type, :allocation_size => allocation_size, :allocation_unit => allocation_unit, :capacity_size => capacity_size, :capacity_unit => capacity_unit } # We only want specific variables for ERB vars = ErbBinding.new() template_path=File.join(File.dirname(__FILE__),"templates","volume.xml.erb") template=File.open(template_path).readlines.join erb = ERB.new(template) vars_binding = vars.send(:get_binding) result=erb.result(vars_binding) return result end |