Class: VagrantPlugins::QEMU::Action::StartInstance
- Inherits:
-
Object
- Object
- VagrantPlugins::QEMU::Action::StartInstance
- Defined in:
- lib/vagrant-qemu/action/start_instance.rb
Overview
This starts a stopped instance.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #forwarded_ports(env) ⇒ Object
-
#initialize(app, env) ⇒ StartInstance
constructor
A new instance of StartInstance.
Constructor Details
#initialize(app, env) ⇒ StartInstance
Returns a new instance of StartInstance.
8 9 10 11 |
# File 'lib/vagrant-qemu/action/start_instance.rb', line 8 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant_qemu::action::start_instance") end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vagrant-qemu/action/start_instance.rb', line 13 def call(env) fwPorts = forwarded_ports(env) = { :ssh_host => env[:machine].provider_config.ssh_host, :ssh_port => env[:machine].provider_config.ssh_port, :arch => env[:machine].provider_config.arch, :machine => env[:machine].provider_config.machine, :cpu => env[:machine].provider_config.cpu, :smp => env[:machine].provider_config.smp, :memory => env[:machine].provider_config.memory, :net_device => env[:machine].provider_config.net_device, :drive_interface => env[:machine].provider_config.drive_interface, :qemu_bin => env[:machine].provider_config.qemu_bin, :extra_qemu_args => env[:machine].provider_config.extra_qemu_args, :extra_netdev_args => env[:machine].provider_config.extra_netdev_args, :ports => fwPorts, :control_port => env[:machine].provider_config.control_port, :debug_port => env[:machine].provider_config.debug_port, :no_daemonize => env[:machine].provider_config.no_daemonize, :firmware_format => env[:machine].provider_config.firmware_format, :other_default => env[:machine].provider_config.other_default } env[:ui].output(I18n.t("vagrant_qemu.starting")) env[:machine].provider.driver.start() @app.call(env) end |
#forwarded_ports(env) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/vagrant-qemu/action/start_instance.rb', line 41 def forwarded_ports(env) result = [] env[:machine].config.vm.networks.each do |type, | next if type != :forwarded_port # Don't include SSH if [:id] == "ssh" if [:host] != env[:machine].provider_config.ssh_port env[:machine].provider_config.ssh_port = [:host] end next end # Skip port if it is disabled next if [:disabled] result.push("#{options[:protocol]}:#{options[:host_ip]}:#{options[:host]}-#{options[:guest_ip]}:#{options[:guest]}") end result end |