-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix duplicate dummy templates, and update guest os for dummy template #12780
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
base: 4.22
Are you sure you want to change the base?
Changes from all commits
cb9cc53
08cf2be
5d88f30
a02e455
026bd09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,3 +33,5 @@ UPDATE `cloud`.`alert` SET type = 34 WHERE name = 'ALERT.VR.PRIVATE.IFACE.MTU'; | |||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| -- Update configuration 'kvm.ssh.to.agent' description and is_dynamic fields | ||||||||||||||||||||||||||||||||||||||||||||||
| UPDATE `cloud`.`configuration` SET description = 'True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations', is_dynamic = 1 WHERE name = 'kvm.ssh.to.agent'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| UPDATE `cloud`.`vm_template` SET guest_os_id = 99 WHERE name = 'kvm-default-vm-import-dummy-template'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| UPDATE `cloud`.`vm_template` SET guest_os_id = 99 WHERE name = 'kvm-default-vm-import-dummy-template'; | |
| -- De-duplicate 'kvm-default-vm-import-dummy-template' entries and update guest_os_id | |
| -- Keep the template with the smallest id as the canonical one and mark others as removed | |
| UPDATE `cloud`.`vm_template` t | |
| JOIN ( | |
| SELECT MIN(id) AS keep_id | |
| FROM `cloud`.`vm_template` | |
| WHERE name = 'kvm-default-vm-import-dummy-template' | |
| ) k ON t.id != k.keep_id | |
| SET t.removed = NOW() | |
| WHERE t.name = 'kvm-default-vm-import-dummy-template' | |
| AND t.removed IS NULL; | |
| -- Update guest_os_id only for the canonical template | |
| UPDATE `cloud`.`vm_template` t | |
| JOIN ( | |
| SELECT MIN(id) AS keep_id | |
| FROM `cloud`.`vm_template` | |
| WHERE name = 'kvm-default-vm-import-dummy-template' | |
| AND removed IS NULL | |
| ) k ON t.id = k.keep_id | |
| SET t.guest_os_id = 99; |
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.
not needed
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.
This UPDATE targets rows by
nameonly. To reduce the risk of unintentionally modifying non-system templates (or future templates) that happen to share the same name, consider narrowing the predicate (e.g., also filter ontype = 'SYSTEM'andformat = 'ISO'if that matches the intended rows).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.
fine with name