Added configuration key powerflex.connect.on.demand to DB and resource_reservation DDL

This commit is contained in:
mprokopchuk 2024-08-15 17:57:07 -07:00
parent e0d6066935
commit 8136db637a
4 changed files with 141 additions and 0 deletions

View File

@ -81,6 +81,7 @@ import com.cloud.upgrade.dao.Upgrade41700to41710;
import com.cloud.upgrade.dao.Upgrade41710to41720;
import com.cloud.upgrade.dao.Upgrade41720to41800;
import com.cloud.upgrade.dao.Upgrade41800to41810;
import com.cloud.upgrade.dao.Upgrade41811to41812;
import com.cloud.upgrade.dao.Upgrade420to421;
import com.cloud.upgrade.dao.Upgrade421to430;
import com.cloud.upgrade.dao.Upgrade430to440;
@ -218,6 +219,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
.next("4.17.1.0", new Upgrade41710to41720())
.next("4.17.2.0", new Upgrade41720to41800())
.next("4.18.0.0", new Upgrade41800to41810())
.next("4.18.1.0", new Upgrade41811to41812())
.build();
}

View File

@ -0,0 +1,69 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.upgrade.dao;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.log4j.Logger;
import java.io.InputStream;
import java.sql.Connection;
public class Upgrade41811to41812 implements DbUpgrade {
final static Logger LOG = Logger.getLogger(Upgrade41811to41812.class);
@Override
public String[] getUpgradableVersionRange() {
return new String[]{"4.18.1.1", "4.18.1.2"};
}
@Override
public String getUpgradedVersion() {
return "4.18.1.2";
}
@Override
public boolean supportsRollingUpgrade() {
return true;
}
@Override
public InputStream[] getPrepareScripts() {
final String scriptFile = "META-INF/db/schema-41811to41812.sql";
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
if (script == null) {
throw new CloudRuntimeException("Unable to find " + scriptFile);
}
return new InputStream[]{script};
}
@Override
public void performDataMigration(Connection conn) {
}
@Override
public InputStream[] getCleanupScripts() {
final String scriptFile = "META-INF/db/schema-41811to41812-cleanup.sql";
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
if (script == null) {
throw new CloudRuntimeException("Unable to find " + scriptFile);
}
return new InputStream[]{script};
}
}

View File

@ -0,0 +1,20 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--;
-- Schema upgrade cleanup from to 4.18.1.2
--;

View File

@ -0,0 +1,50 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
--;
-- Schema upgrade from 4.18.1.2
--;
-- Add property to enable/disable on-demand connection Host to PowerFlex storage pool
INSERT IGNORE INTO `cloud`.`configuration` (
`category`,
`instance`,
`component`,
`scope`,
`name`,
`value`,
`default_value`,
`is_dynamic`,
`display_text`,
`description`
) VALUES (
'Storage',
'DEFAULT',
'StorageManager',
'Global',
'powerflex.connect.on.demand',
'false',
'false',
1,
'Connect PowerFlex client on Host on-demand',
'Connect PowerFlex client on Host when first Volume created and disconnect when last Volume deleted (or always stay connected otherwise).'
);
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.resource_reservation', 'mgmt_server_id', 'bigint unsigned NULL COMMENT "management server id" ');
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.resource_reservation', 'created', 'datetime DEFAULT NULL COMMENT "date when the reservation was created" ');
UPDATE `cloud`.`resource_reservation` SET `created` = now() WHERE `created` IS NULL;