Skip to content

Commit 8c5bad1

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
feature/CSTACKEX-314: updated code
1 parent 3cf6c86 commit 8c5bad1

1 file changed

Lines changed: 2 additions & 36 deletions

File tree

‎engine/schema/src/main/resources/META-INF/db/schema-42300to2400.sql‎

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -227,55 +227,21 @@ CREATE TABLE IF NOT EXISTS `cloud`.`instance_boot_group_details` (
227227
CONSTRAINT `fk_instance_boot_group_details__group_id` FOREIGN KEY (`boot_group_id`) REFERENCES `instance_boot_group` (`id`) ON DELETE CASCADE
228228
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
229229

230-
--
231230
-- Re-tag NetApp ONTAP iSCSI storage pools to the dedicated 'OntapiSCSI' pool type.
232-
--
233-
-- Up to and including 4.23.0.0 the NetApp ONTAP primary store driver registered its iSCSI
234-
-- pools under the generic 'Iscsi' StoragePoolType (originally meant for ZFS Comstar), because
235-
-- no NetApp-specific enum existed yet. 24.0.0.0 introduces 'OntapiSCSI' as a first-class pool
236-
-- type (see api/.../Storage.java::StoragePoolType) so that KVM path construction, the iSCSI
237-
-- cleanup monitor, the data-motion strategy and the UI can key off the pool type rather than
238-
-- having to probe storage_pool_details or storage_provider_name on every call.
239-
--
240-
-- These three UPDATE statements re-tag the existing rows for a NetApp ONTAP provider only
241-
-- (storage_provider_name = 'NetApp ONTAP', the string exposed as
242-
-- DataStoreProvider.ONTAP_PLUGIN_NAME). All three are naturally idempotent on re-run because
243-
-- they filter on the pre-migration value - a second attempt matches zero rows. Rows soft-
244-
-- deleted via `removed` are intentionally included so historical / un-deleted pools report
245-
-- the correct type.
246-
--
247-
248-
-- 1. The pool itself.
249231
UPDATE `cloud`.`storage_pool`
250232
SET `pool_type` = 'OntapiSCSI'
251233
WHERE `storage_provider_name` = 'NetApp ONTAP'
252234
AND `pool_type` = 'Iscsi';
253235

254-
-- 2. The denormalized copy on every volume that lives on such a pool.
255-
--
256-
-- The sp.pool_type IN ('Iscsi', 'OntapiSCSI') guard here is defense-in-depth, not a
257-
-- correctness requirement: it excludes volumes whose underlying storage_pool is NFS-backed
258-
-- NetApp ('NetworkFilesystem') even if, by some historical anomaly, their v.pool_type still
259-
-- reads 'Iscsi'. Flipping those to 'OntapiSCSI' would be wrong, so we gate on the pool's
260-
-- current type. The IN (...) form keeps the statement order-independent with statement 1.
236+
-- The denormalized copy on every volume that lives on such a pool.
261237
UPDATE `cloud`.`volumes` v
262238
JOIN `cloud`.`storage_pool` sp ON sp.`id` = v.`pool_id`
263239
SET v.`pool_type` = 'OntapiSCSI'
264240
WHERE sp.`storage_provider_name` = 'NetApp ONTAP'
265241
AND sp.`pool_type` IN ('Iscsi', 'OntapiSCSI')
266242
AND v.`pool_type` = 'Iscsi';
267243

268-
-- 3. Volume format realignment.
269-
--
270-
-- The ONTAP primary store driver on 24.0 returns ImageFormat.RAW for every iSCSI volume
271-
-- (OntapPrimaryDatastoreDriver::getFormat). On 4.23 volumes created against the generic
272-
-- 'Iscsi' pool type may have been persisted with the wrong format literal depending on which
273-
-- code path created them (template-backed, snapshot copies, migrated-from-NFS, etc). Force
274-
-- the full set to 'RAW' so that KVM / libvirt see the authoritative format on next grant.
275-
--
276-
-- sp.pool_type IN ('Iscsi', 'OntapiSCSI') makes this statement order-independent with
277-
-- statement 1: it works whether or not the pool has been rebranded yet. NFS-backed NetApp
278-
-- pools ('NetworkFilesystem') are deliberately excluded - they stay QCOW2.
244+
-- Volume format realignment.
279245
UPDATE `cloud`.`volumes` v
280246
JOIN `cloud`.`storage_pool` sp ON sp.`id` = v.`pool_id`
281247
SET v.`format` = 'RAW'

0 commit comments

Comments
 (0)