-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix mismatching between db uuids and custom attributes uuids #5382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix mismatching between db uuids and custom attributes uuids #5382
Conversation
during the datastore cluster creation, cloudstack could not recognize the existing primary storage and create a new one because uuid format not equal
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought the code is not very bad, I don't think this is how the problem should be solved @DK101010 . Where the input does not adhere to the standard, it should be converted. not during the search. Don't you think?
For sure, but I'm not sure why are uuids in custom attributes without and in db with separators. Also for this way we must update custom attributes of all storages and for this I can not estimate the impact of already existing implementation. Therefore this solution. |
Ok, so how about removing the dashes unconditionally but just for the comparison and otherwise keep using the originals? |
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41600.java
Outdated
Show resolved
Hide resolved
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41600.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✖️ el8 ✔️ debian ✔️ suse15. SL-JID 1431 |
|
Packaging result: ✔️ el7 ✖️ el8 ✔️ debian ✔️ suse15. SL-JID 1432 |
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit, this is executed only during upgrade/install so not making a fuzz
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@blueorangutan package |
|
@rohityadavcloud a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2145 |
|
@blueorangutan test |
1 similar comment
|
@blueorangutan test |
|
@blueorangutan test matrix |
|
@nvazquez a Trillian-Jenkins matrix job (centos7 mgmt + xs71, centos7 mgmt + vmware65, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3626)
|
|
Trillian test result (tid-3625)
|
|
Trillian test result (tid-3627)
|
engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java
Show resolved
Hide resolved
| updateStmt.setString(1, poolUuid.toString()); | ||
| updateStmt.addBatch(); | ||
| } | ||
| updateStmt.executeBatch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if not correct, but in case the result set is empty wouldn't this fail since the parameters are not set? Or does this method check the parameters before executing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nvazquez, good point, no Idea how it works, I will check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked it, executeBatch have no problems if no values are added.
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2971 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3725)
|
|
PIng for review @weizhouapache @Pearl1594 @DaanHoogland |
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good
|
@blueorangutan package |
1 similar comment
|
@blueorangutan package |
|
@nvazquez a Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 3222 |
|
@blueorangutan test |
|
@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-3935)
|
nvazquez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - manually tested upgrade from 4.16.1 on Vmware env:
Before the upgrade:
MariaDB [cloud]> select id, uuid from storage_pool;
+----+--------------------------------------+
| id | uuid |
+----+--------------------------------------+
| 2 | 0c4d8fb8-72b4-3c92-b06f-48310371df62 |
| 1 | ccd02aec-5e0a-323f-a358-d739fd5dd50c |
+----+--------------------------------------+
2 rows in set (0.00 sec)
MariaDB [cloud]> select * from version order by id desc limit 1;
+----+----------+---------------------+----------+
| id | version | updated | step |
+----+----------+---------------------+----------+
| 37 | 4.16.1.0 | 2022-04-21 01:58:07 | Complete |
+----+----------+---------------------+----------+
1 row in set (0.00 sec)
Upgraded successfully:
...
2022-04-21 02:45:04,415 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- PR#5984 Create table to persist VM stats.
2022-04-21 02:45:04,415 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) DROP TABLE IF EXISTS `cloud`.`vm_stats`
2022-04-21 02:45:04,418 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) CREATE TABLE `cloud`.`vm_stats` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `vm_id` bigint unsigned NOT NULL, `mgmt_server_id` bigint unsigned NOT NULL, `timestamp` datetime NOT NULL, `vm_stats_data` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
2022-04-21 02:45:04,428 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- PR#5984 Update name for global configuration vm.stats.increment.metrics
2022-04-21 02:45:04,428 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) Update configuration set name='vm.stats.increment.metrics' where name='vm.stats.increment.metrics.in.memory'
2022-04-21 02:45:04,431 DEBUG [c.c.u.d.Upgrade41610to41700] (main:null) (logid:) Replacement of faulty pool uuids
2022-04-21 02:45:04,448 INFO [c.c.u.DatabaseUpgradeChecker] (main:null) (logid:) Cleanup upgrade Upgrade41610to41700 to upgrade from 4.16.1.0-4.17.0.0 to 4.17.0.0
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- Licensed to the Apache Software Foundation (ASF) under one
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- or more contributor license agreements. See the NOTICE file
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- distributed with this work for additional information
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- regarding copyright ownership. The ASF licenses this file
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- to you under the Apache License, Version 2.0 (the
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- "License"); you may not use this file except in compliance
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- with the License. You may obtain a copy of the License at
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- http://www.apache.org/licenses/LICENSE-2.0
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- Unless required by applicable law or agreed to in writing,
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- software distributed under the License is distributed on an
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- KIND, either express or implied. See the License for the
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- specific language governing permissions and limitations
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- under the License.
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- Schema upgrade cleanup from 4.16.1.0 to 4.17.0.0
2022-04-21 02:45:04,451 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2022-04-21 02:45:04,452 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) (logid:) Cleanup script Upgrade41610to41700 is executed successfully
2022-04-21 02:45:04,477 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) (logid:) Upgrade completed for version 4.17.0.0
....
MariaDB [cloud]> select id, uuid from storage_pool;
+----+--------------------------------------+
| id | uuid |
+----+--------------------------------------+
| 2 | 0c4d8fb8-72b4-3c92-b06f-48310371df62 |
| 1 | ccd02aec-5e0a-323f-a358-d739fd5dd50c |
+----+--------------------------------------+
2 rows in set (0.00 sec)
MariaDB [cloud]> select * from version order by id desc limit 1;
+----+----------+---------------------+----------+
| id | version | updated | step |
+----+----------+---------------------+----------+
| 38 | 4.17.0.0 | 2022-04-21 02:45:04 | Complete |
+----+----------+---------------------+----------+
1 row in set (0.00 sec)
Description
During the datastore cluster creation, cloudstack could not
recognize the existing primary storage and create a new one because
uuid format not equal.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Tested in my own Vmware env.