lib/bosh-bootstrap/microbosh_providers/openstack.rb in bosh-bootstrap-0.12.0 vs lib/bosh-bootstrap/microbosh_providers/openstack.rb in bosh-bootstrap-0.13.0
- old
+ new
@@ -28,19 +28,63 @@
"hm"=>{"resurrector_enabled" => true},
"ntp"=>["0.north-america.pool.ntp.org","1.north-america.pool.ntp.org"]}}
})
end
- # network:
- # type: dynamic
- # ip: 1.2.3.4
+ # For Nova/Floating IP:
+ # network:
+ # type: dynamic
+ # vip: 1.2.3.4
+ # For Neutron/Floating IP:
+ # network:
+ # type: dynamic
+ # vip: 1.2.3.4 # public floating IP
+ # cloud_properties:
+ # net_id: XXX # internal subnet
+ # For Neutron/Internal IP:
+ # network:
+ # type: manual
+ # vip: 10.10.10.3 # an IP in subnets range
+ # cloud_properties:
+ # net_id: XXX # internal subnet
def network_configuration
- {"type"=>"dynamic",
- "vip"=>public_ip
- }
+ if nova?
+ {
+ "type"=>"dynamic",
+ "vip"=>public_ip
+ }
+ elsif neutron? && using_external_gateway?
+ {
+ "type"=>"dynamic",
+ "vip"=>public_ip,
+ "cloud_properties" => {
+ "net_id" => settings.address.subnet_id
+ }
+ }
+ else
+ {
+ "type"=>"manual",
+ "ip"=>public_ip,
+ "cloud_properties" => {
+ "net_id" => settings.address.subnet_id
+ }
+ }
+ end
end
+ def nova?
+ !neutron?
+ end
+
+ def neutron?
+ settings.exists?("address.subnet_id")
+ end
+
+ def using_external_gateway?
+ settings.exists?("address.pool_name")
+ end
+
def persistent_disk
settings.bosh.persistent_disk
end
# TODO Allow discovery of an appropriate OpenStack flavor with 2+CPUs, 3+G RAM
@@ -55,11 +99,12 @@
"api_key"=>settings.provider.credentials.openstack_api_key,
"tenant"=>settings.provider.credentials.openstack_tenant,
"region"=>region,
"default_security_groups"=>security_groups,
"default_key_name"=>microbosh_name,
- "private_key"=>private_key_path}
+ "private_key"=>private_key_path,
+ "boot_from_volume"=>boot_from_volume}
end
def region
if settings.provider.credentials.openstack_region && !settings.provider.credentials.openstack_region.empty?
return settings.provider.credentials.openstack_region
@@ -68,14 +113,14 @@
end
def security_groups
["ssh",
"dns_server",
- "bosh_agent_https",
- "bosh_nats_server",
- "bosh_blobstore",
- "bosh_director",
- "bosh_registry"]
+ "bosh"]
+ end
+
+ def boot_from_volume
+ !!(settings.provider["options"] && settings.provider.options.boot_from_volume)
end
def stemcell_uri
"http://bosh-jenkins-artifacts.s3.amazonaws.com/bosh-stemcell/openstack/bosh-stemcell-latest-openstack-kvm-ubuntu.tgz"
end