Updated Branches: refs/heads/4.2-forward 208507a42 -> ad6fc9f68
CLOUDSTACK-4492: DB upgrade for volume state, from UploadOp to Uploaded Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ad6fc9f6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ad6fc9f6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ad6fc9f6 Branch: refs/heads/4.2-forward Commit: ad6fc9f680618701b84ccd66f12b06928ad6b718 Parents: 208507a Author: Edison Su <[email protected]> Authored: Mon Aug 26 15:48:50 2013 -0700 Committer: Edison Su <[email protected]> Committed: Mon Aug 26 15:49:09 2013 -0700 ---------------------------------------------------------------------- .../com/cloud/upgrade/dao/Upgrade410to420.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ad6fc9f6/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java index da7e570..81f11f0 100755 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java @@ -111,6 +111,25 @@ public class Upgrade410to420 implements DbUpgrade { updateConcurrentConnectionsInNetworkOfferings(conn); migrateDatafromIsoIdInVolumesTable(conn); setRAWformatForRBDVolumes(conn); + migrateVolumeOnSecondaryStorage(conn); + } + + private void migrateVolumeOnSecondaryStorage(Connection conn) { + PreparedStatement sql = null; + try { + sql = conn.prepareStatement("update `cloud`.`volumes` set state='Uploaded' where state='UploadOp'"); + sql.executeUpdate(); + } catch (SQLException e) { + throw new CloudRuntimeException("Failed to upgrade volume state: ", e); + } finally { + if (sql != null) { + try { + sql.close(); + } catch (SQLException e) { + + } + } + } } private void persistVswitchConfiguration(Connection conn) {
