Class: Staypuft::Deployment::NovaService

Inherits:
AbstractParamScope show all
Defined in:
app/models/staypuft/deployment/nova_service.rb

Defined Under Namespace

Modules: NetworkManager, PrivateFixedRange, PublicFloatingRange, VlanRange Classes: Jail, NetworkRangesValidator, NovaVlanRangeValidator

Constant Summary collapse

VLAN_HELP =
Deployment::NeutronService::VLAN_HELP

Instance Attribute Summary

Attributes inherited from AbstractParamScope

#deployment

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractParamScope

#attributes=, #hostgroup, #initialize, #marked_for_destruction?

Methods included from AttributeParamStorage

#param_attr, #param_attr_array, #param_scope

Constructor Details

This class inherits a constructor from Staypuft::Deployment::AbstractParamScope

Class Method Details

.param_scopeObject



3
4
5
# File 'app/models/staypuft/deployment/nova_service.rb', line 3

def self.param_scope
  'nova'
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'app/models/staypuft/deployment/nova_service.rb', line 92

def active?
  deployment.networking == Deployment::Networking::NOVA
end

#network_overridesObject



100
101
102
103
104
# File 'app/models/staypuft/deployment/nova_service.rb', line 100

def network_overrides
  { 'force_dhcp_release' => false }.tap do |h|
    h.update 'vlan_start' => vlan_start if self.vlan_manager?
  end.to_yaml
end

#num_networksObject



114
115
116
117
118
119
120
# File 'app/models/staypuft/deployment/nova_service.rb', line 114

def num_networks
  if self.vlan_manager?
    vlan_range_arr[1].to_i - vlan_range_arr[0].to_i + 1
  else
    1
  end
end

#param_hashObject



122
123
124
125
126
127
# File 'app/models/staypuft/deployment/nova_service.rb', line 122

def param_hash
  { 'network_manager'          => network_manager,
    'vlan_range'               => vlan_range,
    'public_floating_range'    => public_floating_range,
    'private_fixed_range'      => private_fixed_range }
end

#set_defaultsObject



88
89
90
# File 'app/models/staypuft/deployment/nova_service.rb', line 88

def set_defaults
  self.network_manager = NetworkManager::FLAT_DHCP
end

#vlan_manager?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'app/models/staypuft/deployment/nova_service.rb', line 96

def vlan_manager?
  self.network_manager == NetworkManager::VLAN
end

#vlan_range_arrObject



106
107
108
# File 'app/models/staypuft/deployment/nova_service.rb', line 106

def vlan_range_arr
  arr = self.vlan_range.split(':')
end

#vlan_startObject



110
111
112
# File 'app/models/staypuft/deployment/nova_service.rb', line 110

def vlan_start
  vlan_range_arr[0]
end