# File lib/ovirt/vm.rb, line 11 def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) end
# File lib/ovirt/vm.rb, line 28 def self.ticket options={} builder = Nokogiri::XML::Builder.new do action_{ ticket_{ expiry_(options[:expiry] || 120) } } end Nokogiri::XML(builder.to_xml).root.to_s end
# File lib/ovirt/vm.rb, line 35 def self.to_xml(opts={}) builder = Nokogiri::XML::Builder.new do vm{ name_ opts[:name] || "i-#{Time.now.to_i}" if opts[:template] template_ :id => (opts[:template]) elsif opts[:template_name] template_{ name_(opts[:template_name])} else template_{name_('Blank')} end if opts[:cluster] cluster_( :id => opts[:cluster]) elsif opts[:cluster_name] cluster_{ name_(opts[:cluster_name])} end type_ opts[:hwp_id] || 'Server' memory opts[:memory] ? opts[:memory].to_s : (512*1024*1024).to_s cpu { topology( :cores => (opts[:cores] || '1'), :sockets => '1' ) } os{ boot(:dev=> opts[:boot_dev1] || 'network') boot(:dev=> opts[:boot_dev2] || 'hd') } display_{ type_(opts[:display]) } if opts[:display] custom_properties { custom_property({ :name => "floppyinject", :value => "#{opts[:fileinject_path] || OVIRT::FILEINJECT_PATH}:#{opts[:user_data]}", :regexp => "^([^:]+):(.*)$"}) } if(opts[:user_data] && !opts[:user_data].empty?) } end Nokogiri::XML(builder.to_xml).root.to_s end
Generated with the Darkfish Rdoc Generator 2.