b0VIM 7.4`KXN patrickaSnark~patricka/src/vagrant-xhyve/lib/vagrant-xhyve/action/boot.rbutf-8 3210#"! Utpz*{ad zYXB3!yxb0 b * U -  s S )  z 3   n m T H G . i[ON3=10 yxP&znmW3'&utS  P\ log.debug "xhyve configuration: #{JSON.pretty_generate(config)}" config = default_config.merge(config) } acpi: true networking: true, serial: 'com1', blockdevs: block_device_paths(image_dir), initrd: initrd_file_path(image_dir), kernel: kernel_file_path(image_dir), default_config = { image_dir = File.join(env[:machine].data_dir, "image") def start_guest(env, config = {}) end @provider_config ||= env[:machine].provider_config def provider_config(env) end provider_config(env).kernel_command def kernel_command(env) end provider_config(env).xhyve_binary def xhyve_binary(env) end provider_config(env).cpus def cpus(env) end provider_config(env).memory def memory(env) end File.join(base_path, "initrd.gz") def initrd_file_path(base_path) end File.join(base_path, "vmlinuz") def kernel_file_path(base_path) end block_paths.sort block_paths = Dir.glob File.join(base_path, "block*.{raw,img,qcow,qcow2}") def block_device_paths(base_path) private end env[:action_runner].run(Action.action_destroy, destroy_env) destroy_env[:force_confirm_destroy] = true destroy_env[:config_validate] = false destroy_env.delete(:interrupted) destroy_env = env.dup def terminate(env) end end terminate(env) # Undo the import if env[:machine].provider.state.id != :not_created return if env["vagrant.error"].is_a?(Vagrant::Errors::VagrantError) def recover(env) end @app.call(env) terminate(env) if env[:interrupted] # Terminate the instance if we were interrupted save_guest_status(env, xhyve_guest) env[:machine].id = xhyve_guest.uuid # Immediately save the ID since it is created at this point. xhyve_guest = start_guest(env, guest_config) } binary: xhyve_binary(env), processors: cpus(env), memory: memory(env), cmdline: kernel_command(env), uuid: machine_uuid, mac: mac, pid: pid, guest_config = { end machine_uuid = SecureRandom.uuid else mac = machine_options[:mac] pid = machine_options[:pid] machine_uuid = machine_options[:uuid] log.debug "Machine Options: #{JSON.pretty_generate(machine_options)}" machine_options = JSON.parse(machine_json, :symbolize_names => true) machine_json = File.read(machine_info_path) if File.exist?(machine_info_path) machine_info_path = File.join(env[:machine].data_dir, "xhyve.json") env[:metrics] ||= {} # Initialize metrics if they haven't been env[:ui].info(" About to launch vm...") def call(env) end @app = app def initialize(app, env) include Vagrant::Util::Retryable class Boot # This runs the configured instance. module Action module XHYVEmodule VagrantPluginsrequire 'vagrant-xhyve/util/vagrant-xhyve'require 'vagrant-xhyve/util/timer'require 'vagrant/util/retryable'require 'securerandom'require 'json'require "log4r"ad V *c;Z q ? !   t B 6 5  ~ r h ` Z V = end end end eend end end end end @logger ||= Log4r::Logger.new("vagrant_xhyve::action::boot") def log end env[:xhyve_status] = status def update_xhyve_status(env, status) end update_xhyve_status(env, guest.options) end sleep 0.5 end raise 'Waited too long for IP to be ready. Your VM probably did not boot.' else env[:ui].info("Waiting for IP to be ready. Try #{network_ready_retries}/#{network_ready_retries_max}...") network_ready_retries += 1 if network_ready_retries < network_ready_retries_max then break if env[:interrupted] while guest.ip.nil? update_xhyve_status(env, guest.options) network_ready_retries_max = 3 network_ready_retries = 0 def wait_for_guest_ip(env, guest) end log.info(" Launched xhyve VM with PID #{guest.pid}, MAC: #{guest.mac}, and IP #{guest.ip}") File.write(machine_info_path, guest.options().to_json) log.debug "xhyve configuration: #{JSON.pretty_generate(guest.options)}" machine_info_path = File.join(env[:machine].data_dir, "xhyve.json") wait_for_guest_ip(env, guest) def save_guest_status(env, guest) end xhyve_guest xhyve_guest.start xhyve_guest = Util::XhyveGuest.new config