# File lib/cloudmasterd.rb, line 186
    def destroy(name)
      Syncer::lock do
        Machine.find(:all, :conditions => "name = '#{name}'").each do |machine|
          # If the machine is missing, don't bother remotely trying to cleanup
          unless machine.state == "missing" then
            # Destroy the virtual machine
            `func "#{machine.cloud}" call command run "virsh destroy #{machine.name}"`
            `func "#{machine.cloud}" call command run "virsh undefine #{machine.name}"`

            # Remove the auto start file if it exists
            `func "#{machine.cloud}" call command run "rm -rf /etc/xen/auto/#{machine.name}"`

            # Remove the image file
            `func "#{machine.cloud}" call command run "rm -rf /images/#{machine.name}-disk0"`
          end

          # Delete the DB record
          machine.destroy
        end
      end

      redirect R(Status)
    end