Create floating ip by normal user

In real use case, it should be the end user who will create floating
ip and associate with loadbalancer vip.

Also use config_drive when creating backend server, to keep consistent
with amphora creation in octavia itself.

Tested in devstack.

Change-Id: I2cbee37f494a5775a96f8c285f0e52c0b2550d5b
This commit is contained in:
Lingxian Kong 2018-01-16 00:20:37 +13:00
parent eaedb340d8
commit bf966a9b25
3 changed files with 11 additions and 12 deletions

View File

@ -57,10 +57,6 @@ OctaviaGroup = [
default=900,
help='Timeout in seconds to wait for a '
'loadbalancer to build.'),
cfg.BoolOpt('premade_server',
default=False,
help='Allows us to use an already provisioned server to test '
'loadbalancing.'),
cfg.StrOpt('premade_server_ip',
default=None,
help='IP of the premade server.'),

View File

@ -208,9 +208,13 @@ def create_server(clients, name=None, flavor=None, image_id=None,
if wait_until is None:
wait_until = 'ACTIVE'
body = clients.servers_client.create_server(name=name, imageRef=image_id,
flavorRef=flavor,
**kwargs)
body = clients.servers_client.create_server(
name=name,
imageRef=image_id,
flavorRef=flavor,
config_drive=True,
**kwargs
)
server = rest_client.ResponseBody(body.response, body['server'])
def _setup_validation_fip():

View File

@ -67,7 +67,6 @@ class BaseLoadbalancerTest(test.BaseTestCase):
cls.interfaces_client = cls.os_roles_lbmember.interfaces_client
cls.sg_rule_client = cls.os_roles_lbmember.security_group_rules_client
cls.floatingip_client = cls.os_roles_lbmember.floating_ips_client
cls.floatingip_adm_client = cls.os_admin.floating_ips_client
cls.routers_adm_client = cls.os_admin.routers_client
if CONF.identity.auth_version == 'v3':
@ -451,17 +450,17 @@ class BaseLoadbalancerTest(test.BaseTestCase):
self.assertEqual(1, len(set(response_counts.values())))
def _delete_floatingip(self, floating_ip):
self.floatingip_adm_client.update_floatingip(
self.floatingip_client.update_floatingip(
floating_ip,
port_id=None
)
test_utils.call_and_ignore_notfound_exc(
self.floatingip_adm_client.delete_floatingip, floating_ip
self.floatingip_client.delete_floatingip, floating_ip
)
def _associate_floatingip(self):
# Associate floatingip with loadbalancer vip
floatingip = self.floatingip_adm_client.create_floatingip(
floatingip = self.floatingip_client.create_floatingip(
floating_network_id=CONF.network.public_network_id
)['floatingip']
floatip_vip = floatingip['floating_ip_address']
@ -469,7 +468,7 @@ class BaseLoadbalancerTest(test.BaseTestCase):
LOG.debug('Floating ip %s created.', floatip_vip)
self.floatingip_adm_client.update_floatingip(
self.floatingip_client.update_floatingip(
floatingip['id'],
port_id=self.vip_port
)