mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-15 18:12:35 +01:00
bug 8712: since we add multiple concurrent policy back in 2.2.3, we only support upgrade from 2.1.7 to 2.2.3, otherwise some policies will be removed silently
need test this upgarde
This commit is contained in:
parent
5b1a421e62
commit
b32e8f23a6
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.upgrade.dao;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.cloud.utils.PropertiesUtil;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class UpgradeSnapshot217to223 implements DbUpgrade {
|
||||
|
||||
@Override
|
||||
public File[] getPrepareScripts() {
|
||||
File file = PropertiesUtil.findConfigFile("schema-snapshot-217to223.sql");
|
||||
if (file == null) {
|
||||
throw new CloudRuntimeException("Unable to find the upgrade script, chema-snapshot-217to223.sql");
|
||||
}
|
||||
|
||||
return new File[] {file};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] getCleanupScripts() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getUpgradableVersionRange() {
|
||||
return new String[] { "2.1.7", "2.1.7" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUpgradedVersion() {
|
||||
return "2.2.3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsRollingUpgrade() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V
|
||||
protected VersionDaoImpl() {
|
||||
super();
|
||||
|
||||
_upgradeMap.put(new Pair<String, String>("2.1.7", "2.2.1"), new DbUpgrade[] { new Upgrade217to22() });
|
||||
_upgradeMap.put(new Pair<String, String>("2.1.7", "2.2.3"), new DbUpgrade[] { new Upgrade217to22(), new Upgrade221to222(), new UpgradeSnapshot217to223()});
|
||||
|
||||
CurrentVersionSearch = createSearchBuilder(String.class);
|
||||
CurrentVersionSearch.select(null, Func.FIRST, CurrentVersionSearch.entity().getVersion());
|
||||
|
||||
@ -1258,13 +1258,6 @@ CREATE TABLE `cloud`.`snapshot_policy` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`snapshot_policy_ref` (
|
||||
`snap_id` bigint unsigned NOT NULL,
|
||||
`volume_id` bigint unsigned NOT NULL,
|
||||
`policy_id` bigint unsigned NOT NULL,
|
||||
UNIQUE (snap_id, policy_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`snapshot_schedule` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`volume_id` bigint unsigned NOT NULL COMMENT 'The volume for which this snapshot is being taken',
|
||||
|
||||
11
setup/db/schema-snapshot-217to223.sql
Normal file
11
setup/db/schema-snapshot-217to223.sql
Normal file
@ -0,0 +1,11 @@
|
||||
ALTER table snapshots add column `data_center_id` bigint unsigned NOT NULL ;
|
||||
ALTER table snapshots add column `domain_id` bigint unsigned NOT NULL;
|
||||
ALTER table snapshots add column `disk_offering_id` bigint unsigned NOT NULL;
|
||||
ALTER table snapshots add column `size` bigint unsigned NOT NULL;
|
||||
ALTER table snapshots add column `version` varchar(32) DEFAULT '2.1';
|
||||
ALTER table snapshots add column `hypervisor_type` varchar(32) DEFAULT 'XenServer';
|
||||
|
||||
UPDATE snapshots s, volumes v SET s.data_center_id=v.data_center_id, s.domain_id=v.domain_id, s.disk_offering_id=v.disk_offering_id, s.size=v.size WHERE s.volume_id = v.id
|
||||
UPDATE snapshots s, snapshot_policy sp, snapshot_policy_ref spr SET s.type=snapshot_type=sp.interval+3. WHERE s.id=spr.snap_id and spr.policy_id=sr.id
|
||||
|
||||
DROP table snapshot_policy_ref
|
||||
Loading…
x
Reference in New Issue
Block a user