Skip to content

Conversation

rohityadavcloud
Copy link
Member

Problem: Not able to configure a sort order for the zone that are listed in various views in the UI.
Root Cause: There was no mechanism to accept sort key for existing zones or UI widget to drag them in a certain order.
Solution: The order can now be configured through the editZone API by providing sort_key parameter for zones, or by reordering the zones in the Zones list in the UI. Database changes include updating table “data_center” which contains the “sort_key” column containing integer values and defaults to zero.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

51236319-da9d2a80-1997-11e9-9c23-b8a4e5e27ccd

This adds support to allow admins to sort zones, and based on the sorted
order the zones will be listed in UI and API.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@rohityadavcloud
Copy link
Member Author

@borisstoyanov @PaulAngus hold testing until master is available again. This introduces an upgrade path that is missing between 4.12 and 4.13. The sql changes are:

DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`;

CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` (
		IN in_table_name VARCHAR(200)
    , IN in_column_name VARCHAR(200)
    , IN in_column_definition VARCHAR(1000)
)
BEGIN

    DECLARE CONTINUE HANDLER FOR 1060 BEGIN END; SET @ddl = CONCAT('ALTER TABLE ', in_table_name); SET @ddl = CONCAT(@ddl, ' ', 'ADD COLUMN') ; SET @ddl = CONCAT(@ddl, ' ', in_column_name); SET @ddl = CONCAT(@ddl, ' ', in_column_definition); PREPARE stmt FROM @ddl; EXECUTE stmt; DEALLOCATE PREPARE stmt; END;

-- Add sort_key to data_center
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'sort_key', 'INT(32) NOT NULL DEFAULT 0');
DROP VIEW IF EXISTS `cloud`.`data_center_view`;
CREATE VIEW `cloud`.`data_center_view` AS
    select
        data_center.id,
        data_center.uuid,
        data_center.name,
        data_center.is_security_group_enabled,
        data_center.is_local_storage_enabled,
        data_center.description,
        data_center.dns1,
        data_center.dns2,
        data_center.ip6_dns1,
        data_center.ip6_dns2,
        data_center.internal_dns1,
        data_center.internal_dns2,
        data_center.guest_network_cidr,
        data_center.domain,
        data_center.networktype,
        data_center.allocation_state,
        data_center.zone_token,
        data_center.dhcp_provider,
        data_center.removed,
        data_center.sort_key,
        domain.id domain_id,
        domain.uuid domain_uuid,
        domain.name domain_name,
        domain.path domain_path,
        dedicated_resources.affinity_group_id,
        dedicated_resources.account_id,
        affinity_group.uuid affinity_group_uuid
    from
        `cloud`.`data_center`
            left join
        `cloud`.`domain` ON data_center.domain_id = domain.id
            left join
        `cloud`.`dedicated_resources` ON data_center.id = dedicated_resources.data_center_id
            left join
        `cloud`.`affinity_group` ON dedicated_resources.affinity_group_id = affinity_group.id; 

Copy link
Member

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, except for this design question

@Column(name = "is_local_storage_enabled")
boolean localStorageEnabled;

@Column(name = "sort_key")
Copy link
Member

@DaanHoogland DaanHoogland Mar 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhtyd should we store such a end-user specific configuration in the business object for data-centre? It seems out of place here. What's your consideration?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree they can be details, however, this replicates the design/implementation for the template sorting feature; the sort_key is also used in template tables.

@rohityadavcloud
Copy link
Member Author

Db upgrade path in progress: #34

@rohityadavcloud
Copy link
Member Author

Moved: apache#3242

rohityadavcloud pushed a commit that referenced this pull request Jan 20, 2021
Async job poller tech capability implementation, show notifications on success/fail.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
shwstppr pushed a commit that referenced this pull request Jul 27, 2021
Allows admins to provide VR IP (v4 & v6) when creating shared networks, provided the Network offering provides at least one service that requires a virtual router

Upstream PR apache#4503

Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
vishesh92 pushed a commit that referenced this pull request Sep 9, 2024
* Prevent addition of duplicate PF rules on scale up and no rules left behind on scale down (#32)

* fix missing dependency injection

* NSX: Fix concurrency issues on port forwarding rules deletion (#37)

* Fix concurrency issues on port forwarding rules deletion

* Refactor objectExists

* Fix unit test

* Fix test

* Small fixes

* CKS: Externalize control and worker node setup wait time and installation attempts (#38)

* NSX: Add shared network support (#41)

* NSX: Fix number of physical networks for Guest traffic checks and leftover rules on CKS cluster deletion (#45)

* Fix pf rules removal on CKS cluster deletion

* Fix check for number of physical networks for guest traffic

* Fix unit test

* fix logger

* NSX: Handle CheckHealthCommand to avoid host disconnection and errors on APIs

* NSX: Handle CheckHealthCommand to avoid host disconnection and errors on APIs

* Remove unused string

* fix logger

* Update UDP active monitor to ICMP

* Fix NPE on restarting VPC with additional public IPs

* NSX / VPC: Reuse Source NAT IP from systemVM range on restarts

* CKS: Public IP not found for VPC networks

* Externalize retries and inverval for NSX segment deletion (#67)

* remove unused import

* remove duplicate imports

* remove unused import

* revert externalizing cks settings

* fix test

* Refactor log messages

* Address comments

* Fix issue caused due to forward merge: 90fe1d

---------

Co-authored-by: Nicolas Vazquez <nicovazquez90@gmail.com>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants