# File lib/genome-lib/threads.rb, line 31
    def run
      ip = Facter[:ipaddress].value
      fqdn = Facter[:fqdn].value
      virt_type = if File.exist?("/dev/kvm")
                   "KVM"
                 elsif File.exist?("/proc/xen")
                   "Xen"
                 else
                   "Unknown"
                 end

      virsh = Virsh.new
      ni = virsh.nodeinfo

      guests = @model.find(:all).map do |g|
        VirtGuest.new(g.name, g.uuid, g.hostname, g.ipaddress, g.appliance, g.status, g.arch)
      end

      c = Cloud.new(::Genome[:cloudmaster])
      c.update_machine(::Genome[:uuid], :ipaddress => ip,
                                        :virt_type => virt_type,
                                        :hostname => fqdn,
                                        :arch => Facter[:architecture].value,
                                        :totalmem => ni.memsize,
                                        :freemem => ni.memsize - @model.used_mem,  
                                        :guests => guests.to_yaml)
    end