Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,6 @@ BEGIN
-- Add column 'supports_vm_autoscaling' to 'network_offerings' table
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
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;
Expand Down Expand Up @@ -446,6 +437,16 @@ CREATE VIEW `cloud`.`network_offering_view` AS
GROUP BY
`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)
CREATE TABLE `cloud`.`user_data` (
`id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
Expand Down
89 changes: 49 additions & 40 deletions test/integration/smoke/test_vm_autoscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def setUpClass(cls):
cls.apiclient,
cls.services["isolated_network_offering"]
)
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')
cls._cleanup.append(cls.network_offering_isolated)
cls.network_offering_isolated.update(cls.apiclient, state='Enabled')

# 4. Create sub-domain
cls.sub_domain = Domain.create(
Expand Down Expand Up @@ -176,6 +176,7 @@ def setUpClass(cls):
networkofferingid=cls.network_offering_isolated.id,
zoneid=cls.zone.id
)
cls._cleanup.append(cls.user_network_1)

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

# 8. Create SSH Keypairs
cls.keypair_1 = SSHKeyPair.create(
cls.regular_user_apiclient,
name="keypair1"
)

cls.keypair_2 = SSHKeyPair.create(
cls.regular_user_apiclient,
name="keypair2"
Expand Down Expand Up @@ -224,17 +227,41 @@ def setUpClass(cls):
relationaloperator = "GE",
threshold = 1
)
cls._cleanup.append(cls.scale_up_condition)

cls.scale_down_condition = AutoScaleCondition.create(
cls.regular_user_apiclient,
counterid = cls.counter_cpu_or_memory_id,
relationaloperator = "LE",
threshold = 100
)

cls._cleanup.append(cls.scale_up_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
cls.scale_up_policy = AutoScalePolicy.create(
cls.regular_user_apiclient,
Expand All @@ -243,6 +270,7 @@ def setUpClass(cls):
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)
cls._cleanup.append(cls.scale_up_policy)

cls.scale_down_policy = AutoScalePolicy.create(
cls.regular_user_apiclient,
Expand All @@ -251,8 +279,6 @@ def setUpClass(cls):
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)

cls._cleanup.append(cls.scale_up_policy)
cls._cleanup.append(cls.scale_down_policy)

# 12. Create AS VM Profile
Expand Down Expand Up @@ -288,6 +314,7 @@ def setUpClass(cls):
ipaddressid=cls.public_ip_address.ipaddress.id,
networkid=cls.user_network_1.id
)
cls._cleanup.append(cls.load_balancer_rule)

# 14. Create AS VM Group
cls.autoscaling_vmgroup = AutoScaleVmGroup.create(
Expand Down Expand Up @@ -663,28 +690,10 @@ def test_03_scale_down_verify(self):
)
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(
self.regular_user_apiclient,
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)
Expand Down Expand Up @@ -807,6 +816,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
relationaloperator = "GE",
threshold = 1
)
self.cleanup.append(scale_up_condition_project)

scale_down_condition_project = AutoScaleCondition.create(
self.regular_user_apiclient,
Expand All @@ -815,8 +825,6 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
relationaloperator = "LE",
threshold = 100
)

self.cleanup.append(scale_up_condition_project)
self.cleanup.append(scale_down_condition_project)

# Create AS policies for project
Expand All @@ -827,6 +835,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)
self.cleanup.append(scale_up_policy_project)

scale_down_policy_project = AutoScalePolicy.create(
self.regular_user_apiclient,
Expand All @@ -835,8 +844,6 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)

self.cleanup.append(scale_up_policy_project)
self.cleanup.append(scale_down_policy_project)

# Create AS VM Profile for project
Expand All @@ -848,6 +855,7 @@ def test_06_autoscaling_vmgroup_on_project_network(self):
expungevmgraceperiod=DEFAULT_EXPUNGE_VM_GRACE_PERIOD,
projectid = project.id
)
self.cleanup.append(autoscaling_vmprofile_project)

# Create AS VM Group for project
autoscaling_vmgroup_project = AutoScaleVmGroup.create(
Expand Down Expand Up @@ -989,47 +997,50 @@ def test_07_autoscaling_vmgroup_on_vpc_network(self):
relationaloperator = "GE",
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,
counterid=self.counter_network_received_id,
relationaloperator="GE",
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,
counterid=self.counter_network_transmit_id,
relationaloperator="GE",
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,
counterid=self.counter_lb_connection_id,
relationaloperator="GE",
threshold=0
)
self.cleanup.append(scale_up_condition_4)

scale_down_condition_vpc = AutoScaleCondition.create(
self.regular_user_apiclient,
counterid = self.counter_cpu_or_memory_id,
relationaloperator = "LE",
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)

# Create AS policies for vpc
scale_up_policy_vpc = AutoScalePolicy.create(
self.regular_user_apiclient,
action='ScaleUp',
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_3.id,
scale_up_condition_4.id, scale_up_condition_5.id]),
conditionids=','.join([scale_up_condition_1.id, scale_up_condition_2.id,
scale_up_condition_3.id, scale_up_condition_4.id]),
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)
self.cleanup.append(scale_up_policy_vpc)

scale_down_policy_vpc = AutoScalePolicy.create(
self.regular_user_apiclient,
Expand All @@ -1038,8 +1049,6 @@ def test_07_autoscaling_vmgroup_on_vpc_network(self):
quiettime=DEFAULT_QUIETTIME,
duration=DEFAULT_DURATION
)

self.cleanup.append(scale_up_policy_vpc)
self.cleanup.append(scale_down_policy_vpc)

# Create AS VM Profile for vpc
Expand Down