def build_xml(opts = {})
      opts = {:bus => @bus, :os_type => :hvm}.merge!(opts)

      builder = Builder::XmlMarkup.new(:indent => 2)

      xml = builder.domain(:type => opts[:domain_type].to_s) do |domain|
        domain.name(@appliance_name)
        domain.description(@appliance_config.summary)
        domain.memory(@appliance_config.hardware.memory * 1024) #KB
        domain.vcpu(@appliance_config.hardware.cpus)
        domain.os do |os|
          os.type(opts[:os_type].to_s, :arch => @appliance_config.hardware.arch)
          os.boot(:dev => 'hd')
        end
        domain.devices do |devices|
          devices.disk(:type => 'file', :device => 'disk') do |disk|
            disk.source(:file => "#{@libvirt_image_uri}/#{File.basename(@previous_deliverables.disk)}")
            disk.target(:dev => 'hda', :bus => opts[:bus].to_s)
          end
          devices.interface(:type => 'network') do |interface|
            interface.source(:network => @network)
            interface.mac(:address => @mac) if @mac
          end
          devices.console(:type => 'pty') unless @noautoconsole
          devices.graphics(:type => 'vnc', :port => -1) unless @novnc
        end
        domain.features do |features|
          features.pae if @appliance_config.os.pae
        end
      end
      @log.debug xml

      # Let the user modify the XML specification to their requirements
      if @script
        @log.info "Attempting to run user provided script for modifying libVirt XML..."
        xml = IO::popen("#{@script} --domain '#{xml}'").read
        @log.debug "Response was: #{xml}"
      end
      xml
    end
def build_xml(opts = {})
      opts = {:bus => @bus, :os_type => :hvm}.merge!(opts)

      builder = Builder::XmlMarkup.new(:indent => 2)

      xml = builder.domain(:type => opts[:domain_type].to_s) do |domain|
        domain.name(@appliance_name)
        domain.description(@appliance_config.summary)
        domain.memory(@appliance_config.hardware.memory * 1024) #KB
        domain.vcpu(@appliance_config.hardware.cpus)
        domain.os do |os|
          os.type(opts[:os_type].to_s, :arch => @appliance_config.hardware.arch)
          os.boot(:dev => 'hd')
        end
        domain.devices do |devices|
          devices.disk(:type => 'file', :device => 'disk') do |disk|
            disk.source(:file => "#{@libvirt_image_uri}/#{File.basename(@previous_deliverables.disk)}")
            disk.target(:dev => 'hda', :bus => opts[:bus].to_s)
          end
          devices.interface(:type => 'network') do |interface|
            interface.source(:network => @network)
            interface.mac(:address => @mac) if @mac
          end
          devices.console(:type => 'pty') unless @noautoconsole
          devices.graphics(:type => 'vnc', :port => -1) unless @novnc
        end
        domain.features do |features|
          features.pae if @appliance_config.os.pae
        end
      end
      @log.debug xml

      # Let the user modify the XML specification to their requirements
      if @script
        @log.info "Attempting to run user provided script for modifying libVirt XML..."
        xml = IO::popen("#{@script} --domain '#{xml}'").read
        @log.debug "Response was: #{xml}"
      end
      xml
    end
Build the XML domain definition. If the user provides a script, it will be called after
 the basic definition has been constructed with the XML as the sole parameter. The output
 from stdout of the script will be used as the new domain definition.