From bc8bdf87239f2210f7fac20515378f7ed201df0e Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Wed, 22 Aug 2012 19:56:36 +0530 Subject: [PATCH] CS-16135: Create volume after upgrade from snapshot taken in 2.2.14 deletes the snapshot physically from sec. storage. Added DB upgrade sql to make swift_id NULL if they are set to 0 and also added a check in the code to check for swift not present by checking swift_id != null && !=0 Reviewed-by: Kishan --- server/src/com/cloud/storage/StorageManagerImpl.java | 2 +- setup/db/db/schema-304to305.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index e64d129e69f..23ae816bf45 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -713,7 +713,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag } catch (StorageUnavailableException e) { s_logger.error(basicErrMsg); } finally { - if (snapshot.getSwiftId() != null) { + if (snapshot.getSwiftId() != null && snapshot.getSwiftId() != 0) { _snapshotMgr.deleteSnapshotsDirForVolume(secondaryStoragePoolUrl, dcId, accountId, volumeId); } _snapshotDao.unlockFromLockTable(snapshotId.toString()); diff --git a/setup/db/db/schema-304to305.sql b/setup/db/db/schema-304to305.sql index 1cd73fa60f8..d079731b3fa 100755 --- a/setup/db/db/schema-304to305.sql +++ b/setup/db/db/schema-304to305.sql @@ -379,3 +379,5 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'manageme INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'management-server', 'traffic.sentinel.exclude.zones', '', 'Traffic going into specified list of zones is not metered'); DROP TABLE IF EXISTS `cloud`.`ovs_tunnel_account`; +UPDATE `cloud`.`snapshots` set swift_id=null where swift_id=0; +