Class: VagrantPlugins::ProviderZone::QGA::IllumosBackend
- Inherits:
-
BaseBackend
- Object
- BaseBackend
- VagrantPlugins::ProviderZone::QGA::IllumosBackend
- Defined in:
- lib/vagrant-zones/qga/illumos_backend.rb
Overview
OmniOS / illumos / SunOS: rename link, create-if, static address, route.
Constant Summary collapse
- DLADM =
'/usr/sbin/dladm'- IPADM =
'/usr/sbin/ipadm'- ROUTE =
'/usr/sbin/route'
Instance Method Summary collapse
Methods inherited from BaseBackend
Instance Method Details
#apply(uii, qga, nics, _ctx) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vagrant-zones/qga/illumos_backend.rb', line 22 def apply(uii, qga, nics, _ctx) nics.each do |entry| device, current_if = find_device(qga, entry[:mac]) raise Errors::QGAError, message: "illumos device for MAC #{entry[:mac]} not found" if device.nil? || device.empty? qga.exec(IPADM, args: ['delete-if', device], timeout: 15) if current_if && current_if != '--' && current_if != entry[:vnic_name] qga.exec(DLADM, args: ['rename-link', device, entry[:vnic_name]], timeout: 15) unless device == entry[:vnic_name] qga.exec(IPADM, args: ['create-if', entry[:vnic_name]], timeout: 15) apply_address(qga, entry) apply_route(qga, entry) apply_resolv(qga, entry) uii.info(I18n.t('vagrant_zones.qga_backend_apply') + " illumos-dladm #{entry[:vnic_name]}") end end |
#detect?(qga) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/vagrant-zones/qga/illumos_backend.rb', line 14 def detect?(qga) os = qga.osinfo %w[omnios sunos illumos].any? { |id| os['id'].to_s.downcase.include?(id) } || os['kernel-version'].to_s =~ /illumos|SunOS/i rescue StandardError false end |