Class: Bosh::Director::InstanceUpdater::NetworkUpdater::ConfigureNetworksStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/instance_updater/network_updater.rb

Overview

Newer agents support prepare_configure_networks/configure_networks messages

Instance Method Summary collapse

Constructor Details

#initialize(agent_client, network_settings, logger) ⇒ ConfigureNetworksStrategy

Returns a new instance of ConfigureNetworksStrategy.



49
50
51
52
53
# File 'lib/bosh/director/instance_updater/network_updater.rb', line 49

def initialize(agent_client, network_settings, logger)
  @agent_client = agent_client
  @network_settings = network_settings
  @logger = logger
end

Instance Method Details

#after_configure_networksObject



64
65
66
67
68
69
70
71
72
73
# File 'lib/bosh/director/instance_updater/network_updater.rb', line 64

def after_configure_networks
  # Some CPIs might power off and then power on vm to reconfigure network adapters,
  # so Director needs to wait for agent to become responsive
  @logger.info('Waiting for agent to become responsive')
  @agent_client.wait_until_ready

  # Agent's configure_networks is a long running task
  # hence we do not need to wait_until_ready after it
  @agent_client.configure_networks(@network_settings)
end

#before_configure_networksObject



55
56
57
58
59
60
61
62
# File 'lib/bosh/director/instance_updater/network_updater.rb', line 55

def before_configure_networks
  @agent_client.prepare_configure_networks(@network_settings)
  true
rescue RpcRemoteException => e
  @logger.info("Agent returned error from prepare_configure_networks: #{e.inspect}")
  raise unless e.message =~ /unknown message/
  false
end