# File lib/genome-lib/virsh.rb, line 71 def autostart(opts={}) name = opts[:domname].nil? ? get_name(opts[:uuid]) : opts[:domname] # popen3 doesn't capture the exist status because of the way it spawns # the child process IO.popen("virsh autostart #{name} 2>&1") do |io| yield(io) if block_given? end if $?.exitstatus != 0 # We're probably running Xen. if File.exist?("/etc/xen") FileUtils.rm_rf("/etc/xen/auto/#{name}") # in case this machine already existed FileUtils.ln_s("/etc/xen/#{name}", "/etc/xen/auto/#{name}") end end end