add creation date as a value for domains and accounts.#4649
add creation date as a value for domains and accounts.#4649DaanHoogland merged 1 commit intoapache:masterfrom
Conversation
|
looks usefull for auditing but travis shows some sql syntax error. can you have a look @soreana ? |
|
@DaanHoogland Yes, sure! I'm going to do that. |
|
@DaanHoogland I think it was fixed. I will check the Travis later. |
DaanHoogland
left a comment
There was a problem hiding this comment.
lgtm, this is an upgrade from a not yet released version to another not yet released version, well need to keep an eye out.
|
@blueorangutan package |
|
@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✔centos8 ✔debian. JID-2689 |
GabrielBrascher
left a comment
There was a problem hiding this comment.
Code LGTM. I did not test it, though.
shwstppr
left a comment
There was a problem hiding this comment.
LGTM. Tested with simulator,
(local) 🐱 > list accounts id=0410fe6f-04c7-4bbe-98c2-a573cb9b7cf6
{
"account": [
{
"accounttype": 0,
"cpuavailable": "40",
"cpulimit": "40",
"cputotal": 0,
"created": "2021-02-12T18:32:47+0530",
...
}
],
"count": 1
}
(local) 🐱 > list domains id=d22275de-29db-4684-8aea-ee08f1c0e18b
{
"count": 1,
"domain": [
{
"cpuavailable": "Unlimited",
"cpulimit": "Unlimited",
"cputotal": 0,
**"created": "2021-02-12T18:33:02+0530",**
...
}
]
}
|
travis and manual tests, this is only API and DB so it should do |
|
@DaanHoogland this has caused a regression on master, no trillian tests seen. Can you check and revert or address the issue? |
|
the issue is with upgrade @rhtyd trillian wouldn't show it, would it? |
|
I think fresh install would fail with Trillian if something's wrong in the db schema @DaanHoogland nevertheless for PRs that bring in too many DB changes - it's important that we kick and validate them with Trillian tests, since Travis based tests uses mvn and not the actual cloudstack-setup-databases scripts. |
|
@rhtyd Could you please let me know what is the issue and how I can reproduce it? |
|
@soreana can you build pkgs and deploy database (using cloudstack-setup-databases) in a test env and then start mgmt server - the mgmt server fails while running the sql file (the specific one changed in this PR). |
|
Sure, I will do that! Thanks :) |
|
@soreana , can you also try running your upgrade code in isolation? |
|
@DaanHoogland You mean advanced zone (isolated networks)? |
|
no, i mean run the upgrade script, to see if it is really idem potent. on a 4.16 env that is stopped. |
|
I've kicked smoketests on master/4.16 via #4577 let's wait and see |
| --; | ||
| DROP PROCEDURE IF EXISTS `cloud`.`IDEMPOTENT_ADD_COLUMN`; | ||
|
|
||
| CREATE PROCEDURE `cloud`.`IDEMPOTENT_ADD_COLUMN` ( |
There was a problem hiding this comment.
@soreana FYI see 543f982#r47173483
@sureshanaparti has concocted a solution:
DELIMITER $$
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 $$
DELIMITER ;
but more important, this code already exists in the system at https://github.com/apache/cloudstack/blob/master/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql#L27
why did you add it again?
|
@DaanHoogland @rhtyd |
|
@weizhouapache this is a "intermediate" upgrade problem. No issue woth the PR. The aledged/suspect code turned out to also exist in schema-41000to41100.sql which was a side catch and a very minor issue. |
Description
This PR enables the cloudstack to store the creation time of accounts and domains. We already implemented and used this feature in our platforms. We thought it might be useful for the community too.
The changes in this PR are as small as adding some fields and the setter/getter method. Although the database changes might seem scary, they are minor changes. Except defining the
add_created_column_in_domain_and_accountprocedure, I only added the following lines inaccount_viewanddomain_view. Generally speaking, in the mentioned procedure, I added thecreatedcolumn to theaccountanddomaintables, and I ignore its creation if they have already existed.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
Yes, I have test it in my test environment.