cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject [1/2] git commit: updated refs/heads/4.2 to c75ac2a
Date Fri, 09 Aug 2013 09:24:56 GMT
Updated Branches:
  refs/heads/4.2 281abef0d -> c75ac2ab2
  refs/heads/master 32701f027 -> 0eb67bff1


CLOUDSTACK-4146, CLOUDSTACK-4147: Fix KVM snapshot upgrade.
when migrating KVM snapshot path, CONCAT is not required. back_snap_id is complete path for
KVM snapshots


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c75ac2ab
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c75ac2ab
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c75ac2ab

Branch: refs/heads/4.2
Commit: c75ac2ab20d8e4ad647930cdc03476be22aebc61
Parents: 281abef
Author: Kishan Kavala <kishan@cloud.com>
Authored: Fri Aug 9 14:45:37 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Fri Aug 9 14:45:37 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java     | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c75ac2ab/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 b80a3f9..991a54e 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -1291,7 +1291,7 @@ public class Upgrade410to420 implements DbUpgrade {
                 // Above path should change to /snapshots/1/2/6/i-2-6-VM_ROOT-6_20121219072022
                 int index = backUpPath.indexOf("snapshots"+File.separator);
                 if (index > 1){
-                    String correctedPath = File.separator + backUpPath.substring(index);
+                    String correctedPath = backUpPath.substring(index);
                     s_logger.debug("Updating Snapshot with id: "+id+" original backup path:
"+backUpPath+ " updated backup path: "+correctedPath);
                     pstmt = conn.prepareStatement("UPDATE `cloud`.`snapshots` set backup_snap_id=?
where id = ?");
                     pstmt.setString(1, correctedPath);
@@ -1958,10 +1958,17 @@ public class Upgrade410to420 implements DbUpgrade {
 
         s_logger.debug("Updating snapshot_store_ref table from snapshots table");
         try {
+            //Update all snapshots except KVM snapshots
             snapshotStoreInsert = conn
-                    .prepareStatement("INSERT INTO `cloud`.`snapshot_store_ref` (store_id,
 snapshot_id, created, size, parent_snapshot_id, install_path, volume_id, update_count, ref_cnt,
store_role, state) select sechost_id, id, created, size, prev_snap_id, CONCAT('snapshots',
'/', account_id, '/', volume_id, '/', backup_snap_id), volume_id, 0, 0, 'Image', 'Ready' from
`cloud`.`snapshots` where status = 'BackedUp' and sechost_id is not null and removed is null");
+                    .prepareStatement("INSERT INTO `cloud`.`snapshot_store_ref` (store_id,
 snapshot_id, created, size, parent_snapshot_id, install_path, volume_id, update_count, ref_cnt,
store_role, state) select sechost_id, id, created, size, prev_snap_id, CONCAT('snapshots',
'/', account_id, '/', volume_id, '/', backup_snap_id), volume_id, 0, 0, 'Image', 'Ready' from
`cloud`.`snapshots` where status = 'BackedUp' and hypervisor_type <> 'KVM' and sechost_id
is not null and removed is null");
             int rowCount = snapshotStoreInsert.executeUpdate();
-            s_logger.debug("Insert modified " + rowCount + " rows");
+            s_logger.debug("Inserted " + rowCount + " snapshots into snapshot_store_ref");
+
+            //backsnap_id for KVM snapshots is complate path. CONCAT is not required
+            snapshotStoreInsert = conn
+                    .prepareStatement("INSERT INTO `cloud`.`snapshot_store_ref` (store_id,
 snapshot_id, created, size, parent_snapshot_id, install_path, volume_id, update_count, ref_cnt,
store_role, state) select sechost_id, id, created, size, prev_snap_id, backup_snap_id, volume_id,
0, 0, 'Image', 'Ready' from `cloud`.`snapshots` where status = 'BackedUp' and hypervisor_type
= 'KVM' and sechost_id is not null and removed is null");
+            rowCount = snapshotStoreInsert.executeUpdate();
+            s_logger.debug("Inserted " + rowCount + " KVM snapshots into snapshot_store_ref");
         }
         catch (SQLException e) {
             String msg = "Unable to migrate snapshot_store_ref." + e.getMessage();


Mime
View raw message