upgrade script 04_01_0010_add_mac_pool_id_to_vds_group.sql assumed, that there cannot exist clusters without relation to some data center. Such clusters won't be able to run any VM and would have other serious problems, therefore it was assumed, that no one has this setup. This assumption was wrong and because of that db script failed on creation not null db constraint. After this fix upgrade works also for environments containing such clusters.
Descriptionsefi litmanovich
2017-01-04 17:27:01 UTC
Description of problem:
Having a cluster not attached to any data center is not common, or recommended or helpful in any way, but it's possible and I saw it happen in one env here in QE.
If that happens that in the cluster column in DB storage_pool_id will be None for this cluster and that will cause this upgrade db_script to fail the engine upgrade - 04_01_0010_add_mac_pool_id_to_vds_group.sql:
SELECT fn_db_add_column('cluster',
'mac_pool_id',
'UUID REFERENCES mac_pools (id)');
UPDATE
cluster AS c
SET
mac_pool_id = (
SELECT
sp.mac_pool_id
FROM
storage_pool sp
WHERE
sp.id = c.storage_pool_id
);
ALTER TABLE cluster ALTER COLUMN mac_pool_id SET NOT NULL;
solution is easy, just remove cluster and run engine-setup again.
Version-Release number of selected component (if applicable):
This was found when running engine-setup with one of the 4.1 upstream versions (not sure which, but master branch still has this same file so nothing changed), setup was done with db restored from a 4.0 env and that's why this was possible.
How reproducible:
always
Steps to Reproduce:
1. Create a data center in rhevm 4.0
2. Create a cluster in that data center.
3. Remove the data center leaving only the cluster.
4. Backup engine with engine-backup tool.
5. Install 4.1 rpms and all needed to install rhevm 4.1.
6. Restore engine database using engine-backup tool.
7. Run engine-setup.
Actual results:
Setup fails with the reason being '04_01_0010_add_mac_pool_id_to_vds_group.sql' got Null for storage_pool_id (I did not keep the log from that run, no need to re produce it's quite obvious).
Expected results:
engine-setup is successful.
Additional info:
Verified on - rhevm-4.1.0.2-0.1.el7.noarch
Upgraded from 4.0.6.3-0.1.el7ev >> rhevm-4.1.0.2-0.1.el7.noarch with few clusters without DCs in the setup. Upgrade is passed with success.
Each cluster without a DC got it's default MAC pool range.
Description of problem: Having a cluster not attached to any data center is not common, or recommended or helpful in any way, but it's possible and I saw it happen in one env here in QE. If that happens that in the cluster column in DB storage_pool_id will be None for this cluster and that will cause this upgrade db_script to fail the engine upgrade - 04_01_0010_add_mac_pool_id_to_vds_group.sql: SELECT fn_db_add_column('cluster', 'mac_pool_id', 'UUID REFERENCES mac_pools (id)'); UPDATE cluster AS c SET mac_pool_id = ( SELECT sp.mac_pool_id FROM storage_pool sp WHERE sp.id = c.storage_pool_id ); ALTER TABLE cluster ALTER COLUMN mac_pool_id SET NOT NULL; solution is easy, just remove cluster and run engine-setup again. Version-Release number of selected component (if applicable): This was found when running engine-setup with one of the 4.1 upstream versions (not sure which, but master branch still has this same file so nothing changed), setup was done with db restored from a 4.0 env and that's why this was possible. How reproducible: always Steps to Reproduce: 1. Create a data center in rhevm 4.0 2. Create a cluster in that data center. 3. Remove the data center leaving only the cluster. 4. Backup engine with engine-backup tool. 5. Install 4.1 rpms and all needed to install rhevm 4.1. 6. Restore engine database using engine-backup tool. 7. Run engine-setup. Actual results: Setup fails with the reason being '04_01_0010_add_mac_pool_id_to_vds_group.sql' got Null for storage_pool_id (I did not keep the log from that run, no need to re produce it's quite obvious). Expected results: engine-setup is successful. Additional info: