mirror of https://github.com/apache/cloudstack.git
AutoScaling: update smoke test and consider db upgrade from a fork (#6977)
This commit is contained in:
parent
34e4376c16
commit
512aa9cbc5
|
|
@ -298,15 +298,6 @@ BEGIN
|
||||||
-- Add column 'supports_vm_autoscaling' to 'network_offerings' table
|
-- Add column 'supports_vm_autoscaling' to 'network_offerings' table
|
||||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings', 'supports_vm_autoscaling', 'boolean default false');
|
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.network_offerings', 'supports_vm_autoscaling', 'boolean default false');
|
||||||
|
|
||||||
-- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb
|
|
||||||
UPDATE `cloud`.`network_offerings`
|
|
||||||
JOIN `cloud`.`ntwk_offering_service_map`
|
|
||||||
ON network_offerings.id = ntwk_offering_service_map.network_offering_id
|
|
||||||
SET network_offerings.supports_vm_autoscaling = 1
|
|
||||||
WHERE ntwk_offering_service_map.service = 'Lb'
|
|
||||||
AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler')
|
|
||||||
AND network_offerings.removed IS NULL;
|
|
||||||
|
|
||||||
-- Add column 'name' to 'autoscale_vmgroups' table
|
-- Add column 'name' to 'autoscale_vmgroups' table
|
||||||
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmgroups', 'name', 'VARCHAR(255) DEFAULT NULL COMMENT "name of the autoscale vm group" AFTER `load_balancer_id`');
|
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.autoscale_vmgroups', 'name', 'VARCHAR(255) DEFAULT NULL COMMENT "name of the autoscale vm group" AFTER `load_balancer_id`');
|
||||||
UPDATE `cloud`.`autoscale_vmgroups` SET `name` = CONCAT('AutoScale-VmGroup-',id) WHERE `name` IS NULL;
|
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
|
||||||
GROUP BY
|
GROUP BY
|
||||||
`network_offerings`.`id`;
|
`network_offerings`.`id`;
|
||||||
|
|
||||||
|
-- Update column 'supports_vm_autoscaling' to 1 if network offerings support Lb
|
||||||
|
UPDATE `cloud`.`network_offerings`
|
||||||
|
JOIN `cloud`.`ntwk_offering_service_map`
|
||||||
|
ON network_offerings.id = ntwk_offering_service_map.network_offering_id
|
||||||
|
SET network_offerings.supports_vm_autoscaling = 1
|
||||||
|
WHERE ntwk_offering_service_map.service = 'Lb'
|
||||||
|
AND ntwk_offering_service_map.provider IN ('VirtualRouter', 'VpcVirtualRouter', 'Netscaler')
|
||||||
|
AND network_offerings.removed IS NULL
|
||||||
|
AND (SELECT COUNT(id) AS count FROM `network_offering_view` WHERE supports_vm_autoscaling = 1) = 0;
|
||||||
|
|
||||||
-- UserData as first class resource (PR #6202)
|
-- UserData as first class resource (PR #6202)
|
||||||
CREATE TABLE `cloud`.`user_data` (
|
CREATE TABLE `cloud`.`user_data` (
|
||||||
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
|
||||||
|
|
|
||||||
|
|
@ -144,8 +144,8 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
cls.apiclient,
|
cls.apiclient,
|
||||||
cls.services["isolated_network_offering"]
|
cls.services["isolated_network_offering"]
|
||||||
)
|
)
|
||||||
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')
|
|
||||||
cls._cleanup.append(cls.network_offering_isolated)
|
cls._cleanup.append(cls.network_offering_isolated)
|
||||||
|
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')
|
||||||
|
|
||||||
# 4. Create sub-domain
|
# 4. Create sub-domain
|
||||||
cls.sub_domain = Domain.create(
|
cls.sub_domain = Domain.create(
|
||||||
|
|
@ -176,6 +176,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
networkofferingid=cls.network_offering_isolated.id,
|
networkofferingid=cls.network_offering_isolated.id,
|
||||||
zoneid=cls.zone.id
|
zoneid=cls.zone.id
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.user_network_1)
|
||||||
|
|
||||||
cls.services["network"]["name"] = "Test Network Isolated - Regular user - 2"
|
cls.services["network"]["name"] = "Test Network Isolated - Regular user - 2"
|
||||||
cls.user_network_2 = Network.create(
|
cls.user_network_2 = Network.create(
|
||||||
|
|
@ -184,12 +185,14 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
networkofferingid=cls.network_offering_isolated.id,
|
networkofferingid=cls.network_offering_isolated.id,
|
||||||
zoneid=cls.zone.id
|
zoneid=cls.zone.id
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.user_network_2)
|
||||||
|
|
||||||
# 8. Create SSH Keypairs
|
# 8. Create SSH Keypairs
|
||||||
cls.keypair_1 = SSHKeyPair.create(
|
cls.keypair_1 = SSHKeyPair.create(
|
||||||
cls.regular_user_apiclient,
|
cls.regular_user_apiclient,
|
||||||
name="keypair1"
|
name="keypair1"
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.keypair_2 = SSHKeyPair.create(
|
cls.keypair_2 = SSHKeyPair.create(
|
||||||
cls.regular_user_apiclient,
|
cls.regular_user_apiclient,
|
||||||
name="keypair2"
|
name="keypair2"
|
||||||
|
|
@ -224,6 +227,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "GE",
|
relationaloperator = "GE",
|
||||||
threshold = 1
|
threshold = 1
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.scale_up_condition)
|
||||||
|
|
||||||
cls.scale_down_condition = AutoScaleCondition.create(
|
cls.scale_down_condition = AutoScaleCondition.create(
|
||||||
cls.regular_user_apiclient,
|
cls.regular_user_apiclient,
|
||||||
|
|
@ -231,10 +235,33 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "LE",
|
relationaloperator = "LE",
|
||||||
threshold = 100
|
threshold = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
cls._cleanup.append(cls.scale_up_condition)
|
|
||||||
cls._cleanup.append(cls.scale_down_condition)
|
cls._cleanup.append(cls.scale_down_condition)
|
||||||
|
|
||||||
|
# 10.2 Create new AS conditions for VM group update
|
||||||
|
cls.new_condition_1 = AutoScaleCondition.create(
|
||||||
|
cls.regular_user_apiclient,
|
||||||
|
counterid=cls.counter_network_received_id,
|
||||||
|
relationaloperator="GE",
|
||||||
|
threshold=0
|
||||||
|
)
|
||||||
|
cls._cleanup.append(cls.new_condition_1)
|
||||||
|
|
||||||
|
cls.new_condition_2 = AutoScaleCondition.create(
|
||||||
|
cls.regular_user_apiclient,
|
||||||
|
counterid=cls.counter_network_transmit_id,
|
||||||
|
relationaloperator="GE",
|
||||||
|
threshold=0
|
||||||
|
)
|
||||||
|
cls._cleanup.append(cls.new_condition_2)
|
||||||
|
|
||||||
|
cls.new_condition_3 = AutoScaleCondition.create(
|
||||||
|
cls.regular_user_apiclient,
|
||||||
|
counterid=cls.counter_lb_connection_id,
|
||||||
|
relationaloperator="GE",
|
||||||
|
threshold=0
|
||||||
|
)
|
||||||
|
cls._cleanup.append(cls.new_condition_3)
|
||||||
|
|
||||||
# 11. Create AS policies
|
# 11. Create AS policies
|
||||||
cls.scale_up_policy = AutoScalePolicy.create(
|
cls.scale_up_policy = AutoScalePolicy.create(
|
||||||
cls.regular_user_apiclient,
|
cls.regular_user_apiclient,
|
||||||
|
|
@ -243,6 +270,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.scale_up_policy)
|
||||||
|
|
||||||
cls.scale_down_policy = AutoScalePolicy.create(
|
cls.scale_down_policy = AutoScalePolicy.create(
|
||||||
cls.regular_user_apiclient,
|
cls.regular_user_apiclient,
|
||||||
|
|
@ -251,8 +279,6 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
|
||||||
cls._cleanup.append(cls.scale_up_policy)
|
|
||||||
cls._cleanup.append(cls.scale_down_policy)
|
cls._cleanup.append(cls.scale_down_policy)
|
||||||
|
|
||||||
# 12. Create AS VM Profile
|
# 12. Create AS VM Profile
|
||||||
|
|
@ -288,6 +314,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
ipaddressid=cls.public_ip_address.ipaddress.id,
|
ipaddressid=cls.public_ip_address.ipaddress.id,
|
||||||
networkid=cls.user_network_1.id
|
networkid=cls.user_network_1.id
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.load_balancer_rule)
|
||||||
|
|
||||||
# 14. Create AS VM Group
|
# 14. Create AS VM Group
|
||||||
cls.autoscaling_vmgroup = AutoScaleVmGroup.create(
|
cls.autoscaling_vmgroup = AutoScaleVmGroup.create(
|
||||||
|
|
@ -663,28 +690,10 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
)
|
)
|
||||||
scale_down_policy = policies[0]
|
scale_down_policy = policies[0]
|
||||||
|
|
||||||
new_condition_1 = AutoScaleCondition.create(
|
|
||||||
self.regular_user_apiclient,
|
|
||||||
counterid=self.counter_network_received_id,
|
|
||||||
relationaloperator="GE",
|
|
||||||
threshold=0
|
|
||||||
)
|
|
||||||
new_condition_2 = AutoScaleCondition.create(
|
|
||||||
self.regular_user_apiclient,
|
|
||||||
counterid=self.counter_network_transmit_id,
|
|
||||||
relationaloperator="GE",
|
|
||||||
threshold=0
|
|
||||||
)
|
|
||||||
new_condition_3 = AutoScaleCondition.create(
|
|
||||||
self.regular_user_apiclient,
|
|
||||||
counterid=self.counter_lb_connection_id,
|
|
||||||
relationaloperator="GE",
|
|
||||||
threshold=0
|
|
||||||
)
|
|
||||||
Autoscale.updateAutoscalePolicy(
|
Autoscale.updateAutoscalePolicy(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
id=scale_down_policy.id,
|
id=scale_down_policy.id,
|
||||||
conditionids=','.join([new_condition_1.id, new_condition_2.id, new_condition_3.id])
|
conditionids=','.join([self.new_condition_1.id, self.new_condition_2.id, self.new_condition_3.id])
|
||||||
)
|
)
|
||||||
|
|
||||||
self.autoscaling_vmgroup.enable(self.regular_user_apiclient)
|
self.autoscaling_vmgroup.enable(self.regular_user_apiclient)
|
||||||
|
|
@ -807,6 +816,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "GE",
|
relationaloperator = "GE",
|
||||||
threshold = 1
|
threshold = 1
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(scale_up_condition_project)
|
||||||
|
|
||||||
scale_down_condition_project = AutoScaleCondition.create(
|
scale_down_condition_project = AutoScaleCondition.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
|
|
@ -815,8 +825,6 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "LE",
|
relationaloperator = "LE",
|
||||||
threshold = 100
|
threshold = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cleanup.append(scale_up_condition_project)
|
|
||||||
self.cleanup.append(scale_down_condition_project)
|
self.cleanup.append(scale_down_condition_project)
|
||||||
|
|
||||||
# Create AS policies for project
|
# Create AS policies for project
|
||||||
|
|
@ -827,6 +835,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(scale_up_policy_project)
|
||||||
|
|
||||||
scale_down_policy_project = AutoScalePolicy.create(
|
scale_down_policy_project = AutoScalePolicy.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
|
|
@ -835,8 +844,6 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cleanup.append(scale_up_policy_project)
|
|
||||||
self.cleanup.append(scale_down_policy_project)
|
self.cleanup.append(scale_down_policy_project)
|
||||||
|
|
||||||
# Create AS VM Profile for project
|
# Create AS VM Profile for project
|
||||||
|
|
@ -848,6 +855,7 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD,
|
expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD,
|
||||||
projectid = project.id
|
projectid = project.id
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(autoscaling_vmprofile_project)
|
||||||
|
|
||||||
# Create AS VM Group for project
|
# Create AS VM Group for project
|
||||||
autoscaling_vmgroup_project = AutoScaleVmGroup.create(
|
autoscaling_vmgroup_project = AutoScaleVmGroup.create(
|
||||||
|
|
@ -989,24 +997,31 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "GE",
|
relationaloperator = "GE",
|
||||||
threshold = 1
|
threshold = 1
|
||||||
)
|
)
|
||||||
scale_up_condition_3 = AutoScaleCondition.create(
|
self.cleanup.append(scale_up_condition_1)
|
||||||
|
|
||||||
|
scale_up_condition_2 = AutoScaleCondition.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
counterid=self.counter_network_received_id,
|
counterid=self.counter_network_received_id,
|
||||||
relationaloperator="GE",
|
relationaloperator="GE",
|
||||||
threshold=0
|
threshold=0
|
||||||
)
|
)
|
||||||
scale_up_condition_4 = AutoScaleCondition.create(
|
self.cleanup.append(scale_up_condition_2)
|
||||||
|
|
||||||
|
scale_up_condition_3 = AutoScaleCondition.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
counterid=self.counter_network_transmit_id,
|
counterid=self.counter_network_transmit_id,
|
||||||
relationaloperator="GE",
|
relationaloperator="GE",
|
||||||
threshold=0
|
threshold=0
|
||||||
)
|
)
|
||||||
scale_up_condition_5 = AutoScaleCondition.create(
|
self.cleanup.append(scale_up_condition_3)
|
||||||
|
|
||||||
|
scale_up_condition_4 = AutoScaleCondition.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
counterid=self.counter_lb_connection_id,
|
counterid=self.counter_lb_connection_id,
|
||||||
relationaloperator="GE",
|
relationaloperator="GE",
|
||||||
threshold=0
|
threshold=0
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(scale_up_condition_4)
|
||||||
|
|
||||||
scale_down_condition_vpc = AutoScaleCondition.create(
|
scale_down_condition_vpc = AutoScaleCondition.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
|
|
@ -1014,22 +1029,18 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
relationaloperator = "LE",
|
relationaloperator = "LE",
|
||||||
threshold = 100
|
threshold = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cleanup.append(scale_up_condition_1)
|
|
||||||
self.cleanup.append(scale_up_condition_3)
|
|
||||||
self.cleanup.append(scale_up_condition_4)
|
|
||||||
self.cleanup.append(scale_up_condition_5)
|
|
||||||
self.cleanup.append(scale_down_condition_vpc)
|
self.cleanup.append(scale_down_condition_vpc)
|
||||||
|
|
||||||
# Create AS policies for vpc
|
# Create AS policies for vpc
|
||||||
scale_up_policy_vpc = AutoScalePolicy.create(
|
scale_up_policy_vpc = AutoScalePolicy.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
action='ScaleUp',
|
action='ScaleUp',
|
||||||
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_3.id,
|
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_2.id,
|
||||||
scale_up_condition_4.id, scale_up_condition_5.id]),
|
scale_up_condition_3.id, scale_up_condition_4.id]),
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
self.cleanup.append(scale_up_policy_vpc)
|
||||||
|
|
||||||
scale_down_policy_vpc = AutoScalePolicy.create(
|
scale_down_policy_vpc = AutoScalePolicy.create(
|
||||||
self.regular_user_apiclient,
|
self.regular_user_apiclient,
|
||||||
|
|
@ -1038,8 +1049,6 @@ class TestVmAutoScaling(cloudstackTestCase):
|
||||||
quiettime=DEFAULT_QUIETTIME,
|
quiettime=DEFAULT_QUIETTIME,
|
||||||
duration=DEFAULT_DURATION
|
duration=DEFAULT_DURATION
|
||||||
)
|
)
|
||||||
|
|
||||||
self.cleanup.append(scale_up_policy_vpc)
|
|
||||||
self.cleanup.append(scale_down_policy_vpc)
|
self.cleanup.append(scale_down_policy_vpc)
|
||||||
|
|
||||||
# Create AS VM Profile for vpc
|
# Create AS VM Profile for vpc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue