[3.3] Duplicate IPMI BMC IP + Username with unique passwords causes migration failure on upgrade to 3.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Won't Fix
|
Medium
|
Unassigned | ||
MAAS documentation |
Triaged
|
Medium
|
Bill Wear |
Bug Description
If you have an environment where multiple machines have an IPMI BMC with the same IP address & username, but a different password, this will work on 3.2 but cause a migration failure on upgrade to 3.3.
The cause is 0290_migrate_
While it is almost certainly "incorrect" to have multiple machines with the same BMC IP address and username but a different password
- It works without any warning on 3.2
- The database migration fails leaving you without access to the UI to fix the relevant machines, plus, it's not at all obvious why it's failing - since the duplicate key reported is an MD5 hash.
This was experienced during a production upgrade from 3.2.7 to 3.3.3 in a large environment where 5 sets of 2 machines had such an issue.
While it generally makes sense to avoid duplicate IPMI IP/Username/
Perhaps it would make sense to drop the unique constraint but enforce it at the API/UI level, to avoid this upgrade issue?
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Igor Brovtsin (igor-brovtsin) |
tags: | added: bug-council |
== Postgres Query ==
The following Postgres query will locate any such duplicate machines:
SELECT staticipaddress .ip, node.system_ id, node.hostname, node.created, bmc.power_ parameters ->> 'power_user' AS power_user, bmc.power_ parameters ->> 'power_pass' AS power_pass, bmc.power_ parameters ->> 'power_address' AS power_address, nodemetadata1. meta->> 'system_ vendor' , nodemetadata1. meta->> 'system_ product' , nodemetadata1. meta->> 'system_ serial' , bmc.power_ parameters, node.power_ state_queried, node.power_ state_updated, node.created, node.updated
maasserver_bmc.id,
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
maasserver_
FROM rows.aggregated _ids) staticipaddress ON (maasserver_ staticipaddress .id = maasserver_ bmc.ip_ address_ id) node.bmc_ id = maasserver_bmc.id) nodemetadata. node_id, jsonb_object_ agg(maasserver_ nodemetadata. key,maasserver_ nodemetadata. value) AS meta from maasserver_ nodemetadata GROUP BY maasserver_ nodemetadata. node_id) AS maasserver_ nodemetadata1 ON (maasserver_ nodemetadata1. node_id= maasserver_ node.id)
maasserver_bmc
JOIN
(SELECT ARRAY_AGG(id) AS aggregated_ids FROM maasserver_bmc WHERE power_type = 'ipmi' GROUP BY power_parameters - 'power_pass' HAVING COUNT(*) > 1) AS dup_rows
ON maasserver_bmc.id = ANY(dup_
JOIN maasserver_
JOIN maasserver_node ON (maasserver_
JOIN (SELECT maasserver_
ORDER BY
ip;
=== Upgrade error log ===
Setting up maas-region- controller (1:3.3. 3-13184- g.3e9972c19- 0ubuntu1~ 22.04.1) ... default_ auto_field. .. OK 0277_replace_ nullbooleanfiel d... OK 0278_generic_ jsonfield. .. OK 0279_store_ vpd_metadata_ for_nodedevice. .. OK 0280_set_ parent_ for_existing_ vms... OK 0281_secret_ model.. . OK 0282_rpc_ shared_ secret_ to_secret. .. OK 0283_migrate_ tls_secrets. .. OK 0284_migrate_ more_global_ secrets. .. OK 0285_migrate_ external_ auth_secrets. .. OK 0286_node_ deploy_ metadata. .. OK 0287_add_ controller_ info_vault_ flag... OK 0288_rootkey_ material_ secret. .. OK 0289_vault_ secret. .. OK 0290_migrate_ node_power_ parameters. ..Traceback (most recent call last): python3/ dist-packages/ django/ db/backends/ utils.py" , line 84, in _execute execute( sql, params) errors. UniqueViolation : duplicate key value violates unique constraint "maasserver_ bmc_power_ type_parameters _idx" parameters: :text)) =(ipmi, d8e8fca2dc0f896 fd7cb4cb0031ba2 49) already exists.
Operations to perform:
Apply all migrations: auth, contenttypes, maasserver, metadataserver, piston3, sessions, sites
Running migrations:
Applying auth.0006_
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
Applying maasserver.
File "/usr/lib/
return self.cursor.
psycopg2.
DETAIL: Key (power_type, md5(power_
The above exception was the direct cause of the following exception:
Traceback (most recent call last): maas-region" , line 33, in <module> load_entry_ point(' maas==3. 3.3', 'console_scripts', 'maas-region')()) python3/ dist-packages/ maasserver/ region_ script. py",...
File "/usr/sbin/
sys.exit(
File "/usr/lib/