CLOUDSTACK-4002: We should use backup_snap_id in snapshots table to

construct snapshot install_path in snapshot_store_ref for pre-4.2.0
snapshot.
This commit is contained in:
Min Chen 2013-08-06 14:38:32 -07:00
parent a8990cffd4
commit 93814d1738

View File

@ -1952,7 +1952,7 @@ public class Upgrade410to420 implements DbUpgrade {
try {
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, '/', path), 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 sechost_id is not null and removed is null");
snapshotStoreInsert.executeUpdate();
}
catch (SQLException e) {