# File lib/cloudhost/util.rb, line 61
    def autostart_guests
      running = @guests.find_all {|g| g.running?}.map {|g| g.name}
      auto_dir = xen_host? ? "/etc/xen/auto" : "/etc/libvirt/qemu/autostart"
      # Rip off the extension for KVM guests
      autostartable = Dir[File.join(auto_dir, "*")].map {|f| File.basename(f, ".xml")}

      # Only start domains that aren't already running
      (autostartable - running).each do |g| 
        $LOG.debug("Starting #{g}")
        IO.popen("virsh start #{g} 2>&1") do |io|
          $LOG.debug(io.read)
        end

        if $?.exitstatus != 0
           guest = Cloudhost::Models::Guest.find(:first, :conditions => "name = '#{g}'")
           guest.status = "failed"
           guest.save!
        end
      end
    end