lib/wire/commands/verify_command.rb
# given an array of network elements (+networks_in_zone+), this
# method runs the verification on each network.
# It checks the availability of a bridge and
# the optional host ip on that bridge.
# Params:
# +networks_in_zone+:: Array of network data elements in desired zone
# +zone_name+:: Name of zone
given an array of network elements (+networks_in_zone+), this
method runs the verification on each network.
It checks the availability of a bridge and
the optional host ip on that bridge.
given an array of network elements ( + networks_in_zone + ) this method runs the verification on each network . It checks the availability of a bridge and the optional host ip on that bridge .
def verify_networks(networks_in_zone, zone_name)
      b_verify_ok = true
      networks_in_zone.each do |network_name, network_data|
        $log.debug("Verifying network \'#{network_name}\'")
        bridge_name = network_name
        $log.debug 'checking bridge ...'
        if @handler.handle_bridge(bridge_name) == false
          network_data.store :status, :failed
          b_verify_ok = false
          mark("Bridge \'#{bridge_name}\' does not exist.",
               :network, network_name, network_data)
        else
          network_data.store :status, :ok
          hostip = network_data[:hostip]
          if hostip
            $log.debug 'checking host-ip ...'
            hostip = ensure_hostip_netmask(hostip, network_data)
            if @handler.handle_hostip(bridge_name, hostip) == false
              network_data.store :status, :failed
              b_verify_ok = false
              mark("Host ip \'#{hostip}\' not up on bridge \'#{bridge_name}\'.",
                   :network, network_name, network_data)
            else
              network_data.store :status, :ok
            end
          end
          dhcp_data = network_data[:dhcp]
          if dhcp_data
            $log.debug 'checking dhcp ...'
            if @handler.handle_dhcp(zone_name, network_name, network_data,
                                    dhcp_data[:start],
                                    dhcp_data[:end]) == false
              network_data.store :status, :failed
              b_verify_ok = false
              mark("dnsmasq/dhcp not configured on network \'#{bridge_name}\'.",
                   :network, network_name, network_data)
            else
              network_data.store :status, :ok
            end
          end
        end
      end
      b_verify_ok
    end
def verify_networks ( networks_in_zone , zone_name ) b_verify_ok = true networks_in_zone . each do | network_name , network_data | $log . debug ( "Verifying network \'#{network_name}\'" ) bridge_name = network_name $log . debug 'checking bridge ...' if @handler . handle_bridge ( bridge_name ) == false network_data . store :status , :failed b_verify_ok = false mark ( "Bridge \'#{bridge_name}\' does not exist." , :network , network_name , network_data ) else network_data . store :status , :ok hostip = network_data [ :hostip ] if hostip $log . debug 'checking host-ip ...' hostip = ensure_hostip_netmask ( hostip , network_data ) if @handler . handle_hostip ( bridge_name , hostip ) == false network_data . store :status , :failed b_verify_ok = false mark ( "Host ip \'#{hostip}\' not up on bridge \'#{bridge_name}\'." , :network , network_name , network_data ) else network_data . store :status , :ok end end dhcp_data = network_data [ :dhcp ] if dhcp_data $log . debug 'checking dhcp ...' if @handler . handle_dhcp ( zone_name , network_name , network_data , dhcp_data [ :start ] , dhcp_data [ :end ] ) == false network_data . store :status , :failed b_verify_ok = false mark ( "dnsmasq/dhcp not configured on network \'#{bridge_name}\'." , :network , network_name , network_data ) else network_data . store :status , :ok end end end end b_verify_ok end
given an array of network elements (+networks_in_zone+), this
method runs the verification on each network.
given an array of network elements ( + networks_in_zone + ) this method runs the verification on each network .
# we should have a bridge with that name. # if we have a host ip, then that bridge should have # this ip # if the hostip is not in cidr, take netmask # from network entry, add to hostip # if we have dhcp, check this
networks_in_zone
<not_specific>
zone_name
<not_specific>