Merge pull request #7120 from jtopjian/openstack-lbaas-updates

provider/openstack: lbaas v2 updates
This commit is contained in:
Joe Topjian 2016-06-11 09:05:51 -06:00 committed by GitHub
commit 8d78f9c4e1
7 changed files with 215 additions and 184 deletions

View File

@ -19,12 +19,8 @@ export PATH=$PATH:$HOME/terraform:$HOME/go/bin
echo 'export PATH=$PATH:$HOME/terraform:$HOME/go/bin' >> .bashrc
source .bashrc
go get github.com/tools/godep
go get github.com/hashicorp/terraform
cd $GOPATH/src/github.com/hashicorp/terraform
godep restore
cd
git clone https://git.openstack.org/openstack-dev/devstack -b stable/mitaka
cd devstack
cat >local.conf <<EOF
@ -70,10 +66,27 @@ enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service q-metering
enable_service q-lbaas
enable_service q-flavors
# Disable Neutron metering
disable_service q-metering
# Enable LBaaS V1
#enable_service q-lbaas
# Enable FWaaS
enable_service q-fwaas
# Enable LBaaS v2
enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/\$OPENSTACK_VERSION
enable_plugin octavia https://git.openstack.org/openstack/octavia stable/\$OPENSTACK_VERSION
enable_service q-lbaasv2
enable_service octavia
enable_service o-cw
enable_service o-hk
enable_service o-hm
enable_service o-api
# Enable Trove
enable_plugin trove git://git.openstack.org/openstack/trove.git stable/\$OPENSTACK_VERSION
enable_service trove,tr-api,tr-tmgr,tr-cond
@ -84,6 +97,13 @@ disable_service tempest
# Disable Horizon
disable_service horizon
# Disable Keystone v2
#ENABLE_IDENTITY_V2=False
# Enable SSL/tls
#enable_service tls-proxy
#USE_SSL=True
# Enable Ceilometer
#enable_service ceilometer-acompute
#enable_service ceilometer-acentral
@ -110,6 +130,17 @@ LOGDIR=/opt/stack/logs
EOF
./stack.sh
# Patch openrc
#cat >> openrc <<EOF
#
# Currently, in order to use openstackclient with Identity API v3,
# we need to set the domain which the user and project belong to.
#if [ "$OS_IDENTITY_API_VERSION" = "3" ]; then
# export OS_USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-"default"}
# export OS_PROJECT_DOMAIN_ID=${OS_PROJECT_DOMAIN_ID:-"default"}
#fi
#EOF
# Prep the testing environment by creating the required testing resources and environment variables
source openrc admin
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

View File

@ -88,55 +88,55 @@ func testAccCheckLBV2ListenerExists(t *testing.T, n string, listener *listeners.
}
var TestAccLBV2ListenerConfig_basic = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
`)
var TestAccLBV2ListenerConfig_update = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener_updated"
connection_limit = 100
admin_state_up = "true"
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener_updated"
connection_limit = 100
admin_state_up = "true"
}
`)

View File

@ -110,7 +110,7 @@ func resourceLoadBalancerV2Create(d *schema.ResourceData, meta interface{}) erro
Pending: []string{"PENDING_CREATE"},
Target: []string{"ACTIVE"},
Refresh: waitForLoadBalancerActive(networkingClient, lb.ID),
Timeout: 2 * time.Minute,
Timeout: 20 * time.Minute,
Delay: 5 * time.Second,
MinTimeout: 3 * time.Second,
}

View File

@ -90,39 +90,39 @@ func testAccCheckLBV2LoadBalancerExists(t *testing.T, n string, lb *loadbalancer
}
var TestAccLBV2LoadBalancerConfig_basic = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}`)
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}`)
var TestAccLBV2LoadBalancerConfig_update = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2_updated"
admin_state_up = "true"
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2_updated"
admin_state_up = "true"
}
`)

View File

@ -91,81 +91,81 @@ func testAccCheckLBV2MemberExists(t *testing.T, n string, member *pools.Member)
}
var TestAccLBV2MemberConfig_basic = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
}
resource "openstack_networking_subnet_v2" "subnet_1" {
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
}
resource "openstack_lb_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
}
resource "openstack_lb_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
}
resource "openstack_lb_member_v2" "member_1" {
resource "openstack_lb_member_v2" "member_1" {
address = "192.168.199.10"
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
protocol_port = 8080
subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
}`)
}`)
var TestAccLBV2MemberConfig_update = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
}
resource "openstack_networking_subnet_v2" "subnet_1" {
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
}
resource "openstack_lb_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
}
resource "openstack_lb_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
}
resource "openstack_lb_member_v2" "member_1" {
resource "openstack_lb_member_v2" "member_1" {
address = "192.168.199.10"
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
protocol_port = 8080
subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
weight = 10
admin_state_up = "true"
}`)
}`)

View File

@ -93,84 +93,84 @@ func testAccCheckLBV2MonitorExists(t *testing.T, n string, monitor *monitors.Mon
}
var TestAccLBV2MonitorConfig_basic = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
}
resource "openstack_networking_subnet_v2" "subnet_1" {
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
}
resource "openstack_lb_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
}
resource "openstack_lb_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 20
timeout = 10
max_retries = 5
name = "tf_test_monitor"
}`)
}
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 20
timeout = 10
max_retries = 5
name = "tf_test_monitor"
}`)
var TestAccLBV2MonitorConfig_update = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
}
resource "openstack_networking_subnet_v2" "subnet_1" {
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
}
resource "openstack_lb_listener_v2" "listener_1" {
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
}
resource "openstack_lb_pool_v2" "pool_1" {
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 30
timeout = 15
max_retries = 10
name = "tf_test_monitor_updated"
admin_state_up = "true"
}`)
}
resource "openstack_lb_monitor_v2" "monitor_1" {
pool_id = "${openstack_lb_pool_v2.pool_1.id}"
type = "PING"
delay = 30
timeout = 15
max_retries = 10
name = "tf_test_monitor_updated"
admin_state_up = "true"
}`)

View File

@ -90,66 +90,66 @@ func testAccCheckLBV2PoolExists(t *testing.T, n string, pool *pools.Pool) resour
}
var TestAccLBV2PoolConfig_basic = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}`)
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "ROUND_ROBIN"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool"
}`)
var TestAccLBV2PoolConfig_update = fmt.Sprintf(`
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_network_v2" "network_1" {
name = "tf_test_network"
admin_state_up = "true"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_networking_subnet_v2" "subnet_1" {
network_id = "${openstack_networking_network_v2.network_1.id}"
cidr = "192.168.199.0/24"
ip_version = 4
name = "tf_test_subnet"
}
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "LEAST_CONNECTIONS"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool_update"
admin_state_up = "true"
}`)
resource "openstack_lb_loadbalancer_v2" "loadbalancer_1" {
vip_subnet_id = "${openstack_networking_subnet_v2.subnet_1.id}"
name = "tf_test_loadbalancer_v2"
}
resource "openstack_lb_listener_v2" "listener_1" {
protocol = "HTTP"
protocol_port = 8080
loadbalancer_id = "${openstack_lb_loadbalancer_v2.loadbalancer_1.id}"
name = "tf_test_listener"
}
resource "openstack_lb_pool_v2" "pool_1" {
protocol = "HTTP"
lb_method = "LEAST_CONNECTIONS"
listener_id = "${openstack_lb_listener_v2.listener_1.id}"
name = "tf_test_pool_update"
admin_state_up = "true"
}`)