Skip to content

Commit 24f31f1

Browse files
committed
AutoScaling: update smoke test and consider db upgrade from a fork
1 parent 72b6ab9 commit 24f31f1

File tree

2 files changed

+60
-49
lines changed

2 files changed

+60
-49
lines changed

engine/schema/src/main/resources/META-INF/db/schema-41720to41800.sql

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,6 @@ BEGIN
298298
-- Add column 'supports_vm_autoscaling' to 'network_offerings' table
299299
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings', 'supports_vm_autoscaling', 'boolean default false');
300300

301-
-- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb
302-
UPDATE `cloud`.`network_offerings`
303-
JOIN `cloud`.`ntwk_offering_service_map`
304-
ON network_offerings.id = ntwk_offering_service_map.network_offering_id
305-
SET network_offerings.supports_vm_autoscaling = 1
306-
WHERE ntwk_offering_service_map.service = 'Lb'
307-
AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler')
308-
AND network_offerings.removed IS NULL;
309-
310301
-- Add column 'name' to 'autoscale_vmgroups' table
311302
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmgroups', 'name', 'VARCHAR(255) DEFAULT NULL COMMENT "name of the autoscale vm group" AFTER `load_balancer_id`');
312303
UPDATE `cloud`.`autoscale_vmgroups` SET `name` = CONCAT('AutoScale-VmGroup-',id) WHERE `name` IS NULL;
@@ -446,6 +437,16 @@ CREATE VIEW `cloud`.`network_offering_view` AS
446437
GROUP BY
447438
`network_offerings`.`id`;
448439

440+
-- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb
441+
UPDATE `cloud`.`network_offerings`
442+
JOIN `cloud`.`ntwk_offering_service_map`
443+
ON network_offerings.id = ntwk_offering_service_map.network_offering_id
444+
SET network_offerings.supports_vm_autoscaling = 1
445+
WHERE ntwk_offering_service_map.service = 'Lb'
446+
AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler')
447+
AND network_offerings.removed IS NULL
448+
AND (SELECT COUNT(id) AS count FROM `network_offering_view` WHERE supports_vm_autoscaling = 1) = 0;
449+
449450
-- UserData as first class resource (PR #6202)
450451
CREATE TABLE `cloud`.`user_data` (
451452
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',

test/integration/smoke/test_vm_autoscaling.py

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def setUpClass(cls):
144144
cls.apiclient,
145145
cls.services["isolated_network_offering"]
146146
)
147-
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')
148147
cls._cleanup.append(cls.network_offering_isolated)
148+
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')
149149

150150
# 4. Create sub-domain
151151
cls.sub_domain = Domain.create(
@@ -176,6 +176,7 @@ def setUpClass(cls):
176176
networkofferingid=cls.network_offering_isolated.id,
177177
zoneid=cls.zone.id
178178
)
179+
cls._cleanup.append(cls.user_network_1)
179180

180181
cls.services["network"]["name"] = "Test Network Isolated - Regular user - 2"
181182
cls.user_network_2 = Network.create(
@@ -184,12 +185,14 @@ def setUpClass(cls):
184185
networkofferingid=cls.network_offering_isolated.id,
185186
zoneid=cls.zone.id
186187
)
188+
cls._cleanup.append(cls.user_network_2)
187189

188190
# 8. Create SSH Keypairs
189191
cls.keypair_1 = SSHKeyPair.create(
190192
cls.regular_user_apiclient,
191193
name="keypair1"
192194
)
195+
193196
cls.keypair_2 = SSHKeyPair.create(
194197
cls.regular_user_apiclient,
195198
name="keypair2"
@@ -224,17 +227,41 @@ def setUpClass(cls):
224227
relationaloperator = "GE",
225228
threshold = 1
226229
)
230+
cls._cleanup.append(cls.scale_up_condition)
227231

228232
cls.scale_down_condition = AutoScaleCondition.create(
229233
cls.regular_user_apiclient,
230234
counterid = cls.counter_cpu_or_memory_id,
231235
relationaloperator = "LE",
232236
threshold = 100
233237
)
234-
235-
cls._cleanup.append(cls.scale_up_condition)
236238
cls._cleanup.append(cls.scale_down_condition)
237239

240+
# 10.2 Create new AS conditions for VM group update
241+
cls.new_condition_1 = AutoScaleCondition.create(
242+
cls.regular_user_apiclient,
243+
counterid=cls.counter_network_received_id,
244+
relationaloperator="GE",
245+
threshold=0
246+
)
247+
cls._cleanup.append(cls.new_condition_1)
248+
249+
cls.new_condition_2 = AutoScaleCondition.create(
250+
cls.regular_user_apiclient,
251+
counterid=cls.counter_network_transmit_id,
252+
relationaloperator="GE",
253+
threshold=0
254+
)
255+
cls._cleanup.append(cls.new_condition_2)
256+
257+
cls.new_condition_3 = AutoScaleCondition.create(
258+
cls.regular_user_apiclient,
259+
counterid=cls.counter_lb_connection_id,
260+
relationaloperator="GE",
261+
threshold=0
262+
)
263+
cls._cleanup.append(cls.new_condition_3)
264+
238265
# 11. Create AS policies
239266
cls.scale_up_policy = AutoScalePolicy.create(
240267
cls.regular_user_apiclient,
@@ -243,6 +270,7 @@ def setUpClass(cls):
243270
quiettime=DEFAULT_QUIETTIME,
244271
duration=DEFAULT_DURATION
245272
)
273+
cls._cleanup.append(cls.scale_up_policy)
246274

247275
cls.scale_down_policy = AutoScalePolicy.create(
248276
cls.regular_user_apiclient,
@@ -251,8 +279,6 @@ def setUpClass(cls):
251279
quiettime=DEFAULT_QUIETTIME,
252280
duration=DEFAULT_DURATION
253281
)
254-
255-
cls._cleanup.append(cls.scale_up_policy)
256282
cls._cleanup.append(cls.scale_down_policy)
257283

258284
# 12. Create AS VM Profile
@@ -280,6 +306,7 @@ def setUpClass(cls):
280306
services=cls.services["network"],
281307
networkid=cls.user_network_1.id
282308
)
309+
cls._cleanup.append(cls.public_ip_address)
283310

284311
cls.services["lbrule"]["openfirewall"] = False
285312
cls.load_balancer_rule = LoadBalancerRule.create(
@@ -288,6 +315,7 @@ def setUpClass(cls):
288315
ipaddressid=cls.public_ip_address.ipaddress.id,
289316
networkid=cls.user_network_1.id
290317
)
318+
cls._cleanup.append(cls.load_balancer_rule)
291319

292320
# 14. Create AS VM Group
293321
cls.autoscaling_vmgroup = AutoScaleVmGroup.create(
@@ -663,28 +691,10 @@ def test_03_scale_down_verify(self):
663691
)
664692
scale_down_policy = policies[0]
665693

666-
new_condition_1 = AutoScaleCondition.create(
667-
self.regular_user_apiclient,
668-
counterid=self.counter_network_received_id,
669-
relationaloperator="GE",
670-
threshold=0
671-
)
672-
new_condition_2 = AutoScaleCondition.create(
673-
self.regular_user_apiclient,
674-
counterid=self.counter_network_transmit_id,
675-
relationaloperator="GE",
676-
threshold=0
677-
)
678-
new_condition_3 = AutoScaleCondition.create(
679-
self.regular_user_apiclient,
680-
counterid=self.counter_lb_connection_id,
681-
relationaloperator="GE",
682-
threshold=0
683-
)
684694
Autoscale.updateAutoscalePolicy(
685695
self.regular_user_apiclient,
686696
id=scale_down_policy.id,
687-
conditionids=','.join([new_condition_1.id, new_condition_2.id, new_condition_3.id])
697+
conditionids=','.join([self.new_condition_1.id, self.new_condition_2.id, self.new_condition_3.id])
688698
)
689699

690700
self.autoscaling_vmgroup.enable(self.regular_user_apiclient)
@@ -807,6 +817,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
807817
relationaloperator = "GE",
808818
threshold = 1
809819
)
820+
self.cleanup.append(scale_up_condition_project)
810821

811822
scale_down_condition_project = AutoScaleCondition.create(
812823
self.regular_user_apiclient,
@@ -815,8 +826,6 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
815826
relationaloperator = "LE",
816827
threshold = 100
817828
)
818-
819-
self.cleanup.append(scale_up_condition_project)
820829
self.cleanup.append(scale_down_condition_project)
821830

822831
# Create AS policies for project
@@ -827,6 +836,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
827836
quiettime=DEFAULT_QUIETTIME,
828837
duration=DEFAULT_DURATION
829838
)
839+
self.cleanup.append(scale_up_policy_project)
830840

831841
scale_down_policy_project = AutoScalePolicy.create(
832842
self.regular_user_apiclient,
@@ -835,8 +845,6 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
835845
quiettime=DEFAULT_QUIETTIME,
836846
duration=DEFAULT_DURATION
837847
)
838-
839-
self.cleanup.append(scale_up_policy_project)
840848
self.cleanup.append(scale_down_policy_project)
841849

842850
# Create AS VM Profile for project
@@ -848,6 +856,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
848856
expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD,
849857
projectid = project.id
850858
)
859+
self.cleanup.append(autoscaling_vmprofile_project)
851860

852861
# Create AS VM Group for project
853862
autoscaling_vmgroup_project = AutoScaleVmGroup.create(
@@ -989,47 +998,50 @@ def test_07_autoscaling_vmgroup_on_vpc_network(self):
989998
relationaloperator = "GE",
990999
threshold = 1
9911000
)
992-
scale_up_condition_3 = AutoScaleCondition.create(
1001+
self.cleanup.append(scale_up_condition_1)
1002+
1003+
scale_up_condition_2 = AutoScaleCondition.create(
9931004
self.regular_user_apiclient,
9941005
counterid=self.counter_network_received_id,
9951006
relationaloperator="GE",
9961007
threshold=0
9971008
)
998-
scale_up_condition_4 = AutoScaleCondition.create(
1009+
self.cleanup.append(scale_up_condition_2)
1010+
1011+
scale_up_condition_3 = AutoScaleCondition.create(
9991012
self.regular_user_apiclient,
10001013
counterid=self.counter_network_transmit_id,
10011014
relationaloperator="GE",
10021015
threshold=0
10031016
)
1004-
scale_up_condition_5 = AutoScaleCondition.create(
1017+
self.cleanup.append(scale_up_condition_3)
1018+
1019+
scale_up_condition_4 = AutoScaleCondition.create(
10051020
self.regular_user_apiclient,
10061021
counterid=self.counter_lb_connection_id,
10071022
relationaloperator="GE",
10081023
threshold=0
10091024
)
1025+
self.cleanup.append(scale_up_condition_4)
10101026

10111027
scale_down_condition_vpc = AutoScaleCondition.create(
10121028
self.regular_user_apiclient,
10131029
counterid = self.counter_cpu_or_memory_id,
10141030
relationaloperator = "LE",
10151031
threshold = 100
10161032
)
1017-
1018-
self.cleanup.append(scale_up_condition_1)
1019-
self.cleanup.append(scale_up_condition_3)
1020-
self.cleanup.append(scale_up_condition_4)
1021-
self.cleanup.append(scale_up_condition_5)
10221033
self.cleanup.append(scale_down_condition_vpc)
10231034

10241035
# Create AS policies for vpc
10251036
scale_up_policy_vpc = AutoScalePolicy.create(
10261037
self.regular_user_apiclient,
10271038
action='ScaleUp',
1028-
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_3.id,
1029-
scale_up_condition_4.id, scale_up_condition_5.id]),
1039+
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_2.id,
1040+
scale_up_condition_3.id, scale_up_condition_4.id]),
10301041
quiettime=DEFAULT_QUIETTIME,
10311042
duration=DEFAULT_DURATION
10321043
)
1044+
self.cleanup.append(scale_up_policy_vpc)
10331045

10341046
scale_down_policy_vpc = AutoScalePolicy.create(
10351047
self.regular_user_apiclient,
@@ -1038,8 +1050,6 @@ def test_07_autoscaling_vmgroup_on_vpc_network(self):
10381050
quiettime=DEFAULT_QUIETTIME,
10391051
duration=DEFAULT_DURATION
10401052
)
1041-
1042-
self.cleanup.append(scale_up_policy_vpc)
10431053
self.cleanup.append(scale_down_policy_vpc)
10441054

10451055
# Create AS VM Profile for vpc

0 commit comments

Comments
 (0)